Altercationz
:)
Hello,
I'm just wondering how i can check if a gang exists when creating one, I tried using if (table.Rows.Contains(GangName)) but that did not work either, here's what i have at the moment:
Thanks!
I'm just wondering how i can check if a gang exists when creating one, I tried using if (table.Rows.Contains(GangName)) but that did not work either, here's what i have at the moment:
Code:
sing (IQueryAdapter Adapter = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
Adapter.SetQuery("SELECT gang_name FROM rp_gangs WHERE gang_name = @gangname");
Adapter.AddParameter("gangname", GangName);
table = Adapter.getTable();
}
if (table.Rows.Count > 0)
{
using (IQueryAdapter Adapter = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
Adapter.SetQuery("INSERT INTO rp_gangs (gang_name, gang_owner) VALUES (@gangname, @gangowner)");
Adapter.AddParameter("gangname", GangName);
Adapter.AddParameter("gangowner", GangOwner);
Adapter.RunQuery();
}
Session.SendWhisper("The gang " + GangName + " has been created.");
return;
}
else
{
Session.SendWhisper("That gang already exists!");
return;
}
}
}
}