SA-MP Forums Archive
Commands having effects on only ID 0 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Commands having effects on only ID 0 (/showthread.php?tid=322812)



Commands having effects on only ID 0 - lewismichaelbbc - 03.03.2012

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



Re: Commands having effects on only ID 0 - ikey07 - 03.03.2012

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