26.04.2011, 20:18
Hi I have this code from here: https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
I want to make it so, if a player gets the RconAdminPassword wrong 5 times, he gets a ban.
I also want it to log it down, for example a .txt document called RconLoginAttempts and it will save ALL people who have tried logging into Rcon admin and it will save there username and exactly what they typed.
Here is the code so far from the wiki.
Thanks.
I want to make it so, if a player gets the RconAdminPassword wrong 5 times, he gets a ban.
I also want it to log it down, for example a .txt document called RconLoginAttempts and it will save ALL people who have tried logging into Rcon admin and it will save there username and exactly what they typed.
Here is the code so far from the wiki.
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(!success) //If the password was incorrect
{
printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
new pip[16];
for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
{
GetPlayerIp(i, pip, sizeof(pip));
if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
{
SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Send a message
Ban(i); //They are now banned.
}
}
}
return 1;
}