Sma derleme hatası sorunu.
Gönderilme zamanı: Çrş Eki 27, 2021 4:17 pm
Selamlar aşağıdaki derleme farklı bir cs 1.6 host serverinde panele yüklerken derleme tanımsız sembol hatası veriyor acaba sebebi nedir.
Kod: Tümünü seç
#include <amxmodx>
#include <amxmisc>
#if AMXX_VERSION_NUM < 190
#assert "This plugin requires AMXX 1.9"
#endif
#define MAX_KICK_STRING_LENGTH 60
enum (+= 100)
{
TASKWARN,
TASKCHECK
}
enum PlayerData
{
g_Ping,
g_Samples
}
enum Cvars
{
VarPing,
Float:VarCheck,
VarTest,
Float:VarDelay,
VarImmunity,
VarImmunityFlag[2],
VarNotify,
VarLog,
Float:VarWarn,
FlagImmunity
}
new ePlayerData[MAX_PLAYERS +1][PlayerData], pCvars[Cvars]
public plugin_init()
{
register_plugin("NewPingkicker", "1.5.1","OLO & iceeedR")
register_cvar("NewPingkicker", "1.5.1", FCVAR_SERVER | FCVAR_SPONLY |FCVAR_UNLOGGED)
register_dictionary("NewPingkicker.txt")
bind_pcvar_num(create_cvar("amx_hpk_immunity", "1", .description = "Admin have immunity?"), pCvars[VarImmunity])
bind_pcvar_string(create_cvar("amx_hpk_flag", "a", .description = "The admin immunity flag."), pCvars[VarImmunityFlag], charsmax(pCvars[VarImmunityFlag]))
bind_pcvar_num(create_cvar("amx_hpk_ping", "200", .description = "The maximum ping allowed before being kicked."), pCvars[VarPing])
bind_pcvar_num(create_cvar("amx_hpk_tests", "5", .description = "Amounts of tests to be performed before the kick.", .has_min = true, .min_val = 1.0), pCvars[VarTest])
bind_pcvar_float(create_cvar("amx_hpk_delay", "5.0", .description = "Initial delay to start testing."), pCvars[VarDelay])
bind_pcvar_float(create_cvar("amx_hpk_check", "3.0", .description = "Time in seconds between Checks."), pCvars[VarCheck])
bind_pcvar_num(create_cvar("amx_hpk_notify", "1", .description = "Type off notify [0 disable / 1 all / 2 only admins]"), pCvars[VarNotify])
bind_pcvar_num(create_cvar("amx_hpk_log", "1", .description = "Log kicked players name on 'log' folder?"), pCvars[VarLog])
bind_pcvar_float(create_cvar("amx_hpk_warn_seconds", "5.0", .description = "Time in seconds to display the plugin info."), pCvars[VarWarn])
AutoExecConfig(true, "NewPingkicker")
}
public plugin_cfg()
{
if(pCvars[VarImmunity])
pCvars[FlagImmunity] = read_flags(pCvars[VarImmunityFlag])
}
public client_disconnected(id)
{
remove_task(id + TASKCHECK)
remove_task(id + TASKWARN)
ePlayerData[id][g_Ping] = 0
ePlayerData[id][g_Samples] = 0
}
public client_putinserver(id)
{
// check if is a valid player.
if(!is_user_hltv(id) && !is_user_bot(id))
{
// Inform the player of basic information such as the maximum ping value accepted on the server.
set_task_ex(pCvars[VarWarn], "ShowWarn", id + TASKWARN, .flags = SetTask_Once)
// 0.5 second delay, so the core had time to set the admin flags.
set_task_ex(0.5, "InitializePluginChecks", id, .flags = SetTask_Once)
}
}
public ShowWarn(taskId)
{
// We don't check if the player is online as the task is removed on disconnect
new id = taskId - TASKWARN
client_print_color(id, print_team_default,"%L", id ,"HPK_WARNING_MESSAGE", pCvars[VarPing])
}
public InitializePluginChecks(id)
{
// Check if the player is still connected.
if(is_user_connected(id))
{
// Check if the player is authorized on server
if(is_user_authorized(id))
{
// If the immunity cvar is on and the player is immune, ignore him.
if(pCvars[VarImmunity] && get_user_flags(id) & pCvars[FlagImmunity])
return PLUGIN_HANDLED
//Reset the ID variables, so there is no risk of getting information from the player that used the id previously.
ePlayerData[id][g_Ping] = ePlayerData[id][g_Samples] = 0
// If the delay cvar is set to something above 0.0, perform checks with the delay value, if there is no delay, start immediately.
if(pCvars[VarDelay] != 0.0)
{
set_task_ex(pCvars[VarDelay], "ApplyDelayedPingCheck", id, .flags = SetTask_Once)
}
else
{
set_task_ex(pCvars[VarCheck], "CheckPing", id + TASKCHECK, .flags = SetTask_Repeat)
}
}
else
{
// If the player is not authorized yet, let's try again.
set_task_ex(0.5, "InitializePluginChecks", id, .flags = SetTask_Once)
}
}
// Make the compiler happy :)
return PLUGIN_HANDLED
}
public ApplyDelayedPingCheck(id)
{
// Check if the player is still connected.
if(is_user_connected(id))
// Start checks
set_task_ex(pCvars[VarCheck], "CheckPing", id + TASKCHECK, .flags = SetTask_Repeat)
}
KickPlayer(id)
{
// Check if the player is still connected, if not, do nothing
if(!is_user_connected(id))
return PLUGIN_HANDLED
// If log cvar is enabled, we create the log
if(pCvars[VarLog])
log_amx("%L", id, "HPK_KICK_MESSAGE", id, pCvars[VarPing])
// We format the kick message in the server's lang and send it in the kick message
new KickMessage[MAX_KICK_STRING_LENGTH]
formatex(KickMessage, charsmax(KickMessage), "%l", "HPK_KICK_MESSAGE2")
// kick player with reason.
server_cmd("kick #%d ^"%s^"", get_user_userid(id), KickMessage)
return PLUGIN_HANDLED
}
public CheckPing(taskId)
{
new id = taskId - TASKCHECK
// Check if the player is still connected, if not, do nothing
if(!is_user_connected(id))
return PLUGIN_HANDLED
// We create the variables and get the player's ping and loss
new Ping, Loss
get_user_ping(id, Ping, Loss)
// We save the ping in the player's global variable
ePlayerData[id][g_Ping] += Ping
// We increased by +1 the count of checks that were performed on that player
++ePlayerData[id][g_Samples]
// We check if the amount of player checks is greater than or equal to what is configured in cvar.
if(ePlayerData[id][g_Samples] >= pCvars[VarTest])
{
// We save the average's ping of client
new AveragePing = (ePlayerData[id][g_Ping] / ePlayerData[id][g_Samples])
// Whe check if the player's average ping is greater than what is configured, if so, we execute the kick.
if(AveragePing >= pCvars[VarPing])
{
switch(pCvars[VarNotify])
{
case 1: client_print_color(0, print_team_default,"%L", 0, "HPK_KICK_MESSAGE", id, pCvars[VarPing])
case 2:
{
new iPlayers[MAX_PLAYERS], iNum, iPlayer
get_players_ex(iPlayers, iNum, GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV)
for(new i = 0; i < iNum; i++)
{
iPlayer = iPlayers[i]
if(!is_user_admin(iPlayer))
continue
client_print_color(iPlayer, print_team_default,"%L", iPlayer, "HPK_KICK_MESSAGE", id, pCvars[VarPing])
}
}
}
KickPlayer(id)
}
}
return PLUGIN_HANDLED
}