12.07.2011, 19:30
with SSCANF + ZCMD:
Note: Untested.
pawn Код:
CMD:giveweapon(playerid,params[])
{
new ID, GUN, AMMO;//Creates th variables
if(sscanf(params, "uii", ID, GUN, AMMO)) return SendClientMessage(playerid,-1,"Usage: /giveweapon [gunid] [ammo]");//if the player enters the wrong params
if(GUN == 0 || GUN >= 45) return SendClientMessage(playerid, -1, "Invalid gunid!");//if the gunid is invalid
if(IsPlayerConnected(ID) && ID != INVALID_PLAYER_ID)//if the player is connected and is valid
{
GivePlayerWeapon(ID, GUN, AMMO);//Gives the GUN and AMMO specified
SendClientMessage(ID, -1, "Someone gave you a gun!");//Sends a message to the player that they received a gun
}
return 1;
}