Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Mötley on Oct 25, 2016, 04:08 PM

Title: Announce banned message [Issue]
Post by: Mötley on Oct 25, 2016, 04:08 PM
I have tried recreating a ban I used in a LU server, But it seems the Announce does not call quick enough I guess


Announce("~r~Banned", plr, 6);
Any assistance is appreciated

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FZdXnwd0.jpg&hash=a38edf95d92e5be445acc808299ad9c3b66096f2)

Title: Re: Announce banned message [Issue]
Post by: . on Oct 25, 2016, 04:40 PM
Probably the ban packet has a higher priority than the announce packet. I suppose a self destructing timer that is called once to kick the player would do the trick. I think there's already a topic about this here somewhere. Basically, you send the Announce() message and then create a timer that calls a kick function and you just send the player id.

First you send the announcement:
Announce(whatever);
Then you create a delayed timer to ban that player:
NewTimer("BanPlayerID", 1000, 1, player.ID);
function BanPlayerID(id)
{
    local player = FindPlayer(id);
    if (player != null)
    {
        player.Ban();
    }
}

Of course, this is just a dumb approach because if the player disconnects before the ban takes place and/or someone else connects with that ID then you essentially ban someone else or no one at all.

So you have to think ahead of time and find measures to counteract these things. It's just a suggestion and an acknowledgement that this indeed is something that is supposed to happen.
Title: Re: Announce banned message [Issue]
Post by: Mötley on Oct 25, 2016, 06:42 PM
Thank you!

Since this is a time issue obviously. I will create a welcome message that will change when joining the server depending on if banned or not "welcome" or "banned"

Instead of calling it before the kick. This might add enough time.