29.04.2014, 11:22
Hi,
I am experiencing a weird problem. I'm trying to make an offline ban system (i.e. the person banned is offline). It is an account ban. The ban itself works fine but the problem starts when a person connects whilst they are banned. When I say 'banned', I mean with the banned enum value, they are not physically Ban(playerid)ned.
The first time a user connects after being offline banned, the kicking them off the server procedure works. However, the second time they try to connect, they get 'server closed connection' almost immediately after player connect. And if I restart the server, I believe it works normally for the first time again.
I've tried adding the kick off function on both OnPlayerSpawn and even something obscure - OnPlayerText. I think I even tried it on login. I've tried it both as a function and not as a function.
If it's of any help, I use the saving system Y_INI although I do not think it makes a difference here as the data is being saved and loaded correctly.
I am experiencing a weird problem. I'm trying to make an offline ban system (i.e. the person banned is offline). It is an account ban. The ban itself works fine but the problem starts when a person connects whilst they are banned. When I say 'banned', I mean with the banned enum value, they are not physically Ban(playerid)ned.
The first time a user connects after being offline banned, the kicking them off the server procedure works. However, the second time they try to connect, they get 'server closed connection' almost immediately after player connect. And if I restart the server, I believe it works normally for the first time again.
I've tried adding the kick off function on both OnPlayerSpawn and even something obscure - OnPlayerText. I think I even tried it on login. I've tried it both as a function and not as a function.
pawn Код:
if(PlayerInfo[playerid][pAccountBanned] == 1)
{
new kickstring[124];
format(kickstring,sizeof(kickstring),"[Admin] Server kicked %s(%d). Reason: Account is banned.",GetName(playerid),playerid);
SendClientMessageToAll(COLOR_TOMATO,kickstring);
SetTimerEx("AccountBanned", 1000, 1, "i", playerid);
}
pawn Код:
forward AccountBanned(playerid);
public AccountBanned(playerid)
{
Kick(playerid);
}