Teach me how to make ban with reason
#1

Код:
CMD:ban(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 2) {
		    new tmp[128], tmp2[128], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /ban [playerid] [reason]");
			if(isnull(tmp2)) return SendClientMessage(playerid, red, "ERROR: You must give a 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);
				CMDMessageToAdmins(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(grey,string);
				SaveToFile("BanLog",string);
				aresetpall(player1);
				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 BanEx(player1, string);
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Код:
public OnPlayerConnect(playerid)
{
	new PlayerName[128],string[128], file[256];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	new tmp3[50]; GetPlayerIp(playerid,tmp3,50);

    if (dUserINT(PlayerName2(playerid)).("banned") == 1)
    {
        SendClientMessage(playerid, red, "This name is banned from this server!");
        SendClientMessage(playerid, red, "If You Think,Its Mistake,Please Make Appeal Here , Http://wx-play.cf");
		format(string,sizeof(string),"%s ID:%d was auto kicked. Reason: Name banned from server",PlayerName,playerid);
		SendClientMessageToAll(grey, string);  print(string);
		SaveToFile("KickLog",string);  Kick(playerid);
    }
when i ban someone

/ban id reason

i want when he connect to server

it said,Your account has been banned by Administrator %s [ Reason ]

how ?
Reply


Messages In This Thread
Teach me how to make ban with reason - by KyNe - 26.12.2017, 06:00
Re: Teach me how to make ban with reason - by Ritzy2K - 26.12.2017, 06:28
Re: Teach me how to make ban with reason - by KyNe - 26.12.2017, 06:38
Re: Teach me how to make ban with reason - by Sew_Sumi - 26.12.2017, 07:14
Re: Teach me how to make ban with reason - by KyNe - 26.12.2017, 07:15
Re: Teach me how to make ban with reason - by DTV - 26.12.2017, 07:20
Re: Teach me how to make ban with reason - by KyNe - 26.12.2017, 07:25
Re: Teach me how to make ban with reason - by KyNe - 26.12.2017, 08:02
Re: Teach me how to make ban with reason - by Ritzy2K - 26.12.2017, 08:12
Re: Teach me how to make ban with reason - by KyNe - 26.12.2017, 08:23

Forum Jump:


Users browsing this thread: 1 Guest(s)