CMD:givegun(playerid, params[]) { new giveplayerid, wepID, ammo, weapon[50], string[128]; if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!"); if(sscanf(params, "ud", giveplayerid, wepID, ammo)) SendClientMessage(playerid, COLOR_RED, "[USAGE]: /givegun [name/id] [weapon id] [ammo]"); if(PlayerInfo[playerid][pGuns] = 4 && PlayerInfo[playerid][pGuns] = 38)<<< Line2234 { SendClientMessageEx(playerid, COLOR_RED, "You are not allowed to give a knife,minigun!"); return 1; } if(wepID < 1 || wepID > 46) SendClientMessage(playerid, COLOR_RED, "Invalid weapon id."); if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Player not found."); if(giveplayerid == playerid) { GetWeaponName(wepID, (weapon), sizeof(weapon)); GivePlayerWeapon(playerid, wepID, ammo); format(string, sizeof(string), "You have given yourself a %s with %d ammo.", weapon, ammo); SendClientMessage(playerid, COLOR_YELLOW, string); } else { GetWeaponName(wepID, (weapon), sizeof(weapon)); format(string, sizeof(string), "You have given %s [%d] a %s with %d ammo.", pName(giveplayerid), giveplayerid, weapon, ammo); SendClientMessage(playerid, COLOR_YELLOW, string); format(string, sizeof(string), "Admin %s [%d] has given you a %s with %d ammo.", pName(playerid), playerid, weapon, ammo); SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string); GivePlayerWeapon(giveplayerid, wepID, ammo); new astring[100]; format(astring, sizeof(astring), "Admin %s [%d] has given %s [%d] a %s with %d ammo.", pName(playerid), playerid, pName(giveplayerid), giveplayerid, weapon, ammo); SendAdminMessage(COLOR_GREY, astring); } return 1; }
(2234) : warning 211: possibly unintended assignment (2234) : warning 211: possibly unintended assignment (2234) : error 022: must be lvalue (non-constant) (2234) : warning 215: expression has no effect (2234) : error 001: expected token: ";", but found ")" (2234) : error 029: invalid expression, assumed zero (2234) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
if(PlayerInfo[playerid][pGuns] = 4 && PlayerInfo[playerid][pGuns] = 38)
if(PlayerInfo[playerid][pGuns] == 4 && PlayerInfo[playerid][pGuns] == 38)
Hello!
PHP код:
PHP код:
|
if(PlayerInfo[playerid][pGuns] == 4 && PlayerInfo[playerid][pGuns] == 38);
I think you mean:
PHP код:
|
That would give error 036: empty statement. Mencent's code is just fine.
|
CMD:givegun(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
new giveplayerid, wepID, ammo;
if(sscanf(params, "uii", giveplayerid, wepID, ammo)) return SendClientMessage(playerid, COLOR_RED, "[USAGE]: /givegun [name/id] [weapon id] [ammo]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Player not found.");
if(wepID == 4 || wepID == 38) return SendClientMessageEx(playerid, COLOR_RED, "You are not allowed to give a knife or minigun!");
if(!(1 <= wepID <= 18 || 22 <= wepID <= 46)) return SendClientMessage(playerid, COLOR_RED, "Invalid weapon id.");
new string[128], weapon[25];
GetWeaponName(wepID, weapon, sizeof(weapon));
if(giveplayerid == playerid)
{
format(string, sizeof(string), "You have given yourself a %s with %d ammo.", weapon, ammo);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "Admin %s [%d] has given themselves a %s with %d ammo.", pName(playerid), playerid, weapon, ammo);
SendAdminMessage(COLOR_GREY, string);
}
else
{
format(string, sizeof(string), "You have given %s [%d] a %s with %d ammo.", pName(giveplayerid), giveplayerid, weapon, ammo);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "Admin %s [%d] has given you a %s with %d ammo.", pName(playerid), playerid, weapon, ammo);
SendClientMessage(giveplayerid, COLOR_LIGHTGREEN, string);
format(string, sizeof(string), "Admin %s [%d] has given %s [%d] a %s with %d ammo.", pName(playerid), playerid, pName(giveplayerid), giveplayerid, weapon, ammo);
SendAdminMessage(COLOR_GREY, string);
}
GivePlayerWeapon(playerid, wepID, ammo);
return 1;
}