Commands having effects on only ID 0
#1

This command is /rconmakeleader ID FACTIONID

But, when i type 1 or 2 like this /rconmakeleader 2 - it still does it for ID 0. Please could someone help me. - I think its something to do with the sscanf params.

Thanks

pawn Код:
CMD:rconmakeleader(playerid, params[]) //using ZCMD this is how your command will start off looking like.
{
    if(IsPlayerAdmin(playerid))
    {
        new adminname[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],otherplayerid,factionid;
        GetPlayerName(otherplayerid,pname,sizeof(pname));
        GetPlayerName(playerid,adminname,sizeof(adminname));
        if(sscanf(params, "ui", otherplayerid, factionid))
            SendClientMessage(playerid, 0xFFFFFFFF, "/makeleader [playerid/name] [faction id]");
        else if(otherplayerid == INVALID_PLAYER_ID)
            SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected");
        else
        {
            PlayerInfo[otherplayerid][pFaction] = factionid;
            new string[200];
            format(string, sizeof(string), "You have set %d 's Faction to id %s", pname, factionid);
            SendClientMessage(playerid, 0xFFFFFFFF, string);
            format(string, sizeof(string), "Your faction has been set to id %s", factionid);
            SendClientMessage(otherplayerid, 0xFFFFFFFF, string);
            new query[200]; //Creates the variables
            GetPlayerName(playerid, pname, 24); //Gets the players name.
            format(query, sizeof(query), "UPDATE playerdata SET faction=%d WHERE user='%s'", factionid, pname);
            mysql_query(query);
            mysql_free_result();
            saveplayers(otherplayerid);
        }
    }
    else
    {
        SendClientMessage(playerid, 0xAAAAAAAA, "You are not admin or the required level.");
        mysql_free_result();
    }
    return 1;
}
Reply
#2

pawn Код:
GetPlayerName(otherplayerid, pname, 24); //Gets the players name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)