Name Unban Scripting help
#1

Код:
CMD:nameunban(playerid,params[])
{
if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "You Cant Use This Command !!!");
if(IsPlayerAdmin(playerid))
{
		new tmp[256], Index;        tmp = strtok(params,Index);
		if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /nameunban [name]");
		new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
		unbanname = tmp;
		if(udb_Exists(unbanname))
		{
			dUserSetINT(unbanname).("Banned", 0);
			GetPlayerName(playerid, adminname, sizeof(adminname));
			CMDMessageToAdmins(playerid,"NAMEUNBAN");
			SaveToFile("UnBanNameLog",string);
            SendRconCommand("reloadbans");
			print(string);
			return 1;
    	}
	    else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
	}
    else return SendClientMessage(playerid,red,"ERROR: You Need To Be A High Level Admin To Use This Command");
}
this CMD need login /rcon login password
, i want use this ,if(PlayerInfo[playerid][Level] < 2) this only,how
i dont want use rcon to unban player,i just want level 2+ can unban player,how?
Reply
#2

Код:
CMD:nameunban(playerid,params[])
{
if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "You Cant Use This Command !!!");
	new tmp[256], Index;        tmp = strtok(params,Index);
	if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /nameunban [name]");
	new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
	unbanname = tmp;
	if(udb_Exists(unbanname))
	{
		dUserSetINT(unbanname).("Banned", 0);
		GetPlayerName(playerid, adminname, sizeof(adminname));
		CMDMessageToAdmins(playerid,"NAMEUNBAN");
		SaveToFile("UnBanNameLog",string);
        SendRconCommand("reloadbans");
		print(string);
		return 1;
   	}
    else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
}
Reply
#3

Код:
C:\Users\aiman\Desktop\Server\ADADA\LTFDM.pwn(19421) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#4

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
Код:
CMD:nameunban(playerid,params[])
{
if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "You Cant Use This Command !!!");
	new tmp[256], Index;        tmp = strtok(params,Index);
	if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /nameunban [name]");
	new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
	unbanname = tmp;
	if(udb_Exists(unbanname))
	{
		dUserSetINT(unbanname).("Banned", 0);
		GetPlayerName(playerid, adminname, sizeof(adminname));
		CMDMessageToAdmins(playerid,"NAMEUNBAN");
		SaveToFile("UnBanNameLog",string);
        SendRconCommand("reloadbans");
		print(string);
		return 1;
   	}
    else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
}
it work,but i got Loose identition

Код:
	new tmp[256], Index;        tmp = strtok(params,Index);
here is the loost identition
Reply
#5

Код:
CMD:nameunban(playerid, params[])
{
	if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "You Cant Use This Command !!!");
	
		new tmp[256], Index;
		tmp = strtok(params,Index);
		
		if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /nameunban [name]");
		new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
		unbanname = tmp;
		
		if(udb_Exists(unbanname))
		{
			dUserSetINT(unbanname).("Banned", 0);
			GetPlayerName(playerid, adminname, sizeof(adminname));
			CMDMessageToAdmins(playerid,"NAMEUNBAN");
			SaveToFile("UnBanNameLog",string);
            SendRconCommand("reloadbans");
			print(string);
			return 1;
    	}
	    else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
    
}
Tip: Use dini2 by Gammix, and use sscanf by ****** for params or use isnull
Reply
#6

Quote:
Originally Posted by Ritzy
Посмотреть сообщение
Код:
CMD:nameunban(playerid, params[])
{
	if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "You Cant Use This Command !!!");
	
		new tmp[256], Index;
		tmp = strtok(params,Index);
		
		if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /nameunban [name]");
		new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
		unbanname = tmp;
		
		if(udb_Exists(unbanname))
		{
			dUserSetINT(unbanname).("Banned", 0);
			GetPlayerName(playerid, adminname, sizeof(adminname));
			CMDMessageToAdmins(playerid,"NAMEUNBAN");
			SaveToFile("UnBanNameLog",string);
            SendRconCommand("reloadbans");
			print(string);
			return 1;
    	}
	    else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
    
}
Tip: Use dini2 by Gammix, and use sscanf by ****** for params or use isnull
Код:
CMD:unban(playerid,params[])
{
if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "ERROR: You are not a high enough level to use this command");
new tmp[256], Index;        tmp = strtok(params,Index);
if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unban [name]");
new adminname[MAX_PLAYER_NAME], string[128], unbanname[256];
unbanname = tmp;
if(udb_Exists(unbanname))
	{
		dUserSetINT(unbanname).("Banned", 0);
		GetPlayerName(playerid, adminname, sizeof(adminname));
		CMDMessageToAdmins(playerid,"UNBAN");
		SaveToFile("UnBanNameLog",string);
        SendRconCommand("reloadbans");
		print(string);
		return 1;
   	}
    else return SendClientMessage(playerid, red, "ERROR: No player with this name.");
}
it done,i did it,thanks tu Turbo

can anyone help me for this

i did /nameunban and /offline ban

now,i need this

Код:
CMD:unbanip(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid,red, "You Cant Use This Command !!!");
if(IsPlayerAdmin(playerid))
{
    new integ;if(sscanf(params,"u", integ)) return SendClientMessage(playerid, red, "Usage: /unban [IP: ADDRESS]");
    if(integ >=32) return SendClientMessage(playerid, red, "IP ADDRESS IS TOO LONG");
	new UnBanIp[80],IpAdd[128];format(UnBanIp,sizeof(UnBanIp),"unbanip %s",integ);
	SendRconCommand(UnBanIp);
	format(IpAdd,sizeof(IpAdd),"You Have Unbanned IP: %d",integ);
	SendClientMessage(playerid,red,IpAdd);
}
return 1;
}
how to remove Rcon ,i dont want /rcon login password,i just wanna make lvl 2 + can ban player
Reply
#7

Код:
CMD:unbanip(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid,red, "You Cant Use This Command !!!");
{
    new integ;if(sscanf(params,"u", integ)) return SendClientMessage(playerid, red, "Usage: /unban [IP: ADDRESS]");
    if(integ >=32) return SendClientMessage(playerid, red, "IP ADDRESS IS TOO LONG");
	new UnBanIp[80],IpAdd[128];format(UnBanIp,sizeof(UnBanIp),"unbanip %s",integ);
	SendRconCommand(UnBanIp);
	format(IpAdd,sizeof(IpAdd),"You Have Unbanned IP: %d",integ);
	SendClientMessage(playerid,red,IpAdd);
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)