unban cmd 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: unban cmd error (
/showthread.php?tid=501944)
unban cmd error -
Sojo12 - 21.03.2014
I took this code from this forum only but im getting else erros and dont know how to fix it.Help will be appreciated.
Code:
Код:
CMD:unban(playerid, params[])
{
new string[128];
new pName[24];
if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0099}[ADMIN]{FFFFFF} /unban [playername]");
{
format(string, 128, "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params,pName);
SendClientMessageToAll(COLOR_ADMIN,string);
new year, month,day;
getdate(year, month, day);
new playa[MAX_PLAYER_NAME];
GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
format(string, sizeof(string), "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params, playa);
SendClientMessageToAll(COLOR_ADMIN, string);
}
else
{
SendClientMessage( playerid, -1, "{FF0000}[ERROR]{FFFFFF}Not a banned account or no such account was found!" );
}
return 1;
}
Re: unban cmd error -
MythicalMarauder - 21.03.2014
Show us your errors?
Re: unban cmd error -
Sojo12 - 21.03.2014
Код:
C:\Users\HACKIFYOUCAN\Desktop\NEW\FunGaming Stunt-Freeroam\gamemodes\SFCRRPG.pwn(5502) : error 029: invalid expression, assumed zero
In line 5502 its like this
Re: unban cmd error -
UnknownOwner - 21.03.2014
Must be:
Re: unban cmd error -
Hanuman - 21.03.2014
you need to define a condition
Код:
new string[128];
new pName[24];
if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0099}[ADMIN]{FFFFFF} /unban [playername]");
if(//File present)//like this
{
format(string, 128, "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params,pName);
SendClientMessageToAll(COLOR_ADMIN,string);
Re: unban cmd error -
Sojo12 - 21.03.2014
@Unknown its like that only but i was unable to make it like that overhere.
Hanuman im testng it right now!NOt working.
Another one please
Re: unban cmd error -
Carac - 21.03.2014
I'm using this one
pawn Код:
CMD:unban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBanAppealer] >= 1)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
new string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");
if(doesAccountExist(params))
{
OnPlayerOfflineLogin(params);
if(PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "Permanently banned accounts can only be unbanned via FTP.");
}
else
{
if(PlayerInfo[MAX_PLAYERS][pBanned] >= 1)
{
PlayerInfo[MAX_PLAYERS][pBanned] = 0;
if(PlayerInfo[MAX_PLAYERS][pWarns] == 3)
PlayerInfo[MAX_PLAYERS][pWarns] = 0;
RemoveBan(PlayerInfo[MAX_PLAYERS][pIP]);
OnPlayerOfflineSave(params);
format(string, 128, "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
format(string, sizeof(string), "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
Log("logs/ban.log", string);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Not a banned account!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "That account doesn't exist.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;
}
Re: unban cmd error -
Konstantinos - 21.03.2014
The command is incomplete. You check an if statement and then you return an error message. After than you open a bracket and do the code to unban (even though, it's just message. It doesn't actually unban the player) and then you check an else statement when you didn't use an if before. Like Hanuman said, you need to use an if statement that checks if the player is banned (everything depends on how you ban a player).
If you don't know how to make a simple ban/unban command by yourself, check some tutorials or filterscripts out. It will help you a lot!
Re: unban cmd error -
Hanuman - 21.03.2014
u are using dini or YSI?
Re: unban cmd error -
Sojo12 - 21.03.2014
dini