AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Interesting Run Time Error (https://forums.alliedmods.net/showthread.php?t=272015)

Depresie 09-22-2015 10:06

[HELP] Interesting Run Time Error
 
Can anyone explain to me the following error?

Spoiler


PHP Code:

#include < amxmodx >
#include < amx_settings_api >
#include < cs_player_models_api >
#include < cs_weap_models_api >
#include < zp50_core >
#include < zp50_class_survivor >
#include < zp50_class_sniper >
#include < rz_vip_core >

#define _PLUGIN       "[RZ] VIP Models"
#define _VERSION            "1.1"
#define _AUTHOR          "H.RED.ZONE"

#define LIBRARY_SURVIVOR "zp50_class_survivor"
#define LIBRARY_SNIPER "zp50_class_sniper"

#define PLAYERMODEL_MAX_LENGTH 32
#define MODEL_MAX_LENGTH 64

// Cvars.
new _pCvarVipModelOn
    
,_pCvarVipKnifeOn

// Default Models.
new const models_vip_human_player[][] = { "vip" }
new const 
models_vip_human_knife[][] = { "models/v_knife.mdl" }    

// New Array.
new Array:_gModelsVipPlayer
new Array:_gKnifeVipPlayer

// Settings File.
new const RZ_SETTINGS_FILE[] = "rz_vip.ini"    
    
// This Will Be Called When Map Is Loaded.
public plugin_init( ) {
    
    
// Register Plugin.
    
register_plugin_PLUGIN_VERSION_AUTHOR )
    
    
// Cvars.
    
_pCvarVipModelOn register_cvar"rz_vip_model_on""1" )
    
_pCvarVipKnifeOn register_cvar"rz_vip_model_knife_on""1" )
}

// Precache Before Map Starts.
public plugin_precache( ) {
    
    
// Initialize Arrays.
    
_gModelsVipPlayer ArrayCreatePLAYERMODEL_MAX_LENGTH)
    
_gKnifeVipPlayer ArrayCreateMODEL_MAX_LENGTH)
    
    
// Load From External File
    
amx_load_setting_string_arrRZ_SETTINGS_FILE"Vip Model""RZ VIP MODEL"_gModelsVipPlayer )
    
amx_load_setting_string_arrRZ_SETTINGS_FILE"Knife Model""V_KNIFE VIP MODEL"_gKnifeVipPlayer )
    
    
// If It Couldn't Load From File, Use And Save Default Ones.
    
    // New Index.
    
new index
    
    
// If Array Size Of VIP Model Is Zero.
    
if ( ArraySize(_gModelsVipPlayer) == ) {
        
        
// Set Index To 0 If Index Lower Then SizeOf Model Index + 1.
        
for ( index 0index sizeof models_vip_human_playerindex++ )
        
            
// Array Push String.
            
ArrayPushString_gModelsVipPlayermodels_vip_human_player[index] )
        
        
// Save To File.
        
amx_save_setting_string_arrRZ_SETTINGS_FILE"Vip Model""RZ VIP MODEL"_gModelsVipPlayer )
    }
    
    
// If Array Size Of VIP Model Is Zero.
    
if ( ArraySize(_gKnifeVipPlayer) == ) {
        
        
// Set Index To 0 If Index Lower Then SizeOf Model Index + 1.
        
for ( index 0index sizeof models_vip_human_knifeindex++ )
        
            
// Array Push Strin
            
ArrayPushString_gKnifeVipPlayermodels_vip_human_knife[index] )
        
        
// Save To File.
        
amx_save_setting_string_arrRZ_SETTINGS_FILE"Knife Model""V_KNIFE VIP MODEL"_gKnifeVipPlayer )
    }
    
    
// Precache Models.
    
new player_model[PLAYERMODEL_MAX_LENGTH], model[MODEL_MAX_LENGTH], model_path[128]
    
    for ( 
index 0index ArraySize(_gModelsVipPlayer); index++ ) {
        
        
ArrayGetString_gModelsVipPlayerindexplayer_modelcharsmax(player_model))
        
        
formatexmodel_pathcharsmax(model_path), "models/player/%s/%s.mdl"player_modelplayer_model )
        
        
precache_modelmodel_path )
        
        
formatexmodel_pathcharsmax(model_path), "models/player/%s/%sT.mdl"player_modelplayer_model )
        
        if ( 
file_exists(model_path) ) 
            
precache_modelmodel_path )
    }
    
    for ( 
index 0index ArraySize(_gKnifeVipPlayer); index++ ) {
        
        
ArrayGetString_gKnifeVipPlayerindexmodelcharsmax(model) )
        
precache_modelmodel )
    }
}

public 
client_disconnect(id)
{
    
remove_task(id)
}

// Cure Post.
public zp_fw_core_cure_post(idattacker) {
    
    
// Skip For Survivor
    
if (LibraryExists(LIBRARY_SURVIVORLibType_Library) && zp_class_survivor_get(id))
        return;
    if (
LibraryExists(LIBRARY_SNIPERLibType_Library) && zp_class_sniper_get(id))
        return;
    
    if( 
rz_is_user_vip(id) || rz_is_user_god(id) ) 
    {
    
        
set_task(0.1"_VipModelsSet",id)
    }
}

public 
_VipModelsSet(id) {
    
    if(!
is_user_alive(id) || zp_core_is_zombie(id))
        return
    
    
// Apply Vip Human Player Model.
    
if ( get_pcvar_num(_pCvarVipModelOn) ) {
        
        
// Player Model.
        
new player_model[PLAYERMODEL_MAX_LENGTH]
        
        
// Get Array.
        
ArrayGetString_gModelsVipPlayerrandom_num(0ArraySize(_gModelsVipPlayer) - 1), player_modelcharsmax(player_model))
        
        
cs_set_player_model(idplayer_model)
    }
    
    
// Apply Vip Knife Model.
    
if ( get_pcvar_num(_pCvarVipKnifeOn) ) 
    {
        
        
// Knife Model.
        
new model[MODEL_MAX_LENGTH]
        
        
// Get Array.
        
ArrayGetString_gKnifeVipPlayerrandom_num(0ArraySize(_gKnifeVipPlayer) - 1), modelcharsmax(model) )
        
        
cs_set_player_view_modelidCSW_KNIFEmodel )
    }



redivcram 09-24-2015 13:26

Re: [HELP] Interesting Run Time Error
 
Nothing calls the function _VipModelsSet

aron9forever 10-02-2015 11:45

Re: [HELP] Interesting Run Time Error
 
Quote:

Originally Posted by redivcram (Post 2346522)
Nothing calls the function _VipModelsSet

more like the function doesn't exist / is called via a task so the compiler didn't detect it during compilation

redivcram 10-02-2015 12:46

Re: [HELP] Interesting Run Time Error
 
Then

PHP Code:

    if( rz_is_user_vip(id) || rz_is_user_god(id) ) 
    {
    
        
set_task(0.1"_VipModelsSet",id)
    } 

:arrow:

PHP Code:

    if( rz_is_user_vip(id) || rz_is_user_god(id) ) 
    {
    
        
_VipModelsSet(id)
    } 

Could've thought of that earlier lol

Depresie 10-08-2015 04:42

Re: [HELP] Interesting Run Time Error
 
@redivcram
from what i know it is needed a delay to set models

i also observed that there is an empty line above the set_task, i just deleted it, now im waiting to see if the error will happen again =/ but i dont know, it is the first time i got that error in months

yokomo 10-08-2015 04:51

Re: [HELP] Interesting Run Time Error
 
Silly suggestion:
- Try to rename _VipModelsSet to something else without _ symbol. Eg: FnVipModelSet

Depresie 10-08-2015 04:57

Re: [HELP] Interesting Run Time Error
 
i will try and your suggestion yokomo, i also have more functions including that symbol in the beginning
i have to review and rewrite + optimize all my entire addons soon, thanks for the suggestion, it doesn't matter if it is silly or not, it's good to take in count even this

redivcram 10-08-2015 06:21

Re: [HELP] Interesting Run Time Error
 
Still... using set_task is for calling a function after an amount of delay, but use it this way since is the same thing but more sure.
Or the error couldve simply blamed the underline

Edit: Didnt see that post sry... but yeah you know what to do

devilicioux 10-09-2015 08:32

Re: [HELP] Interesting Run Time Error
 
I am not much into Zombie related plugins .. but this is what i noticed..

You are using
PHP Code:

cs_set_player_model() 

&
PHP Code:

ArrayGetString() 

where's cstrike.inc and cellarray.inc included ?

HamletEagle 10-09-2015 11:31

Re: [HELP] Interesting Run Time Error
 
Quote:

Originally Posted by devilicioux (Post 2351207)
I am not much into Zombie related plugins .. but this is what i noticed..

You are using
PHP Code:

cs_set_player_model() 

&
PHP Code:

ArrayGetString() 

where's cstrike.inc and cellarray.inc included ?

cellarray is included when you include amxmodx, check the inc file.


All times are GMT -4. The time now is 22:10.

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