How i can make a command that would set a pDgun variable to a player with this syntax:
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!");
}
}
}