18.03.2014, 15:28
the code that I wrote will ban anyone who tries to log in into rcon (INGAME). It will automatically ban you, except, if your ingame name is the name you used where I wrote "EnterYourNameHere". So you can enter your ingame name at that and will be able to login into rcon. Anyone else can't.. What you can also do is this:
this will only ban the player, if he entered the correct player.
So short: This will automatically ban any player who does not have the name you enter in the "EnterYourNameHere" field.. Straight away, no warning, no question - just ban.
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success)
{
new playerid = -1, cip[20];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerIp(i, cip, sizeof(cip));
if(!strcmp(ip, cip, true))
{
playerid = i;
break;
}
}
}
if(playerid != -1)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(strcmp(name, "EnterYourNameHere", true) != 0)
{
Ban(playerid);
}
}
}
return 1;
}
So short: This will automatically ban any player who does not have the name you enter in the "EnterYourNameHere" field.. Straight away, no warning, no question - just ban.

