15.12.2014, 19:52
pawn Код:
CMD:givegun(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
if(sscanf(params, "ud", target, gun)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /givegun <playerid> <gun>");
if(gun < 1 || gun > 47) return SendClientMessage(playerid, COLOR_GREY, "Don't go below 1 or above 47.");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_GREY, "User is not connected!");
if(gun != 21)
{
GivePlayerWeapon(target, gun, 50000); //Your version would be GivePlayerValidWeapon, this also may be causing issues.
format(string, sizeof(string), "Admin %s has given you a weapon.", GetName(playerid));
SendClientMessage(target, COLOR_GREY, string);
format(string, sizeof(string), "You have given %s a weapon.", GetName(target));
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}