06.09.2014, 16:07
(
Последний раз редактировалось fall3n; 19.10.2014 в 05:11.
)
DelayKickBan
With additional checks over send/receive of player data
(Previously known as : KickBanFix)
Since 0.3x release, functions - Kick, Ban or BanEx functions are called quickly when processed. So any functions which would get or set player's data will fail as it would lose the connection. There had been some fix for this by delaying the Kick/Ban function and I've also been using it before. But then I realized that it's not completely efficient because in case if a player is spamming and an auto-kick is kept, the server would still receive data until the player's connection is actually lost. This is a bad practice and would create a mess if the scripter hasn't denied the data of the player after kick/ban is processed.With additional checks over send/receive of player data
(Previously known as : KickBanFix)
Example : Anti-spam on chat -
You've created an anti-spam on your server which would check if the player is chat spamming. Usually, it used to kick player with a message if spamming. But if the spam is too fast and if you're delaying the kick, even after the spam counts the server will receive some more player spam messages.
Код:
fall3n : spam test fall3n : spam test fall3n : spam test (Example anti-spam kicking fall3n for spamming) fall3n : spam test fall3n : spam test fall3n : spam test fall3n : spam test ** fall3n has left the server (Kicked/Banned)
Also, this include allows you to replace the default Kick, Ban and BanEx functions to be working as delayed functions. So that you don't have to use "DelayKick" to delay, "Kick" would automatically delay. The same goes for "Ban", and "BanEx". To use this, define HOOK_DEFAULT_KICKBAN before including this script.
How would the anti-spam look if using DelayKickBan include:
Код:
fall3n : spam test fall3n : spam test fall3n : spam test (Example anti-spam kicking fall3n for spamming) ** fall3n has left the server (Kicked/Banned)
Natives
pawn Код:
#if defined HOOK_DEFAULT_KICKBAN
//It will then get the default natives to work accordingly
native Kick(playerid, delay_ms=150);
native Ban(playerid, delay_ms=150);
native BanEx(playerid, const reason[], delay_ms=150);
//"delay_ms" is an optional parameter, which means even if you use Kick(playerid); there's no problem, it will kick the player after 150ms.
//If you're using Kick(playerid, 1000); It would kick player only after 1000 ms (1 second).
//The same applies for Ban and BanEx.
#else
//If not defined the HOOK_DEFAULT_KICKBAN
native DelayKick(playerid, delay_ms=150);
native DelayBan(playerid, delay_ms=150);
native DelayBanEx(playerid, const reason[], delay_ms=150);
#endif
native IsKickBanProcessed(playerid); //Returns : 1 if kick/ban is processed on player, 0 if not.
//This native can be used to ignore anything on your script for the player in case if it's called.
https://sampforum.blast.hk/showthread.php?tid=540505
This is a simple include, yes but the documentation contains some various methods in determining the delay_ms to be used and also to block callbacks to prevent them from executing player functions when kick/ban is processed.
Changelog
v1.1-3
• Fixed : Unable to use commands while this include is in use issue.v1.1-2
• Fixed : An issue caused on timer calls.Download
If there's any issue, please let me know about that.
https://github.com/falle3n/DelayKickBan/releases
Latest release : https://github.com/falle3n/DelayKick...ses/tag/v1.1-3