Player to player Give gun command
#4

pawn Код:
CMD:givegun(playerid, params[])
{
    new id, Float:X, Float:Y, Float:Z, playergun, playerammo;
    playergun = GetPlayerWeapon(playerid);
    playerammo = GetPlayerAmmo(playerid);

    if(sscanf(params,"u", id)) return SCM(playerid, -1_GREY,"[Usage:] /givegun [playerid/partofname].");
    if(playergun < 1) return SCM(playerid, -1,"[Error:] You do not have a weapon.");
    if(playerammo < 1) return SCM(playerid, -1,"[Error:] You do not have any ammo.");
    if(playerid == id) return SCM(playerid, -1,"[Error:] You can't give a weapon to yourself.");

    GetPlayerPos(id, X, Y, Z);
    if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
    {
        GivePlayerWeapon(id, playergun, playerammo);
        GivePlayerWeapon(playerid, playergun, -playerammo);

    } else return SCM(playerid, -1, "[Error:] You're not close enough.");
    return 1;
}
This will give the other player the weapon you have in your hand. I suggest you study the command so you know what to do next time. You'll need zcmd and sscanf.
Reply


Messages In This Thread
Player to player Give gun command - by ParadiseRP - 07.03.2014, 15:52
Re: Player to player Give gun command - by biker122 - 07.03.2014, 16:03
Re: Player to player Give gun command - by ParadiseRP - 07.03.2014, 16:04
Re: Player to player Give gun command - by Chrillzen - 07.03.2014, 16:07
Re: Player to player Give gun command - by ParadiseRP - 07.03.2014, 16:13
Re: Player to player Give gun command - by Chrillzen - 07.03.2014, 19:02
Re: Player to player Give gun command - by XK - 07.03.2014, 19:09
Re: Player to player Give gun command - by ParadiseRP - 08.03.2014, 08:11

Forum Jump:


Users browsing this thread: 1 Guest(s)