29.05.2014, 08:25
(
Последний раз редактировалось NaClchemistryK; 29.05.2014 в 08:27.
Причина: misspelled timer :O
)
Yoyo guys, this time salt is here with his own problems.
I've created this /banip command ages ago and tested it. It didn't work, and I just left it like that cause I didn't need it. But not I need this, so I've come here.
I am sending simple rcon commands for now, so y_ini stuff doesn't matter.
Client Messages are sent, and timer is being called.
I'd appreciate any useful help.
I've created this /banip command ages ago and tested it. It didn't work, and I just left it like that cause I didn't need it. But not I need this, so I've come here.
pawn Код:
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");
}
Client Messages are sent, and timer is being called.
I'd appreciate any useful help.