MySQL
#1

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.

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;
}
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
Reply


Messages In This Thread
MySQL - by Cowboy - 29.10.2011, 18:59
Re: MySQL - by DreamOnIt - 29.10.2011, 19:17
Re: MySQL - by woot - 29.10.2011, 19:41
Re: MySQL - by Cowboy - 30.10.2011, 11:20
Re: MySQL - by Pinguinn - 30.10.2011, 11:42
Re: MySQL - by Cowboy - 30.10.2011, 11:51
Re: MySQL - by Cowboy - 30.10.2011, 12:28
Re: MySQL - by Cowboy - 31.10.2011, 16:29

Forum Jump:


Users browsing this thread: 2 Guest(s)