SA-MP Forums Archive
command help - 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: command help (/showthread.php?tid=351199)



command help - trulis - 15.06.2012

How i can make a command that would set a pDgun variable to a player with this syntax:
/givepdgun [playerid/PartOfName] [rank] (rank is a number)


Re: command help - Littlehelper - 15.06.2012

What?
Please be more specific..And this is not a script request section.


Re: command help - trulis - 15.06.2012

pawn Код:
if(strcmp(cmd, "/givedgun", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp));
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givedgun [playerid/PartOfName] [rank]");
                return 1;
            }
            new amount;
            amount = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1339)
            {
                PlayerInfo[giveplayerid][pDgun] = amount;
                format(string, sizeof(string), "   The Player Was Set To %d DG Rank", amount);
                GetPlayerName(playur, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, 256, "News: %s has set %s's dgrank to %d.", sendername,giveplayer,amount);
                ABroadCast(COLOR_YELLOW,string,1);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
    }
Will this work ?