Ban Message To Player Who Got Banned
#1

Help me please i want to give a ClientMessage To Those Players Who Banned Before ban he should get a message that he banned i tried it lots of times but still not fixed it so please help me here is the Command of the Ban

PHP код:
dcmd_ban(playerid,params[])
{
    if(
AccInfo[playerid][LoggedIn] == 1)
    {
        if(
AccInfo[playerid][Level] >= 5)
        {
            new 
Index;
            new 
tmp[256];  tmp  strtok(params,Index);
            new 
tmp2[256]; tmp2 strtok(params,Index);
            
            if(!
strlen(params)) return
            
SendClientMessage(playeridCOLOR_ADMIN"Usage: /ban [PlayerID] [Reason]") &&
            
SendClientMessage(playeridorange"Function: Will Ban the specified player");
            if(!
strlen(tmp2))
            return 
SendClientMessage(playeridred"ERROR: Reason unspecified!");
            new 
player1;
            new 
string[128];
            new 
playername[MAX_PLAYER_NAME];
             new 
adminname [MAX_PLAYER_NAME];
            
player1 strval(tmp);
             if(
IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (AccInfo[player1][Level] != ServerInfo[MaxAdminLevel]))
            {
                
GetPlayerName(player1playernamesizeof(playername));
                
GetPlayerName(playeridadminnamesizeof(adminname));
                new 
year,month,daygetdate(yearmonthday);
                new 
hour,minuite,secondgettime(hour,minuite,second);
                
SendCommandToAdmins(playerid,"Ban");
                
format(string,sizeof(string),"ADMIN BAN: %s: Has Been Banned From The Server .Reason: (%s) [Date: %d/%d/%d] [Time: %d:%d]",playername,params[2],day,month,year,hour,minuite);
                
SendClientMessageToAll(COLOR_ADMIN,string);
                new 
str[128];
                
format(str,sizeof(str),"ADMIN BAN: %s: Has Been Banned From The Server .Reason: (%s)",playername,params[2]);
                
SaveIn("BanLog",str);
                print(string);
                if(
udb_Exists(PlayerName2(player1)) && AccInfo[player1][LoggedIn] == 1)
                
dUserSetINT(PlayerName2(player1)).("Banned",1);
                
format(string,sizeof(string),"Banned By Administrator %s: Reason: (%s)",adminname,params[2]);
                return 
BanEx(player1string);
            }
            else return 
SendClientMessage(playeridred"ERRPR: Player is not connected or is yourself or is the highest level admin");
        }
        else return 
ErrorMessages(playerid1);
    }
    else return 
SendClientMessage(playerid,red,"Invalid Command! Use /cmds To See The General Commands.");

Reply
#2

That will probably fix.

pawn Код:
#define Ban(%0) SetTimer("banDelay", 100, 0, "i", %0)

banDelay(playerid); public banDelay(playerid) {
    #undef Ban
    Ban(playerid);
    #define Ban(%0) SetTimer("banDelay", 100, 0, "i", %0)
    return 1;
}
Reply
#3

can you attach this code in my given cmd please and please show that code clearly thanks
Reply
#4

The code goes on the top of the script. You can keep using the Ban function. There's no need to change anything in the command.
Reply
#5

please show me your code clearly where to put codes in which lines please
Reply
#6

pawn Код:
// top of the script
#define Ban(%0) SetTimer("banDelay", 100, 0, "i", %0)

banDelay(playerid); public banDelay(playerid) {
    #undef Ban
    Ban(playerid);
    #define Ban(%0) SetTimer("banDelay", 100, 0, "i", %0)
    return 1;
}



dcmd_ban(playerid,params[])
{
    if(AccInfo[playerid][LoggedIn] == 1)
    {
        if(AccInfo[playerid][Level] >= 5)
        {
            new Index;
            new tmp[256];  tmp  = strtok(params,Index);
            new tmp2[256]; tmp2 = strtok(params,Index);
             
            if(!strlen(params)) return
            SendClientMessage(playerid, COLOR_ADMIN, "Usage: /ban [PlayerID] [Reason]") &&
            SendClientMessage(playerid, orange, "Function: Will Ban the specified player");
            if(!strlen(tmp2))
            return SendClientMessage(playerid, red, "ERROR: Reason unspecified!");
            new player1;
            new string[128];
            new playername[MAX_PLAYER_NAME];
             new adminname [MAX_PLAYER_NAME];
            player1 = strval(tmp);

             if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (AccInfo[player1][Level] != ServerInfo[MaxAdminLevel]))
            {
                GetPlayerName(player1, playername, sizeof(playername));
                GetPlayerName(playerid, adminname, sizeof(adminname));
                new year,month,day; getdate(year, month, day);
                new hour,minuite,second; gettime(hour,minuite,second);
                SendCommandToAdmins(playerid,"Ban");
                format(string,sizeof(string),"ADMIN BAN: %s: Has Been Banned From The Server .Reason: (%s) [Date: %d/%d/%d] [Time: %d:%d]",playername,params[2],day,month,year,hour,minuite);
                SendClientMessageToAll(COLOR_ADMIN,string);
                new str[128];
                format(str,sizeof(str),"ADMIN BAN: %s: Has Been Banned From The Server .Reason: (%s)",playername,params[2]);
                SaveIn("BanLog",str);
                print(string);
                if(udb_Exists(PlayerName2(player1)) && AccInfo[player1][LoggedIn] == 1)
                dUserSetINT(PlayerName2(player1)).("Banned",1);
                format(string,sizeof(string),"Banned By Administrator %s: Reason: (%s)",adminname,params[2]);
                return BanEx(player1, string);
            }
            else return SendClientMessage(playerid, red, "ERRPR: Player is not connected or is yourself or is the highest level admin");
        }
        else return ErrorMessages(playerid, 1);
    }
    else return SendClientMessage(playerid,red,"Invalid Command! Use /cmds To See The General Commands.");
}
Reply
#7

this isnt working if you have another code then please give it to me and please explain clearly i am not understanding
Reply
#8

The "Ban" function is already defined; I don't know why you think that would work. Try renaming the function.
Reply
#9

Quote:
Originally Posted by MaxJohnson
Посмотреть сообщение
this isnt working if you have another code then please give it to me and please explain clearly i am not understanding
You are able to understand perfectly, you're just too lazy to script.
Reply
#10

Try increasing 100ms to 1000ms for the delay.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)