how i fix admin script
#1

Im making a admin script and my script is
pawn Код:
COMMAND:setadmin(playerid, params[])
{
    new id,alevel;
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFFFFFFAA,"SERVER: Unknown command");
    if(sscanf(params,"ui", id,alevel))return SendClientMessage(playerid, 0xFF9900AA, "Usage: /setadmin1 [id] [level 1 - 4]");
    if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000FF, "Player not found");
    if(PlayerData[id][AdminLevel] == 1)SendClientMessage(playerid,0xFF0000FF,"That player is already an admin.");
    if(alevel > 4)return SendClientMessage(playerid,0xFF0000FF,"Levels currently avaliable: 1 - 4");
    if(alevel == 1)
    {
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 1 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 1;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    if(alevel == 2)
    {
        GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
        format(file,sizeof(file),USER_FILES, pname);
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 2 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 2;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    if(alevel == 3)
    {
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 3 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 3;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    if(alevel == 4)
    {
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 4 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 4;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    return 1;
my errors are
pawn Код:
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : error 017: undefined symbol "PlayerData"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : warning 215: expression has no effect
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : error 001: expected token: ";", but found "]"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : error 029: invalid expression, assumed zero
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
PLEASE HELP!!!!
Reply
#2

And the mysterious line 84 is ...?
Reply
#3

pawn Код:
if(PlayerData[id][AdminLevel] == 1)SendClientMessage(playerid,0xFF0000FF,"That player is already an admin.");
Reply
#4

pawn Код:
if(PlayerData[id][AdminLevel] == 1) return SendClientMessage(playerid,0xFF0000FF,"That player is already an admin.");
Reply
#5

pawn Код:
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : error 017: undefined symbol "PlayerData"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : warning 215: expression has no effect
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : error 001: expected token: ";", but found "]"
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : error 029: invalid expression, assumed zero
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Admin.pwn(84) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
more stupid, i still have this
Reply
#6

Quote:
Originally Posted by tanush
Посмотреть сообщение
more stupid
Tell me about it.
pawn Код:
if(PlayerData[id][IsAdmin] == 1) return SendClientMessage(playerid,0xFF0000FF,"That player is already an admin.");
Reply
#7

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <sscanf>

#if defined FILTERSCRIPT


//Colours//
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFF0000FF
#define gray 0x555555FF
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA // - Light light pink
#define COLOR_SEAGREEN 0x2E8B57AA
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
#define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^

//colours//

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

COMMAND:setadmin(playerid, params[])
{
    new id,alevel;
    if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,0xFFFFFFAA,"SERVER: Unknown command");
    if(sscanf(params,"ui", id,alevel))return SendClientMessage(playerid, 0xFF9900AA, "Usage: /setadmin1 [id] [level 1 - 4]");
    if(id == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF0000FF, "Player not found");
    if(PlayerData[id][AdminLevel] == 1) return SendClientMessage(playerid,0xFF0000FF,"That player is already an admin.");
    if(alevel > 4)return SendClientMessage(playerid,0xFF0000FF,"Levels currently avaliable: 1 - 4");
    if(alevel == 1)
    {
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 1 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 1;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    if(alevel == 2)
    {
        GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
        format(file,sizeof(file),USER_FILES, pname);
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 2 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 2;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    if(alevel == 3)
    {
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 3 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 3;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    if(alevel == 4)
    {
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(String, sizeof(String),"[AdminChat] %s has set %s to a level 4 admin on the server.",Name,pname);
        MessageToAdmins(0xFF9900AA, String);
        format(String, sizeof(String),"Congratulations, you have earned the postion of an Admin on the server. Please type /acmds to see the commands.");
        SendClientMessage(id,0xFF9900AA,String);
        PlayerData[id][AdminLevel] = 4;
        PlayerData[playerid][IsAdmin] = 1;
        PlayerData[id][IsAdmin] = 1;
    }
    return 1;
}
im making a new admin script! with zcmd and sccanf
Reply
#8

LMFAO you didn't define PlayerData... /facepalm
Reply
#9

how i do that /facepalm
Reply
#10

pawn Код:
enum pData
{
    IsAdmin,
    Adminlevel
};
new PlayerData[MAX_PLAYERS][pData];
I hope you know where to put that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)