The kicked/banned player can't see the reason
#1

can any one make a timers for those cmds,when player get banned he didnt see the text and the dialog i need someone to make a time like first send the massege after that the dialog and after 2sec banned or kick the player.

ban cmd:
Код:
CMD:ban(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 2) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    new str[500];
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /Ban [playerid] [reason]");
			if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /Ban [playerid] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);
		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
				new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
				TogglePlayerControllable(player1,0);
				format(str,sizeof(string),"{FF0000}You Have  been banned by Administrator %s | Reason: %s|.\n{FF0000}if you think you are Not guilty apply in our forum\n{FF0000}forum url==>www.codghosts-samp.tk",adminname,params[2]);
				ShowPlayerDialog(player1, DIALOG_WELCOMEB, DIALOG_STYLE_MSGBOX, "{FF9E00}You Have Been Banned", str, "Close", "");
				CMDMessageToAdmins(playerid,"BAN");
				format(string,sizeof(string),"{3BB023}» Admin action « {ABFF85}Admin %s has banned %s  (Reason: %s).",adminname,playername,params[2]);
				SendClientMessageToAll(red,string);
				//format(string,sizeof(string),"[Reason: %s]",params[2]);
				//SendClientMessageToAll(red,string);
                SaveToFile("BanLog",string);
                for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
			    Bans[MAX_REPORTS-1] = string;
				print(string);
                if(udb_Exists(PlayerName2(player1)) && PlayerInfo[player1][LoggedIn] == 1) dUserSetINT(PlayerName2(player1)).("banned",1);
				format(string,sizeof(string),"banned by Administrator %s. Reason: %s", adminname, params[2] );
				return VBanID(playerid,player1,params[2]);
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
		} else return SendClientMessage(playerid,red,"» Error « {BABABA}You are not authorized to use this command.");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
and kick cmd:
Код:
CMD:kick(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
	    if(PlayerInfo[playerid][Level] >= 1 || PlayerInfo[playerid][Helper] == 1) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /kick [playerid] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
				CMDMessageToAdmins(playerid,"KICK");
				if(PlayerInfo[playerid][LoggedIn] == 1)
				{
				if(PlayerInfo[playerid][Level] >= 1)
				{
				if(isnull(tmp2)) {
					format(string,sizeof(string),"{3BB023}» Admin action « {ABFF85}Administrator%s has Kicked %s (no reason given)  ",adminname,playername,params[2]); SendClientMessageToAll(red,string);
					//format(string,sizeof(string),"[ No Reason Given ]",params[2]); SendClientMessageToAll(red,string);
					SaveToFile("KickLog",string); print(string); return Kick(player1);
				} else {
					format(string,sizeof(string),"{3BB023}» Admin action « {ABFF85}Administrator%s has Kicked %s ( Reason: %s )",adminname,playername,params[2],params[2]); SendClientMessageToAll(red,string);
					//format(string,sizeof(string),"[ Reason: %s ]",params[2]); SendClientMessageToAll(red,string);
					SaveToFile("KickLog",string); print(string); return Kick(player1); }
				}
			}
		    if(PlayerInfo[playerid][Helper] == 1)
				{
                  if(isnull(tmp2)) {
					format(string,sizeof(string),"%s has been kicked by Help operator %s [no reason given] ",playername,adminname); SendClientMessageToAll(red,string);
					SaveToFile("KickLog",string);
					print(string);
					return Kick(player1);
				} else {
					format(string,sizeof(string),"%s has been kicked by Help operator %s [reason: %s] ",playername,adminname,params[2]); SendClientMessageToAll(red,string);
					SaveToFile("KickLog",string);
					print(string);
					return Kick(player1); }
				}
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
		} else return SendClientMessage(playerid,red,"» Error « {BABABA}You are not authorized to use this command.");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
	return 1;
}
VBANID:
Код:
stock VBanID(playerid,giveid,reason[])
{
    format(NICKBAN,20,VBPlayer(giveid));
 if(playerid > -1)
 {

     GetPlayerIp(giveid, VIP, sizeof(VIP));
     format(Vnewban,32,BanDir,VIP);
  dini_Create(Vnewban);
  VBanSaveInfo(playerid,Vnewban,reason);
     format(Vnewban,32,BanDir,VBPlayer(giveid));
  dini_Create(Vnewban);
  VBanSaveInfo(playerid,Vnewban,reason);
 }
 else
 {
     format(Vnewban,32,BanDir,VBPlayer(giveid));
  dini_Create(Vnewban);
  VBanSaveInfo(-1,Vnewban,reason);
 }
 if(IsPlayerConnected(giveid))
  VBanLoadInfo(giveid,Vnewban);

 Kick(giveid);

    return 1;
}
how to make it possible to the player to see the MSGS?
Reply
#2

Hello!

You have to start a timer, and kick the player after 100-200 milliseconds.
So the message in the command and start a timer to kick the player after 100-200 milliseconds.

- Mencent
Reply
#3

Exactly as Mencent said, Like this
pawn Код:
//Somewhere in the script
forward KickPlayer(playerid);
public KickPlayer(playerid) return Kick(playerid);

//replace "Kick(playerid)" with this
SetTimerEx("KickPlayer",1000,false,"d", playerid);
Reply
#4

I know can any one make it for me
Reply
#5

I hate lazy people, do some effort !
pawn Код:
forward KickPlayer(playerid);
public KickPlayer(playerid) return Kick(playerid);

stock VBanID(playerid,giveid,reason[])
{
    format(NICKBAN,20,VBPlayer(giveid));
    if(playerid > -1)
    {
        GetPlayerIp(giveid, VIP, sizeof(VIP));
        format(Vnewban,32,BanDir,VIP);
        dini_Create(Vnewban);
        VBanSaveInfo(playerid,Vnewban,reason);
        format(Vnewban,32,BanDir,VBPlayer(giveid));
        dini_Create(Vnewban);
        VBanSaveInfo(playerid,Vnewban,reason);
    }
    else
    {
        format(Vnewban,32,BanDir,VBPlayer(giveid));
        dini_Create(Vnewban);
        VBanSaveInfo(-1,Vnewban,reason);
    }
    if(IsPlayerConnected(giveid)) VBanLoadInfo(giveid,Vnewban);

    SetTimerEx("KickPlayer",1000,false,"d", playerid);

    return 1;
}

CMD:kick(playerid,params[]) {
    if(PlayerInfo[playerid][LoggedIn] == 1) {
        if(PlayerInfo[playerid][Level] >= 1 || PlayerInfo[playerid][Helper] == 1) {
            new tmp[256], tmp2[256], Index;     tmp = strtok(params,Index), tmp2 = strtok(params,Index);
            if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /kick [playerid] [reason]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(tmp);

            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
                GetPlayerName(player1, playername, sizeof(playername));     GetPlayerName(playerid, adminname, sizeof(adminname));
                CMDMessageToAdmins(playerid,"KICK");
                if(PlayerInfo[playerid][LoggedIn] == 1)
                {
                if(PlayerInfo[playerid][Level] >= 1)
                {
                if(isnull(tmp2)) {
                    format(string,sizeof(string),"{3BB023}» Admin action « {ABFF85}Administrator%s has Kicked %s (no reason given)  ",adminname,playername,params[2]); SendClientMessageToAll(red,string);
                    //format(string,sizeof(string),"[ No Reason Given ]",params[2]); SendClientMessageToAll(red,string);
                    SaveToFile("KickLog",string); print(string); return Kick(player1);
                } else {
                    format(string,sizeof(string),"{3BB023}» Admin action « {ABFF85}Administrator%s has Kicked %s ( Reason: %s )",adminname,playername,params[2],params[2]); SendClientMessageToAll(red,string);
                    //format(string,sizeof(string),"[ Reason: %s ]",params[2]); SendClientMessageToAll(red,string);
                    SaveToFile("KickLog",string); print(string); return Kick(player1); }
                }
            }
            if(PlayerInfo[playerid][Helper] == 1)
                {
                  if(isnull(tmp2)) {
                    format(string,sizeof(string),"%s has been kicked by Help operator %s [no reason given] ",playername,adminname); SendClientMessageToAll(red,string);
                    SaveToFile("KickLog",string);
                    print(string);
                    SetTimerEx("KickPlayer",1000,false,"d", playerid);
                    return 1;
                } else {
                    format(string,sizeof(string),"%s has been kicked by Help operator %s [reason: %s] ",playername,adminname,params[2]); SendClientMessageToAll(red,string);
                    SaveToFile("KickLog",string);
                    print(string);
                    SetTimerEx("KickPlayer",1000,false,"d", playerid);
                    return 1; }
                }
            } else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
        } else return SendClientMessage(playerid,red,"» Error « {BABABA}You are not authorized to use this command.");
    } else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
    return 1;
}
Reply
#6

Thank you so much guys
Reply
#7

Example of a ban system with reason
pawn Код:
dcmd_ban(playerid,params[])
{
    if(AccInfo[playerid][LoggedIn] == 1)
    {
        if(AccInfo[playerid][Level] >= 4)
        {
            new Index;
            new tmp[256];  tmp  = strtok(params,Index);
            new tmp2[256]; tmp2 = strtok(params,Index);
           
            if(!strlen(params)) return
            SendClientMessage(playerid, LIGHTBLUE2, "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),"|- %s has been Banned by Administrator %s | Reason: %s [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,params[2],day,month,year,hour,minuite);
                SendClientMessageToAll(lightred,string);
                new str[128];
                format(str,sizeof(str),"%s has been Banned by Administrator %s | Reason: %s",playername,adminname,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,"ERROR: You must be logged in to use this commands");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)