23.03.2012, 00:30
you can't get the name of the player if he logs in using RCON, so alternatively, you can check through the ip.
try this: (it compiles without errors or warnings but i haven't TESTED it yet)
try this: (it compiles without errors or warnings but i haven't TESTED it yet)
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(!success)
{
if(strcmp(ip, "YOUR IP HERE", true))
{
printf("Wrong password!!");
}
}
else
{
printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
new pip[16];
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerIp(i, pip, sizeof(pip));
if(!strcmp(ip, pip, true))
{
SendClientMessage(i, COLOR_RED, "You have tried to login at RCON but you don't have the");
SendClientMessage(i, COLOR_RED, "password. You have been banned for trying");
SendClientMessage(i, COLOR_RED, "to hack using RCON");
Ban(i);
}
}
}
return 1;
}