21.08.2013, 15:10
Hey, when I perform /givegun on player he loses his current weapon and he got his new weapon.
Give gun command:
That's my givegun.
Give gun command:
pawn Код:
COMMAND:givegun(playerid, params[])
{
if(pInfo[playerid][AdminLevel] < 3) return SendClientMessage(playerid, ERROR, ERROR_LEVEL);
new Weapon[50], Ammo, targetID;
if(sscanf(params, "us[50]I(500)", targetID, Weapon, Ammo)) return SendClientMessage(playerid, ERROR, USAGE_GIVEGUN);
new Message[128], Weapons = GetWeaponID(Weapon);
if(Weapons < 0 || Weapons > 46 || Weapons == 19 || Weapons == 20 || Weapons == 21 || Weapons == 22 || Ammo <= 500 || Ammo > 10000) return SendClientMessage(playerid, ERROR, ERROR_WEAPON);
GivePlayerWeapon(targetID, Weapons, Ammo);
format(Message, sizeof(Message), "You gave a '%s' to %s.", WeaponNames[Weapons], GetName(targetID));
SendClientMessage(playerid, ABLUE, Message);
GameTextForPlayer(targetID, "Weapon received!", 5000, 5);
return 1;
}