A /giveweapon Command?
#8

with SSCANF + ZCMD:

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;
}
Note: Untested.
Reply


Messages In This Thread
A /giveweapon Command? - by phil_lendon - 12.07.2011, 16:57
Re: A /giveweapon Command? - by PhoenixB - 12.07.2011, 17:02
Re: A /giveweapon Command? - by phil_lendon - 12.07.2011, 17:11
Re: A /giveweapon Command? - by PhoenixB - 12.07.2011, 17:29
Re: A /giveweapon Command? - by PhoenixB - 12.07.2011, 17:43
Re: A /giveweapon Command? - by phil_lendon - 12.07.2011, 17:48
Re: A /giveweapon Command? - by phil_lendon - 12.07.2011, 18:22
Re: A /giveweapon Command? - by alpha500delta - 12.07.2011, 19:30
Re: A /giveweapon Command? - by [LHT]Bally - 19.02.2012, 16:37
Re: A /giveweapon Command? - by ReneG - 19.02.2012, 19:08

Forum Jump:


Users browsing this thread: 1 Guest(s)