27.02.2011, 22:08
Im making a admin script and my script is
my errors are
PLEASE HELP!!!!
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;
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.