PHP код:
/*
Copyright (c) 2015-2016, Untonyst
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#if defined _untonysts_k2bex_included_
#endinput
#endif
#define _untonysts_k2bex_included_
#define FIX_PARAMS 1 // Параметр вызова функции из инклуда
#define MAX_REASON_BANEX_TEXT 25; // Размер строки причины бана
#define TIME_CALL_FUNCTION 200; // Через сколько функция сработает
@__CallKickFunc(playerid);
@__CallKickFunc(playerid) {
Kick(playerid);
}
stock u_fix__Kick(playerid, fix=0) {
if (0 == IsPlayerConnected(playerid)) {
return 0;
}
if (fix == 1) {
SetTimerEx(!"@__CallKickFunc", TIME_CALL_FUNCTION, 0, "i", playerid);
return 1;
}
return Kick(playerid);
}
#if defined _ALS_Kick
#undef Kick
#else
#define _ALS_Kick
#endif
#define Kick u_fix__Kick
@__CallBanFunc(playerid);
@__CallBanFunc(playerid) {
Ban(playerid);
}
stock u_fix__Ban(playerid, const fix=0) {
if (0 == IsPlayerConnected(playerid)) {
return 0;
}
if (fix == 1) {
SetTimerEx(!"@__CallBanFunc", TIME_CALL_FUNCTION, 0, "i", playerid);
return 1;
}
return Ban(playerid);
}
#if defined _ALS_Ban
#undef Ban
#else
#define _ALS_Ban
#endif
#define Ban u_fix__Ban
@__CallBanExFunc(playerid);
@__CallBanExFunc(playerid) {
goto skip_array_init;
new reason[MAX_REASON_BANEX_TEXT];
skip_array_init:
GetPVarString(playerid, !"PLAYER_REASON_TEXT", reason, sizeof(reason));
DeletePVar(playerid, !"PLAYER_REASON_TEXT");
for (new i = 0; ((reason[i] &= 0xFF) != '\0') && (++i != sizeof(reason));) {}
BanEx(playerid, reason);
}
stock u_fix__BanEx(playerid, reason[], fix=0)
{
if (0 == IsPlayerConnected(playerid)) {
return 0;
}
if (fix == 1) {
SetPVarString(playerid, !"PLAYER_REASON_TEXT", reason);
SetTimerEx(!"@__CallBanExFunc", TIME_CALL_FUNCTION, 0, "i", playerid);
return 1;
}
return BanEx(playerid, reason);
}
#if defined _ALS_BanEx
#undef BanEx
#else
#define _ALS_BanEx
#endif
#define BanEx u_fix__BanEx