[Tutorial] Making a working Anti - Jetpack system
#5

I spotted a bug.
You don't kill the timer when the player normally disconnects (OnPlayerDisconnect) by exiting the game, your timer keeps on running for that disconnected player.
If another player connects with the same playerid, there are 2 timers running for that player.
After some time, you've got hundreds of timers running on all players.

It's better to move the KillTimer statement to OnPlayerDisconnect, as that callback also gets called when you ban a player.

Why shouldn't you use OnPlayerUpdate?
That callback only runs for the connected players, so if he's kicked/banned or just leaves, that callback won't be called until the next player connects on that playerid.
No need to create timers and the possible mistake of NOT killing the timer when he disconnects.

Taken from the SAMP wiki:
"This callback is called everytime a client/player updates the server with their status."

A player cannot send updates to the server if he's disconnected, so your server won't get spammed with multiple messages or whatever you do if the jetpack is detected.

For such a simple thing, you could still use OnPlayerUpdate.
Reply


Messages In This Thread
Making a working Anti - Jetpack system - by FunnyBear - 10.12.2014, 17:37
Re: Making a working Anti - Jetpack system - by JeaSon - 11.12.2014, 05:51
Re: Making a working Anti - Jetpack system - by Nutcracker - 11.12.2014, 06:02
AW: Making a working Anti - Jetpack system - by Flori - 11.12.2014, 06:04
Re: Making a working Anti - Jetpack system - by PowerPC603 - 11.12.2014, 07:09
Re: Making a working Anti - Jetpack system - by Kyance - 11.12.2014, 14:57

Forum Jump:


Users browsing this thread: 1 Guest(s)