Ban and Rban
#1

Pls help with my ban and rban cmd. In game I have ban myself with these cmd. But after banning myself i can enter in the game with a different name. These cmds are not banning the ip pls help here are my codes
Код:
CMD:ban(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 2)
		{
			new Index;
		    new tmp[256];  tmp  = strtok(params,Index);
			new tmp2[256]; tmp2 = strtok(params,Index);

		    if(!strlen(params)) return
			SendClientMessage(playerid, red, "Usage: /ban [PlayerID] [Reason]");
			if(!strlen(tmp2))
			return SendClientMessage(playerid, red, "ERROR: You must give a reason");
			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 && (PlayerInfo[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);
			    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(red,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)) && 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, "ERRPR: 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");
}
CMD:rban(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 4) {
		    new ip[128], Index;
			new tmp[256];  tmp = strtok(params,Index);
			new tmp2[256]; tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /rban [playerid] [reason]");
			if(!strlen(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,"RBAN");
				format(string,sizeof(string),"%s has been range banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,params[2],day,month,year,hour,minuite);
				SendClientMessageToAll(COLOR_RED,string);
				SaveToFile("BanLog",string);
				print(string);
				if(udb_Exists(PlayerName2(player1)) && PlayerInfo[player1][LoggedIn] == 1)
				dUserSetINT(PlayerName2(player1)).("banned",1);
				GetPlayerIp(player1,ip,sizeof(ip));
	            strdel(ip,strlen(ip)-2,strlen(ip));
    	        format(ip,sizeof(ip),"%s**",ip);
				format(ip,sizeof(ip),"banip %s",ip);
            	SendRconCommand(ip);
            	Ban(player1);
				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: 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");
}
Reply


Messages In This Thread
Ban and Rban - by Iron3man - 12.08.2013, 14:25
Re: Ban and Rban - by dEcooR - 12.08.2013, 15:28

Forum Jump:


Users browsing this thread: 1 Guest(s)