04.05.2015, 12:58
His was actually correct. Apart from not checking weapon IDs 19-21 (Invalid weapon IDs), his code was perfect.
He never had '0 <= 0 weaponid', that was your mistake.
He never had '0 <= 0 weaponid', that was your mistake.
pawn Код:
CMD:givegun(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessageEx(playerid, COLOR_RED, " You are not authorized to use that command !");
new giveplayerid, weaponid;
if(sscanf(params, "ud", giveplayerid, weaponid)) return SendClientMessage(playerid, COLOR_WHITE, "Syntax:givegun [player] [weaponid]");
if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_RED, "Offline player");
if(!(0 <= weaponid <= 18 || 22 <= weaponid <= 46)) return SendClientMessageEx(playerid, COLOR_RED, "Invalid weaponid");
if(weaponid == 38) return SendClientMessageEx(playerid, COLOR_RED, "You cannot give anyone a minigun!");
GivePlayerGun(giveplayerid, weaponid, 50);
return 1;
}