29.10.2011, 18:59
Hello, I am trying to make something if a gang leader deletes his gang, it will loop through all online players with that gang id and then set their gang id to 0.
What I am trying to do is that it has to find all players with that gang id and then set it to 0, so if a member of that gang logins in, he wouldn't get acces to the gang cmds. What's wrong with that code? thanks
pawn Код:
COMMAND:deletee(playerid, params[])
{
new pName[MAX_PLAYER_NAME], Query[100];
if(!IsPlayerGangLeader(playerid)) return SendClientMessage(playerid, Red, "You have to be a gang leader of a gang to use this command");
GetPlayerName(playerid, pName, sizeof(pName));
for(new i; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Gang] == PlayerInfo[playerid][Gang])
{
PlayerInfo[i][Gang] = 0;
}
}
}
format(Query, sizeof(Query), "DELETE FROM gangs WHERE owner = '%s'", pName);
mysql_query(Query);
format(Query, sizeof(Query), "UPDATE * FROM users SET gang = 0 WHERE gang = %d", PlayerInfo[playerid][Gang]); // heres an error with mysql debug
mysql_query(Query);
SendClientMessage(playerid, Green, "You have deleted your gang");
return 1;
}