CMD:banip(playerid,params[])//doesn't work. But will work soon. I don't think so
{
if(PlayerAcc[playerid][Admin] < 2) return SendClientMessage(playerid,0xFFFFFFFF," "COL_ERROR"You cannot use this command");
new id;
new reason[256];
new ip[16];
new string[256];
if(sscanf(params,"us[256]",id,reason)) return SendClientMessage(playerid,0xFFFFFFFF," "COL_PARAM"/banip [playerid] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFFFFFFFF," "COL_ERROR"This player isn't online. Please specify a valid player.");
/*if(playerid == id) return SendClientMessage(playerid,0xFFFFFFFF," "COL_ERROR"You cannot ban yourself!");*/
if(PlayerAcc[id][Admin] > PlayerAcc[playerid][Admin]) SendClientMessage(playerid,0xFFFFFFFF," "COL_ERROR"You cannot ban any Administrator having a higher level than you.");
GetUserAdminLevel(playerid);
GetPlayerIp(id,ip,sizeof(ip));
SetTimerEx("BanIpTimer",100,false,"s",ip);
format(string,sizeof(string)," %s "COL_RULE"has banned "COL_PLAYER"%s"COL_RULE"'s ip for the "COL_NREASON"reason: %s",AdminLevel,GetUserName(id),reason);
SendClientMessageToAll(0xFFFFFFFF,string);
return 1;
}
forward BanIpTimer(ip);
public BanIpTimer(ip)
{
new banstring[256];
format(banstring,sizeof(banstring),"banip %s",ip);
SendRconCommand(banstring);
SendRconCommand("reloadbans");
}
format(string,sizeof(string)," %s "COL_RULE"has banned "COL_PLAYER"%s"COL_RULE"'s ip for the "COL_NREASON"reason: %s",AdminLevel,GetUserName(id),reason);
SendClientMessageToAll(0xFFFFFFFF,string);
Yes, that. The player is not getting banned. --> same meaning as /banip cmd not working
EDIT: @ rittik, the timer is needed. Otherwise the player will get banned without seeing the reason of the ban, I mean he can't see the client message. pawn Код:
|
forward BanIpTimer(ip);
public BanIpTimer(ip)
{
new banstring[256];
format(banstring,sizeof(banstring),"banip %s",ip);
SendRconCommand(banstring);
SendRconCommand("reloadbans");
}
forward BanIpTimer(ip);
public BanIpTimer(ip)
{
new banstring[256];
format(banstring,sizeof(banstring),"banip %s",ip);
SendRconCommand(banstring);
SendRconCommand("reloadbans");
Kick(playerid);
}
pawn Код:
|
Originally Posted by NacLChemistry
EDIT2: It can't work for you, cause there isn't a "playerid" in the header of the timer. Liar. I'll fix that by myself xD
|
Originally Posted by SA-MP Wiki
Format Syntax
Specifier Meaning i Integer. d Integer. a Array. The next parameter must be an integer ("i") with the array's size. [CURRENTLY UNUSABLE] s String. [CURRENTLY UNUSABLE] f Float. b Boolean (true/false). |
CMD:banip(playerid,params[])//doesn't work. But will work soon. I don't think so
{
if(PlayerAcc[playerid][Admin] < 2) return SendClientMessage(playerid, 0xFFFFFFFF, " "COL_ERROR"You cannot use this command");
new id, reason[30];
if(sscanf(params,"us[30]",id,reason)) return SendClientMessage(playerid, 0xFFFFFFFF, " "COL_PARAM"/banip [playerid] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFFFFFFFF, " "COL_ERROR"This player isn't online. Please specify a valid player.");
//if(playerid == id) return SendClientMessage(playerid, 0xFFFFFFFF, " "COL_ERROR"You cannot ban yourself!");
if(PlayerAcc[id][Admin] > PlayerAcc[playerid][Admin]) return SendClientMessage(playerid, 0xFFFFFFFF, " "COL_ERROR"You cannot ban any Administrator with a higher level than you.");
GetUserAdminLevel(playerid); //No idea what this does :l
GetPlayerIp(id, ip, sizeof(ip));
new string[128];
format(string, sizeof(string), "banip %s", ip);
SendRconCommand(string);
SendRconCommand("reloadbans");
format(string, sizeof(string), " %s "COL_RULE"has banned "COL_PLAYER"%s"COL_RULE"'s ip for the "COL_NREASON"reason: %s", AdminLevel, GetUserName(id), reason);
SendClientMessageToAll(0xFFFFFFFF,string);
return 1;
}
//blablabla...
GetUserAdminLevel(playerid);
GetPlayerIp(id,ip,sizeof(ip));
new banstring[256];
format(banstring,sizeof(banstring),"banip %s",ip);
SendRconCommand(banstring);
SendRconCommand("reloadbans");
SetTimerEx("BanIpTimer",100,false,"u",playerid);
format(string,sizeof(string)," %s "COL_RULE"has banned "COL_PLAYER"%s"COL_RULE"'s ip for the "COL_NREASON"reason: %s",AdminLevel,GetUserName(id),reason);
SendClientMessageToAll(0xFFFFFFFF,string);
return 1;
}
forward BanIpTimer(playerid,ip);
public BanIpTimer(playerid,ip)
{
Kick(playerid);
}