29.10.2018, 06:58
(
Last edited by TheToretto; 29/10/2018 at 07:01 AM.
Reason: Ban(playerid) to Ban(i)
)
Quote:
Use array with warnings, if player writes /rcon login less than 3 times send him msg with info about warning x/3 or kick/BlockIpAdress
|
PHP Code:
public OnRconLoginAttempt(ip[], password[], success)
{
if(!success)
{
new IPAddr[16], str[64];
static r_Warnings[MAX_PLAYERS];
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerIp(i, IPAddr, sizeof(IPAddr));
if(!strcmp(ip, IPAddr, false))
{
if(r_Warnings[i] < 2)
{
r_Warnings[i]++;
format(str, sizeof(str), "Warnings: (%i / 3)", r_Warnings[i]);
return SendClientMessage(i, -1, str);
}
else
{
Ban/*Ex*/(i); // Delay the ban with a timer so the playerid receives the message before getting banned
return SendClientMessage(i, -1, "You've been warned.");
}
}
}
}
return 1;
}