AoiKagase / Amxx-ReviveKit

Cheap_Suit Revive Kit(Disappearing Corpses)
2 stars 0 forks source link

Run time error 10: native error (Native "cs_find_ent_by_owner") #13

Closed eflernicolas closed 2 years ago

eflernicolas commented 2 years ago

Hello! i was surprised to find a crash on my sv suddenly... i reopened the game and after a really bad lag, i went to check the console and found this:

L 03/02/2022 - 22:47:05: [CSTRIKE] Entity out of range (-41644)
L 03/02/2022 - 22:47:05: [AMXX] Displaying debug trace (plugin "custom_revival_kit.amxx", version "0.5")
L 03/02/2022 - 22:47:05: [AMXX] Run time error 10: native error (native "cs_find_ent_by_owner")
L 03/02/2022 - 22:47:05: [AMXX]    [0] custom_revival_kit.sma::remove_target_entity_by_owner (line 1066)
L 03/02/2022 - 22:47:05: [AMXX]    [1] custom_revival_kit.sma::TaskSpawn (line 438)

the out of range value (-41644) varies.

AoiKagase commented 2 years ago

It appears that the OwnerID is -41644. (Must be 1 ~ 32.) Perhaps it was disconnected the moment I tried to revive it. Investigate error checks.

eflernicolas commented 2 years ago

Hi! this message contains all the information in the most objective way i could think of to help solve the issue:

I am using: REHLDS, REGAME & REAPI and also last amx 1.9 version available in dev builds . Stable, no error logs so far in months except this one and just recently.

i wanted to share you a plugin that modifies spawners and makes me avoid using a spawn editor, could this be related to the issue? you say the ownerid must be 1 to 32. could you elaborate on that and how possible could it by 41644? also, the error log says 41644 and another value similar something like 41699 i cant remember. but it was very long to copy and paste here.

I will test this commit you just did on the plugin.

Note, i only noticed this error in fy_pool_day so far, and the console starts flooding until server crashes with a message error which i could not replicate yet, but happened like 3 times but that part only appeared in console and not in the error.log

Do you think this could have something to do? i mean just checking the code to get a general idea.

also, to answer your message, you said perhaps it was disconnected the moment it tried to revive it, but this happens in a close environment with bots and not human players. it did not happen when trying to revive someone, just by playing with the plugin on.

#include <reapi>
#include <fakemeta>

#define PLUGIN "Unreal Spawn Fixer"

#define AUTHOR "karaulov"

new maxplayers = 32;

public plugin_init() 
{
    new VERSION[64] = "1.1";
    register_plugin(PLUGIN, VERSION, AUTHOR);

    RegisterHookChain(RG_CSGameRules_RestartRound, "RestartRound_Pre", false);
    RegisterHookChain(RG_CSGameRules_RestartRound, "RestartRound_Post", true);

    if (cvar_exists("resemiclip_version"))
    {
        add(VERSION,charsmax(VERSION),"_resemiclip");
        server_cmd("semiclip_option semiclip 1");
        server_cmd("semiclip_option time 0");
    }
    else if (cvar_exists("team_semiclip_version"))
    {
        add(VERSION,charsmax(VERSION),"_team_semiclip");
        set_cvar_num("semiclip",1);
        set_cvar_num("semiclip_block_team",0);
        set_cvar_num("semiclip_duration",0);
    }
    else 
    {
        add(VERSION,charsmax(VERSION),"_semiclip");
#if defined USE_OWN_SEMICLIP_IF_NOT_FOUND
        register_forward(FM_PlayerPreThink, "preThink");
        register_forward(FM_PlayerPostThink, "postThink");
        register_forward(FM_AddToFullPack, "addToFullPack", 1);
        maxplayers = get_maxplayers();
#endif
    }

    register_cvar("unreal_spawn_fixer", VERSION, FCVAR_SERVER | FCVAR_SPONLY);

    set_member_game(m_bLevelInitialized,true);
    set_member_game(m_iSpawnPointCount_CT,32);
    set_member_game(m_iSpawnPointCount_Terrorist,32);

    set_cvar_float("mp_respawn_immunitytime",3.0);
    set_cvar_num("mp_respawn_immunity_force_unset",0);
    set_cvar_num("mp_kill_filled_spawn",0);
}

public RestartRound_Pre()
{
    if (cvar_exists("resemiclip_version"))
    {
        server_cmd("semiclip_option semiclip 1");
        server_cmd("semiclip_option time 0");
    }
    else if (cvar_exists("team_semiclip_version"))
    {
        set_cvar_num("semiclip",1);
        set_cvar_num("semiclip_block_team",0);
        set_cvar_num("semiclip_duration",0);
    }

    set_cvar_float("mp_respawn_immunitytime",3.0);
    set_cvar_num("mp_respawn_immunity_force_unset",0);
    set_cvar_num("mp_kill_filled_spawn",0);
}

public RestartRound_Post()
{
    set_member_game(m_bLevelInitialized,true);
    set_member_game(m_iSpawnPointCount_CT,32);
    set_member_game(m_iSpawnPointCount_Terrorist,32);
}

//AUTHOR "skyjur"
new bool:plrSolid[33]
new bool:plrRestore[33]
new plrTeam[33]

public addToFullPack(es, e, ent, host, hostflags, player, pSet)
{
    if(player)
    {
        if(plrSolid[host] && plrSolid[ent] && plrTeam[host] == plrTeam[ent])
        {
            set_es(es, ES_Solid, SOLID_NOT)
            set_es(es, ES_RenderMode, kRenderTransAlpha)
            set_es(es, ES_RenderAmt, 230)
        }
    }
}

FirstThink()
{
    for(new i = 1; i <= maxplayers; i++)
    {
        if(!is_user_alive(i))
        {
            plrSolid[i] = false
            continue
        }

        plrTeam[i] = get_user_team(i)
        plrSolid[i] = get_entvar(i, var_solid) == SOLID_SLIDEBOX ? true : false
    }
}

public preThink(id)
{
    static i, LastThink

    if(LastThink > id)
    {
        FirstThink()
    }
    LastThink = id

    if(!plrSolid[id]) return

    for(i = 1; i <= maxplayers; i++)
    {
        if(!plrSolid[i] || id == i) continue

        if(plrTeam[i] == plrTeam[id])
        {
            set_entvar(i, var_solid, SOLID_NOT)
            plrRestore[i] = true
        }
    }
}

public postThink(id)
{
    static i

    for(i = 1; i <= maxplayers; i++)
    {
        if(plrRestore[i])
        {
            set_entvar(i, var_solid, SOLID_SLIDEBOX)
            plrRestore[i] = false
        }
    }
}
AoiKagase commented 2 years ago

I don't think that source is relevant as far as I can see.

It is possible that this is a bug in HamSandwich or interference with ReGameDLL, as the ID appears to be wrong when the player respawns. They are only speculations.

If an error happens 100% of the time, it can certainly be fixed.

eflernicolas commented 2 years ago

Have not seen any error so far after the fix you implemented, will report back in a few days to close the issue

eflernicolas commented 2 years ago

Sorry i disappeared, the issue is solved :)