Need help with admin system -
BizzyD - 29.03.2011
Hello, i need some help here. I am scripting a registration + admin system. Based on a tutorial by
Snipa
I get this errors:
Код:
(689) : error 017: undefined symbol "id"
(690) : error 017: undefined symbol "id"
(693) : error 017: undefined symbol "n"
(693) : error 017: undefined symbol "n"
(693) : error 029: invalid expression, assumed zero
(693) : fatal error 107: too many error messages on one line
This is the command i get my errors on:
pawn Код:
CMD:ban(playerid,params[])
{
if(PInfo[playerid][Level] >=2 || IsPlayerAdmin(playerid))
new idn[MAX_PLAYER_NAME],reason[50], on[MAX_PLAYER_NAME], string[128], string2[128],file[128];
if(sscanf(params,"uz",idn, reason)) return SendClientMessage(playerid,RED,"Usage: /ban [id] [reason]");
if(PInfo[id][Level] > PInfo[playerid][Level]) SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this administrator!");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,RED,"ERROR: Player is not connected");
else
{
GetPlayerName(playerid,n,sizeof(n));
GetPlayerName(id,on,sizeof(on));
format(string,sizeof(string),"You have been banned by Administrator %s for %s",n, reason);
SendClientMessage(id,RED,string);
format(string2, sizeof(string2), "Administrator %s has banned %s for %s",n,on,reason);
SendClientMessageToAll(RED,string2);
TogglePlayerControllable(id, false);
BanEx(id,reason);
}
}
else return SendClientMessage(playerid,RED,"You are not a high enough level to use this command!");
return 1;
}
Line 689
Код:
if(PInfo[id][Level] > PInfo[playerid][Level]) SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this administrator!");
Line 690
Line 693
Код:
GetPlayerName(id,on,sizeof(on));
I cant seem to fix this
Anyone knows?
Thanks, Alex
Re: Need help with admin system -
-Rebel Son- - 29.03.2011
PHP код:
CMD:ban(playerid, params[])
{
new id, reason[128];
new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
if(GetPVarInt(playerid, "Level") >= 2)
{
if (sscanf(params, "us", id, reason)) return SendClientMessage(playerid, COLOR_RED, SERVER_BOT "USAGE: /ban [id] [reason]");
if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, SERVER_BOT "This player is not connected");
if(GetPVarInt(playerid, "Level") >= 2) return SendClientMessage(playerid, COLOR_RED, SERVER_BOT "Cannot ban this person!");
new stri[256];
GetPlayerName(id, victimname, sizeof(victimname));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(stri,128,SERVER_BOT "%s(%d) has banned %s(%d) (Reason: %s)",adminname, playerid, victimname, id, reason);
SendClientMessageToAll(COLOR_GREEN,stri);
BanEx(id, reason);
return 1;
}else return SendClientMessage(playerid,COLOR_RED,SERVER_BOT "You arent Authorised!");}
Heres miine, edit it to your system.
Re: Need help with admin system -
xir - 29.03.2011
Here is yours with fixed errors
pawn Код:
CMD:ban(playerid,params[])
{
if(PInfo[playerid][Level] >=2 || IsPlayerAdmin(playerid))
{
new id, name[MAX_PLAYER_NAME],reason[50], name2[MAX_PLAYER_NAME], string[128]; //file[128]; You never used this one?
if(sscanf(params,"us[50]",id, reason[2])) return SendClientMessage(playerid,RED,"Usage: /ban [id] [reason]");
if(PInfo[playerid][Level] > PInfo[playerid][Level]) SendClientMessage(playerid,RED,"ERROR: You cannot use this command on this administrator!");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,RED,"ERROR: Player is not connected");
else
{
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(id,name2,sizeof(name2));
format(string,sizeof(string),"You have been banned by Administrator %s for %s",name, reason[2]);
SendClientMessage(id,RED,string);
format(string, sizeof(string), "Administrator %s has banned %s for %s",name,name2,reason[2]);
SendClientMessageToAll(RED,string);
TogglePlayerControllable(id, false);
BanEx(id,reason);
}
}
else return SendClientMessage(playerid,RED,"You are not a high enough level to use this command!");
return 1;
}