Help With Ban CMD -
MBilal - 29.06.2014
My Ban CMD work Fine But
Why Any budy Join Server Server Showed Him Message :
SendClientMessage(id, COLOR_LIGHTGREEN, "You Are Banned From The Server if You Think this Ban is Unfair Make Unban Appeal On Forums ");
PHP код:
CMD:ban(playerid, params[])
{
if(Player[playerid][pAdmin] >= 3)
{
new id,reason[50];
new string[128];
if(sscanf(params, "us[50]", id,reason))return SendClientMessage(playerid, -1, "Usage: /ban [playerid] [Reason]");
if(IsPlayerConnected(id))
{
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_KRED, "Invalid Player");
if(Player[playerid][pAdmin] < Player[id][pAdmin]) return SendClientMessage(playerid, COLOR_KRED," You cant use this on Higher Admin") ;
{
format(string,sizeof(string),"Admin :'%s' has Banned '%s' Reason:%s",GetName(playerid),GetName(id),reason);
SendClientMessageToAll(COLOR_KRED,string);
Player[id][pBan]=1;
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
format(string,sizeof(string),"[%02d:%02d:%02d]%s has banned %s! Reason: %s",Hour,Minute,Second,GetName(playerid),GetName(id),reason);
SendClientMessage(id, COLOR_LIGHTGREEN, "You Are Banned From The Server if You Think this Ban is Unfair Make Unban Appeal On Forums ");
SaveIn("BanLog.txt",string);
SetTimerEx("KickPlayer",1000,false,"d", id);
}
return GameTextForPlayer(id,"~r~you Are Banned By ~r~Admin",3000,1); // Freeze the player
}
else return SendClientMessage(playerid, COLOR_KRED, "Player is not connected!");
}
else return SendPermissionError(playerid);
}
Here is My OnPlayerConnect
PHP код:
if(fexist(UserPath(playerid)))
{ new string[128];
format(string, sizeof(string)," Welcome Back %s To Server",GetName(playerid));
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE" {00CED1} Welcome to Server \n {A1C2FF} If its is not your Account Please Logout\n{FFFFFF} Type your password below to login.","Login","Quit");
SetPlayerScore(playerid,Player[playerid][pScore]);
PAccount[playerid]=1;
if(Player[playerid][pBan]==1)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You Are Banned From The Server if You Think this Ban is Unfair Make Unban Appeal On Forums ");
SetTimerEx("KickPlayer",200,false,"d", playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Welcome To Server");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"{00CED1} Welcome to Server \n{FFFFFF} Type your password below to register a new account.","Register","Quit");
PAccount[playerid]=0;
}
WHy it making All other Ban Also?
Re: Help With Ban CMD -
VladimirMark - 29.06.2014
Do you get any warnings when compiling?
Re: Help With Ban CMD -
MBilal - 29.06.2014
No Warning .no Error
Re : Help With Ban CMD -
Clad - 29.06.2014
pawn Код:
if(Player[playerid][pBan] == 1)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You Are Banned From The Server if You Think this Ban is Unfair Make Unban Appeal On Forums ");
SetTimerEx("KickPlayer",200,false,"d", playerid);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Welcome To Server");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"{00CED1} Welcome to Server \n{FFFFFF} Type your password below to register a new account.","Register","Quit");
PAccount[playerid]=0;
}
Re: Help With Ban CMD -
Juvanii - 29.06.2014
What do you mean by "everybody" ? Do you mean people with "Ban status = 0" too?
[Edit:] Check Clad's method if it's working, if not! check what variable do u store in Ban status in the default stats.
Re: Help With Ban CMD -
-=Dar[K]Lord=- - 29.06.2014
Might be a problem while either parsing the data or saving data onplayerdisconnect.
Re: Help With Ban CMD -
MBilal - 29.06.2014
Those player who are not banned they also get banned when i ban some one in the server
Re: Help With Ban CMD -
-=Dar[K]Lord=- - 29.06.2014
Then i think there's something wrong on player disconnect because there it saves the players file.
And by others getting banned you mean all the players or some of them?
Re : Help With Ban CMD -
Clad - 29.06.2014
Did you try the code I gave you above ?
Re: Help With Ban CMD -
MBilal - 29.06.2014
Clad You Remove Login Codes Your Code saying only register and yeah if Ban status ==0 if i ban some one after than any other player join he also get banned