Scripting help
#1

I want /akill and /akillall for my admin system
Reply
#2

pawn Код:
#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;
}
Reply
#3

Errors :

Код:
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
Code :

Код:
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;
}
Reply
#4

Do you have ZCMD included? This compiles just fine for me:

pawn Код:
#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;
}
Reply
#5

Quote:
Originally Posted by Mionee
Посмотреть сообщение
Do you have ZCMD included? This compiles just fine for me:

pawn Код:
#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;
}
the /akill had an error, but the new one worked
Reply
#6

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;
}
Reply
#7

I want /akillall command that all players killed except me.
Reply
#8

pawn Код:
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;
}
Should work.
Reply
#9

help please
Reply
#10

if(!IsPlayerConnected(i)) continue;
====>
if(!IsPlayerConnected(i) || i == playerid) continue;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)