29.10.2018, 10:19
Quote:
I doubt you actually test and revise your code before publishing it.
|
PHP Code:
public OnPlayerText(playerid, text[])
{
if(strfind(text, "rcon", true) != -1)
{
SendClientMessage(playerid, -1, "Bad idea.");
// Ban him if you want to :)
return 0;
}
return 1;
}
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
{
Kick/*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;
}