Set admin name error
#1

When i try this code about admin name i get this error
pawn Код:
C:\Users\Humi\Desktop\REVO-RP\PR-RP\filterscripts\Tes.pwn(92) : error 001: expected token: "#endif", but found "-end of file-"
here is the code
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

enum pInfo
{
    pAdmin,
    AdminName[24],
    PlayerName[24],
    bool:HasSetAdminName,
    OnDuty
}

new PlayerInfo[MAX_PLAYERS][pInfo];

CMD:setadmin(playerid, params[])
{
    new
        lvl,
        a_string[65],
        name[MAX_PLAYER_NAME]
    ;

    if(sscanf(params, "i", lvl))
    {
        return SendClientMessage(playerid, -1, "USAGE: /setadmin [level]");
    }

    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    PlayerInfo[playerid][PlayerName] = name;
    PlayerInfo[playerid][pAdmin] = lvl;
    format(a_string, 65, "You are now admin level %d.", lvl);
    SendClientMessage(playerid, -1, a_string);

    return 1;
}

CMD:setadminname(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1)
    {
        return SendClientMessage(playerid, -1, "You are not an admin.");
    }

    new
        adminname[24],
        a_string[65]
    ;

    if(sscanf(params, "s[24]", adminname))
    {
        return SendClientMessage(playerid, -1, "USAGE: /setadminanme [name]");
    }

    PlayerInfo[playerid][AdminName] = adminname;
    format(a_string, 65, "Your admin name is %s.", PlayerInfo[playerid][AdminName]);
    SendClientMessage(playerid, -1, a_string);
    PlayerInfo[playerid][HasSetAdminName] = true;

    return 1;
}

CMD:adminduty(playerid, params[])
{
    if(!PlayerInfo[playerid][pAdmin])
    {
        return SendClientMessage(playerid, -1, "You are not an admin.");
    }

    if(PlayerInfo[playerid][OnDuty])
    {
        SetPlayerName(playerid, PlayerInfo[playerid][PlayerName]);
        PlayerInfo[playerid][OnDuty] = false;
    }
    else
    {
        if(!PlayerInfo[playerid][HasSetAdminName])
        {
            return SendClientMessage(playerid, -1, "You haven't set an admin name yet.");
        }

        SetPlayerName(playerid, PlayerInfo[playerid][AdminName]);
        PlayerInfo[playerid][OnDuty] = true;
    }

    return 1;
}
please help me with this error
Reply
#2

Add
pawn Код:
#endif
after last line of your code, and uncomment the #define line as the instruction tells you (if you want this to be a filterscript)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)