CMD:setarmor(playerid, params[]) { new playa, armor; if(PlayerInfo[playerid][pAdmin] >= 3 || PlayerInfo[playerid][pEventModd] > 0) { if(!sscanf(params, "ui", playa, armor)) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME); SetPlayerArmour(playa, armour); format(str, sizeof(str), "You have set %s's armor to %d.", giveplayer, armor); SendClientMessage(playerid, COLOR_GREY, str); } } } else { SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setarmor [playerid/PartOfName] [armor]"); } } else { AdmErrorMsg; } return 1; }
CMD:setarmor(playerid,params[])
{
new playa,armor;
if(PlayerInfo[playerid][pAdmin] <= 3 || PlayerInfo[playerid][pEventModd] < 0) return AdmErrorMsg;
if(sscanf(params, "ui", playa, armor)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:
{FFFFFF} /setarmor [playerid/PartOfName] [armor]");
if(IsPlayerConnected(playa)
{
strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
SetPlayerArmour(playa, 100);
format(str, sizeof(str), "You have set %s's armor to %d.", giveplayer, armor);
SendClientMessage(playerid, COLOR_GREY, str);
}
return 1;
}
Try this command:
PHP код:
|
CMD:setarmor(playerid, params[])
{
new playa, Float:armor;
if(PlayerInfo[playerid][pAdmin] >= 3 || PlayerInfo[playerid][pEventModd] > 0)
{
if(!sscanf(params, "uf", playa, armor))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
strmid(giveplayer, PlayerICName(playa), 0, MAX_PLAYER_NAME);
SetPlayerArmour(playa, armour);
format(str, sizeof(str), "You have set %s's armor to %.1f.", giveplayer, armor);
SendClientMessage(playerid, COLOR_GREY, str);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /setarmor [playerid/PartOfName] [armor]");
}
}
else
{
AdmErrorMsg;
}
return 1;
}
PHP код:
|
If you've got an anti-cheat, this could be the issue.
With anti-cheats they usually have special functions to set armor. |
CMD:setarmour(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new ID; new amount;
if(sscanf(params,"ui",ID,amount)) return SendClientMessage(playerid,0xf8f8f8fff,"Syntax: {F00f00}/setarmour [ID] [amount]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xf8f8f8fff,"ERROR: {FFFFFF}Player isn't connected!");
if(amount < 0 || amount > 100) return SendClientMessage(playerid, 0xf8f8f8fff, "ERROR: {FFFFFF}Invalid amount (0 -> 100).");
if(PlayerInfo[ID][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, 0xf8f8f8fff,"ERROR: {FFFFFF}You can't set armour to this admin!");
new string[128]; new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "{f00f00}Administrator {f00f00}%s {ffa700}has set your armour amount to {f00f00}%d!",pname,amount);
SendClientMessage(ID,0xf8f8f8fff,string);
SetPlayerArmour(ID,amount);
SendClientMessage(playerid, 0xf8f8f8fff,"[ADMIN] {FFFFFF}Player armour amount has been changed!");
}
else
{
SendClientMessage(playerid,0xf8f8f8fff,"ERROR: {FFFFFF}You aren't authorized to use this command!");
}
return 1;
}
Try this one which im using it in my script:
PHP код:
|