Raised This Month: $12 Target: $400
 3% 

ERROR: SV_Modelindex Model not prechached


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Crackhead69
Member
Join Date: Feb 2021
Old 06-13-2021 , 05:53   ERROR: SV_Modelindex Model not prechached
Reply With Quote #1

Hello!
I have a strange error that is occurring randomly, not at start of the plugin.

I have existing plugin as this example, just with different names for easier understanding:
PHP Code:
#include <amxmodx>

new const model_1[] = "models/model_1.mdl"
new const model_2[] = "models/model_2.mdl"

public plugin_init()
    
register_event("CurWeapon""Event_CurWeapon""be")
    
public 
Event_CurWeapon(id){
    
set_pev(idpev_viewmodel2model_1)
    
set_pev(idpev_weaponmodel2model_2)
}


public 
plugin_precache(){
    
precache_model(model_1)
    
precache_model(model_2)

The error occurs from those 2 model files, the files are okay, and used wildly in other servers, this is not problem which occurs from the model file.

It happens often, but it has no fixed timing for when it gives the error.

FATAL ERROR (shutting down): SV_ModelIndex: SV_ModelIndex: model mdl not precach
ed
Segmentation fault

The "model mdl" has different symbols every time the error occurs, although the symbols are representing parts of the names of model_1 and model_2.

What should i look for that can cause this strange error? Is it a Plugin that can cause it, or something else ?
Crackhead69 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 06-13-2021 , 14:49   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #2

Call is made before it is precached. Try putting precache up higher.
__________________
DJEarthQuake is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-14-2021 , 00:05   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #3

I am not sure but try to put plugin_precache() after plugin_init()

Also, it is a bit out of topic but you shouldn't change weapon model at Event_CurWeapon since it will call many time cause increase in server usage. This way is out-dated.
Now we used Ham_Item_Deploy to set weapon model only once when you switch to that specific weapon only

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta> 

new const model_1[] = "models/model_1.mdl"
new const model_2[] = "models/model_2.mdl"

public plugin_init()
{
    
RegisterHam(Ham_Item_Deploy"weapon_usp""fw_Weapon_Deploy"1//change weapon_usp to the weapon you want to replace
}

public 
plugin_precache(){
    
precache_model(model_1)
    
precache_model(model_2)

    
public 
fw_Weapon_Deploy(ent)
{
    if(
pev_valid(ent) != 2)
        return
    static 
idid get_pdata_cbase(ent414//Get ID
    
if(get_pdata_cbase(id373) != ent//373 = m_pActiveItem. This check if current weapon is correct or not
        
return

    
set_pev(idpev_viewmodel2model_1)
    
set_pev(idpev_weaponmodel2model_2)

Edit: This is assuming you are try to make CS weapon.
__________________
My plugin:

Last edited by Celena Luna; 06-14-2021 at 00:30.
Celena Luna is offline
Crackhead69
Member
Join Date: Feb 2021
Old 06-14-2021 , 09:46   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #4

tried placing plugin_precache below plugin_init, error still occurs, symbols are getting more and more strange

FATAL ERROR (shutting down): SV_ModelIndex: SV_ModelIndex: model ****************** not precached. Segmentation fault

This is the latest error message that appeared. Seems the problem is more deep. The plugin i am working on is way too long, therefore i can't ask anybody to read every single line of it. If somebody could point me to where should i look for, that would be enough of a help, the rest i'll manage.

I have experienced similar error before:

FATAL ERROR SayText limit is 192 bytes, where the problem there was the way i placed colorchat's colors. The error occured when a colorchat text was typed like so:

Code:
ColorChat(id,team_color, "name ^3%s", szName) 
in this situation the ^3% was counted as 1 unknown strange symbol that for some reason multiplied the text every time it's called by random amounts, giving errors similar to the

SV_ModelIndex: SV_ModelIndex,
Text written inside the colorchat in that situation was random, containing parts of the original message.

The solution there was to put aside ^3 and %s.

Although, i have checked every single type of similar symbols in the plugin and the others that i am using, there are none which are connected like the example "^3%s"

Last edited by Crackhead69; 06-14-2021 at 09:50.
Crackhead69 is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 06-14-2021 , 13:53   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #5

Log and pause technique before it crashes may help part of your problem. Illustration snip:
Code:
public plugin_precache() {     if(file_exists("sound/misc/Temp.wav")){         precache_sound(SOUND_GOTATEMP);     }         else     {             log_amx("Paused to prevent crash from missing %s.",SOUND_GOTATEMP);             pause "a";     } }

Code:
    get_datadir(g_filepath, charsmax(g_filepath));     formatex(g_szFile[0], charsmax(g_szFile), "%s/%s", g_filepath, g_szRequired_Files[0]);     formatex(g_szFile[1], charsmax(g_szFile), "%s/%s", g_filepath, g_szRequired_Files[1]);     if( (!file_exists(g_szFile[0])) || !file_exists(g_szFile[1]) ){         server_print("Check your Maxmind databases...%s|%s...halting to prevent crash.",g_szFile[0],g_szFile[1]);         pause("a");     }
__________________

Last edited by DJEarthQuake; 06-14-2021 at 13:58.
DJEarthQuake is offline
Crackhead69
Member
Join Date: Feb 2021
Old 06-14-2021 , 16:27   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #6

This is very helpful, thank you, although the plugin is more or less calling a non-existing model name from within, therefore precache in this case does not seem to matter.

I will put if(file_exist) check on every line i am setting a model, this would seem to be a temporary solution. I am still satisfied that it is some kind of solution.

Will update if i have found a more permanent solution to the problem.

Last edited by Crackhead69; 06-14-2021 at 16:28.
Crackhead69 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 06-14-2021 , 21:49   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #7

You're obviously looking at the wrong plugin if names aren't matching.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-15-2021 , 00:57   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #8

DJEarthQuake and celena forward order doesn't effect the function calling order..
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 06-16-2021 , 15:47   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #9

This is true precache at the top of the script or at bottom when it is right it does not matter. That being said I do not have any examples to show today but I have experienced situation where it does matter contrary to popular opinion that these things are happening so fast that I have had to put everything that is normally in init into precache to MAKE IT WORK and hold the server together. Also without metamod on the system at all these half names appearing I have seen enough with making maps that are too large for the system. So that could also be, assuming the script is right, the plugin list, the map, everything may have hit a hard ent limit. The main take away. I did not want to be rude. Somebody could have said learn debug and leave it there.
__________________
DJEarthQuake is offline
Crackhead69
Member
Join Date: Feb 2021
Old 06-19-2021 , 11:55   Re: ERROR: SV_Modelindex Model not prechached
Reply With Quote #10

The error is still going.
This time it seems that it cought a whole string :

Code:
FATAL ERROR (shutting down): SV_ModelIndex: SV_ModelIndex: model Cannot open menu
. not precached
Segmentation fault
The message string "Cannot open menu" in the code is called from a clcmd, cannot be called otherwise.
The clcmd for the string was Not called before the crash happened. Therefore the code seems to be trying to precache random strings throughout itself, i don't even know if that's possible but there it is.

I don't expect any answers, since i might be the only one so far whom experienced this kind of mad error, so i am just throwing the project away. Thanks to everybody whom spent their time replying to my thread.
Crackhead69 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:26.


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