07.03.2014, 16:07
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;
}