SA-MP Forums Archive
Set admin name error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Set admin name error (/showthread.php?tid=414032)



Set admin name error - REVO-RP - 07.02.2013

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


Re: Set admin name error - Misiur - 07.02.2013

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)