alliedmodders / amxmodx

AMX Mod X - Half-Life 1 Scripting and Administration
http://www.amxmodx.org/
478 stars 198 forks source link

Server Crash using query_client_cvar #1087

Open NiceFeatures opened 7 months ago

NiceFeatures commented 7 months ago

Help us help you

Environment

# Problematic Code (or Steps to Reproduce)
#include <amxmodx>
#include <amxmisc>
#include <reapi>

public plugin_init()
{
        register_plugin("Query cvar", "1.0", "GH")
}

public client_putinserver(id)
{
        set_task_ex(10.0, "CheckCvars", id, .flags = SetTask_Once)
}

public CheckCvars(id)
{
        if(is_user_connected(id))
        {
                query_client_cvar(id, "cl_minmodels", "OnClMinModels_CallBack")
        }
}

public OnClMinModels_CallBack(id, const Cvar[], const Value[])
{
        if (equal(Cvar, "cl_minmodels"))
                if(str_to_num(Value) != 0)
                        rh_drop_client(id, fmt("Please use cl_minmodels 0"))
}

If use this query the server crashes in few minutes.

Logs

https://hastebin.com/share/sadelayefu.vbnet

According to s1lentq callback does not check that player can be disconnected instantly.

https://github.com/theAsmodai/metamod-r/issues/67#issuecomment-1858777420

pizzahut2 commented 6 months ago
NiceFeatures commented 6 months ago
  • The Hastebin content is gone.

    • The "include" commands are missing the file names, maybe more is missing. Using code tags would avoid this issue. Mark the code and then click the Code icon '<>'.

Thanks for the answer, I edited my post so that everything works again, in terms of logs, the server just crashes, I have the .dmp file.