Help With Ban CMD
#1

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(playeridparams[])
{
       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(playeridCOLOR_KRED"Invalid Player");
               if(
Player[playerid][pAdmin] < Player[id][pAdmin]) return SendClientMessage(playeridCOLOR_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 
HourMinuteSecond;
             
gettime(HourMinuteSecond);
             
format(string,sizeof(string),"[%02d:%02d:%02d]%s has banned %s! Reason: %s",Hour,Minute,Second,GetName(playerid),GetName(id),reason);
              
SendClientMessage(idCOLOR_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(playeridCOLOR_KRED"Player is not connected!");
    }
    else return 
SendPermissionError(playerid);

Here is My OnPlayerConnect
PHP код:
    if(fexist(UserPath(playerid)))
    {   new 
string[128];
        
format(stringsizeof(string)," Welcome Back %s To  Server",GetName(playerid));
        
SendClientMessage(playeridCOLOR_LIGHTGREENstring);
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_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(playeridCOLOR_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(playeridCOLOR_LIGHTGREEN"Welcome To Server");
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_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?
Reply
#2

Do you get any warnings when compiling?
Reply
#3

No Warning .no Error
Reply
#4

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;
    }
Reply
#5

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.
Reply
#6

Might be a problem while either parsing the data or saving data onplayerdisconnect.
Reply
#7

Those player who are not banned they also get banned when i ban some one in the server
Reply
#8

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?
Reply
#9

Did you try the code I gave you above ?
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)