02.07.2014, 03:04
I want /akill and /akillall for my admin system
#include <a_samp>
#include <sscanf2>
#include <zcmd>
CMD:akill(playerid, params[])
{
new target;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not an admin!");
if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "/akill [ID/PartOfName]");
SetPlayerHealth(target, 0);
return true;
}
CMD:akillall(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not an admin!");
for(new i; i < GetMaxPlayers(); i ++) SetPlayerHealth(i, 0);
return true;
}
error 029: invalid expression, assumed zero error 029: invalid expression, assumed zero warning 215: expression has no effect error 001: expected token: ";", but found "new" fatal error 107: too many error messages on one line
CMD:akill(playerid, params[]) { new target; //This if(PlayerInfo[playerid][Admin] < 1 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xF50A0AFF, "<!> ERROR: You are not authorized to use this command!"); if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "/akill [ID/PartOfName]"); SetPlayerHealth(target, 0); return true; }
#include <a_samp>
#include <sscanf2>
#include <zcmd>
enum pInfo
{
Admin,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
CMD:akill(playerid, params[])
{
new target;
if(PlayerInfo[playerid][Admin] < 1 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xF50A0AFF, "<!> ERROR: You are not authorized to use this command!");
if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "/akill [ID/PartOfName]");
SetPlayerHealth(target, 0);
return true;
}
CMD:akillall(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not an admin!");
for(new i; i < GetMaxPlayers(); i ++) SetPlayerHealth(i, 0);
return true;
}
Do you have ZCMD included? This compiles just fine for me:
pawn Код:
|
if(strcmp(cmdtext, "/akill", true) == 0) return SetPlayerHealth(strval(cmdtext[strfind(cmdtext, " ", true, 5) + 1]), 0.0);
if(strcmp(cmdtext, "/akillall", true) == 0)
{
for(new i = GetMaxPlayers() - 1; i != -1; i--)
{
if(!IsPlayerConnected(i)) continue;
SetPlayerHealth(i, 0.0);
}
return 1;
}
CMD:akillall(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not an admin!");
for(new i; i < GetMaxPlayers(); i ++)
{
if(i != playerid) SetPlayerHealth(i, 0);
}
return true;
}