Inconsistently enforcing banned account (Y_INI)
#1

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.

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);
}
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.
Reply
#2

You have set repeating enabled in settimerex. This means it will continue to run until you stop server.
Reply
#3

You've unnecessarily set the timer to loop.
Edit: ^ what he said.
Reply
#4

Thank you.
Reply
#5

change SetTimerEx to CallLocalFunction
Reply
#6

Quote:
Originally Posted by iFarbod
Посмотреть сообщение
change SetTimerEx to CallLocalFunction
As you can see above, it's fixed.
Thanks but no thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)