AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Run time error 1 (https://forums.alliedmods.net/showthread.php?t=337728)

Natsheh 05-11-2022 00:25

Run time error 1
 
Code:

L 05/10/2022 - 18:46:03: Start of error session.
L 05/10/2022 - 18:46:03: Info (map "jb_oasis") (file "addons/amxmodx/logs/error_20220510.log")
L 05/10/2022 - 18:46:03: [AMXX] Plugin ("jb_parachute.amxx") is setting itself as failed.
L 05/10/2022 - 18:46:03: [AMXX] Plugin says:  jb_oasis
L 05/10/2022 - 18:46:03: [AMXX] Run time error 1 (plugin "jb_parachute.amxx") - forced exit

PHP Code:


#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <cstrike>
#include <fun>
#include <jailbreak_core>

#if AMXX_VERSION_NUM > 182
#define client_disconnect client_disconnected
#endif

new bool:g_has_parachute[33], g_IsUserAlive;
new 
g_para_ent[33];
new 
g_pDetachg_pFallSpeedg_p_shopitem_para;

#define PARACHUTE_LEVEL ADMIN_LEVEL_A

public plugin_init()
{
    
register_plugin("[JB] Parachute""1.0""Natsheh");
    
g_pFallSpeed register_cvar("parachute_fallspeed""100");
    
g_pDetach register_cvar("parachute_detach""1");

    
register_concmd("amx_parachute""admin_give_parachute"PARACHUTE_LEVEL"<nick, #userid or @team>" );

    
register_event("DeathMsg""death_event""a");
    
RegisterHam(Ham_Spawn"player""newSpawn"true);

    
g_p_shopitem_para register_jailbreak_shopitem("Parachute""Smoothes the landing"5000TEAM_ANY);
}

public 
jb_shop_item_preselect(iditemid)
{
    if(
g_p_shopitem_para == itemid)
    {
        if(
g_has_parachuteid ]) return JB_MENU_ITEM_UNAVAILABLE;
    }

    return 
JB_IGNORED;
}

public 
jb_shop_item_bought(iditemid)
{
    if(
g_p_shopitem_para == itemid)
    {
        
g_has_parachuteid ] = true;
    }
}

public 
plugin_precache()
{
    
precache_model("models/parachute.mdl");
}

public 
client_connect(id)
{
    
parachute_reset(id)
}

public 
client_disconnect(id)
{
    
parachute_reset(id)
}

public 
death_event()
{
    const 
VICTIM_ARGUMENT 2;
    new 
iVictim read_dataVICTIM_ARGUMENT );
    
remove_flag(g_IsUserAlive,iVictim);
    
parachute_resetiVictim );
}

parachute_reset(id)
{
    new 
parachute g_para_ent[id];

    if(
parachute 0)
    {
        
entity_set_int(parachuteEV_INT_flagsFL_KILLME);
        
call_think(parachute);
    }

    
g_has_parachute[id] = false;
    
g_para_ent[id] = 0;
}

public 
newSpawn(id)
{
    if(!
is_user_alive(id)) return;

    
set_flag(g_IsUserAlive,id);

    new 
parachute g_para_ent[id];

    if(
parachute 0)
    {
        
entity_set_int(parachuteEV_INT_flagsFL_KILLME);
        
call_think(parachute);
        
g_para_ent[id] = 0;
    }

    if ( 
access(idPARACHUTE_LEVEL) )
    {
        
g_has_parachute[id] = true;
    }
}

public 
admin_give_parachute(idlevelcid) {

    if(!
cmd_access(id,level,cid,2)) return PLUGIN_HANDLED

    
new arg[32], name[32], authid[35];
    
read_argv(1,arg,31);
    
get_user_name(id,name,31);
    
get_user_authid(id,authid,34);

    if (
arg[0]=='@')
    {
        new 
players[32], inum;
        switch ( 
arg[1] )
        {
            case 
'T'get_players(playersinum"he""TERRORIST");
            case 
'C'get_players(playersinum"he""CT");
            default :    
get_players(playersinum"h");
        }

        if (
inum == 0) {
            
console_print(id,"No clients in such team");
            return 
PLUGIN_HANDLED;
        }

        for(new 
0inuma++)
        {
            
g_has_parachuteplayers[a] ] = true;
        }

        switch(
get_cvar_num("amx_show_activity")) {
            case 
2:    client_print(0,print_chat,"ADMIN %s: gave a parachute to ^"%s^" players",name,arg[1])
            case 
1:    client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^" players",arg[1])
        }

        
console_print(id,"[AMXX] You gave a parachute to ^"%s^" players",arg[1])
        
log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%s^""name,get_user_userid(id),authid,arg[1])
    }
    else
    {
        new 
player cmd_target(idargCMDTARGET_ALLOW_SELF)
        if (!
player) return PLUGIN_HANDLED;

        
g_has_parachute[player] = true;

        new 
authid2[35], name2[32];
        
get_user_name(player,name2,31);
        
get_user_authid(player,authid2,34);

        switch(
get_cvar_num("amx_show_activity")) {
            case 
2:    client_print(0,print_chat,"ADMIN %s: gave a parachute to ^"%s^"",name,name2)
            case 
1:    client_print(0,print_chat,"ADMIN: gave a parachute to ^"%s^"",name2)
        }

        
console_print(id,"[AMXX] You gave a parachute to ^"%s^""name2)
        
log_amx("^"%s<%d><%s><>^" gave a parachute to ^"%s<%d><%s><>^""name,get_user_userid(id),authid,name2,get_user_userid(player),authid2)
    }
    return 
PLUGIN_HANDLED
}

public 
client_PreThink(id)
{
    
//parachute.mdl animation information
    //0 - deploy - 84 frames
    //1 - idle - 39 frames
    //2 - detach - 29 frames

    
if (!check_flag(g_IsUserAlive,id) || !g_has_parachute[id]) return;

    static 
buttonoldbuttonflagsFloat:fFrame 0.0;
    
button get_user_button(id);
    
oldbutton get_user_oldbutton(id);
    
flags get_entity_flags(id);

    static 
para_ent 0;
    
para_ent g_para_ent[id];

    if (
para_ent && (flags FL_ONGROUND)) {

        static 
bDetach 0bDetach = !bDetach get_pcvar_num(g_pDetach):bDetach;
        if (
bDetach)
        {

            if (
entity_get_int(para_ent,EV_INT_sequence) != 2) {
                
entity_set_int(para_entEV_INT_sequence2);
                
entity_set_int(para_entEV_INT_gaitsequence1);
                
entity_set_float(para_entEV_FL_frame0.0);
                
entity_set_float(para_entEV_FL_fuser10.0);
                
entity_set_float(para_entEV_FL_animtime0.0);
                
entity_set_float(para_entEV_FL_framerate0.0);
                return
            }

            
fFrame entity_get_float(para_ent,EV_FL_fuser1) + 2.0;
            
entity_set_float(para_ent,EV_FL_fuser1,fFrame);
            
entity_set_float(para_ent,EV_FL_frame,fFrame);

            if (
fFrame 254.0)
            {
                
entity_set_int(para_entEV_INT_flagsFL_KILLME);
                
call_think(para_ent);
                
g_para_ent[id] = 0;
            }
        }
        else
        {
            
entity_set_int(para_entEV_INT_flagsFL_KILLME);
            
call_think(para_ent);
            
g_para_ent[id] = 0;
        }

        return
    }

    if (
button IN_USE)
    {
        static 
Float:fFallspeed 0.0Float:velocity[3]; fFallspeed = (fFallspeed == 0.0) ? ( -get_pcvar_float(g_pFallSpeed) ) : fFallspeed;
        
entity_get_vector(idEV_VEC_velocityvelocity)

        if (
velocity[2] < 0.0) {

            if(
para_ent <= 0) {
                
para_ent create_entity("info_target")
                if(
para_ent 0)
                {
                    
g_para_ent[id] = para_ent;
                    
entity_set_string(para_ent,EV_SZ_classname,"parachute");
                    
entity_set_edict(para_entEV_ENT_aimentid);
                    
entity_set_edict(para_entEV_ENT_ownerid);
                    
entity_set_int(para_entEV_INT_movetypeMOVETYPE_FOLLOW);
                    
entity_set_model(para_ent"models/parachute.mdl");
                    
entity_set_int(para_entEV_INT_sequence0);
                    
entity_set_int(para_entEV_INT_gaitsequence1);
                    
entity_set_float(para_entEV_FL_frame0.0);
                    
entity_set_float(para_entEV_FL_fuser10.0);
                }
            }

            if (
para_ent 0) {

                
entity_set_int(idEV_INT_sequence3)
                
entity_set_int(idEV_INT_gaitsequence1)
                
entity_set_float(idEV_FL_frame1.0)
                
entity_set_float(idEV_FL_framerate1.0)

                
velocity[2] = (velocity[2] + 40.0 fFallspeed) ? velocity[2] + 40.0 fFallspeed
                entity_set_vector
(idEV_VEC_velocityvelocity)

                if (
entity_get_int(para_ent,EV_INT_sequence) == 0) {

                    
fFrame entity_get_float(para_ent,EV_FL_fuser1) + 1.0
                    entity_set_float
(para_ent,EV_FL_fuser1,fFrame)
                    
entity_set_float(para_ent,EV_FL_frame,fFrame)

                    if (
fFrame 100.0) {
                        
entity_set_float(para_entEV_FL_animtime0.0)
                        
entity_set_float(para_entEV_FL_framerate0.4)
                        
entity_set_int(para_entEV_INT_sequence1)
                        
entity_set_int(para_entEV_INT_gaitsequence1)
                        
entity_set_float(para_entEV_FL_frame0.0)
                        
entity_set_float(para_entEV_FL_fuser10.0)
                    }
                }
            }
        }
        else if (
para_ent 0) {
            
entity_set_int(para_entEV_INT_flagsFL_KILLME);
            
call_think(para_ent);
            
g_para_ent[id] = 0;
        }
    }
    else if ((
oldbutton IN_USE) && para_ent ) {
        
entity_set_int(para_entEV_INT_flagsFL_KILLME);
        
call_think(para_ent);
        
g_para_ent[id] = 0
    
}



Craxor 05-11-2022 01:00

Re: Run time error 1
 
It happens only Jb oasis or on more maps? also do you have any set_fail_state() on your jb core ?

does your Jb core uses MySql? Some force exit when the connection can't be done but that may be not the cause i suppose .

Natsheh 05-11-2022 05:41

Re: Run time error 1
 
It seems the jailbreak mod has nothing to do with the problem, ill investigate more and come with a feedback.

DJEarthQuake 05-13-2022 09:20

Re: Run time error 1
 
Happens on load or player join? Assuming on load use pfn_keyvalue to change the erroneous message value.

Code:

"message" "jb_oasis"

Natsheh 05-15-2022 02:37

Re: Run time error 1
 
Quote:

Originally Posted by DJEarthQuake (Post 2779299)
Happens on load or player join? Assuming on load use pfn_keyvalue to change the erroneous message value.

Code:

"message" "jb_oasis"

Actually it happens because some defected plug in that trigger an index out of bound error probably? Then it result in a memory access error which follows a termination for rhe server ( exit code 139 LINUX ) segmentation fault 41-40

DJEarthQuake 05-17-2022 10:46

Re: Run time error 1
 
When I remade parachute on reset I check if the user is connected so 0 does not wedge in there; this was also due to other plugins using a think too, that helped my case. Unsure what will handle your sit.

HamletEagle 05-17-2022 13:14

Re: Run time error 1
 
Quote:

Originally Posted by Natsheh (Post 2779442)
Actually it happens because some defected plug in that trigger an index out of bound error probably? Then it result in a memory access error which follows a termination for rhe server ( exit code 139 LINUX ) segmentation fault 41-40

A typical index out of bounds error DOES NOT result in a segfault. The index is checked and the error is thrown before any faulty memory access will happen.
The error log you posted suggests one of your plugins is using set_fail_state to pause itself.

Natsheh 05-17-2022 14:47

Re: Run time error 1
 
Quote:

Originally Posted by HamletEagle (Post 2779621)
A typical index out of bounds error DOES NOT result in a segfault. The index is checked and the error is thrown before any faulty memory access will happen.
The error log you posted suggests one of your plugins is using set_fail_state to pause itself.

yes and its the parachute plugin which got paused. but i've never used the native set_fail_state in the parachute plugin, you can check out the code in post one.

Craxor 05-17-2022 22:50

Re: Run time error 1
 
Quote:

Originally Posted by Natsheh (Post 2779627)
yes and its the parachute plugin which got paused. but i've never used the native set_fail_state in the parachute plugin, you can check out the code in post one.

thats why is asked if you use set fail state in your jb core ..

fysiks 05-17-2022 22:53

Re: Run time error 1
 
The only place in the whole of AMX Mod X that that output can be generated is in the set_fail_state() function. The "Plugin says" portion is the string provided to the set_fail_state() function.

Are you absolutely sure you're using that source code in your .amxx file? Did you compile it locally with official compilers?

If it's truly not this plugin then there would have to be a bug in the plugin pointer lookup (line) but I find that highly unlikely. Granted, if you're having a segmentation fault, I'm sure it's possible that it's just screwing up a whole bunch of stuff and presenting as a false error.


All times are GMT -4. The time now is 00:18.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.