Raised This Month: $32 Target: $400
 8% 

Solved Error: could not load file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-27-2020 , 09:25   Error: could not load file
Reply With Quote #1

I'm trying to set player models according to which weapon the player is currently wearing, but without success. I'm having this error in my game console with every single model


Error: could not load file models/player/wbm4a1/wbm4a1.mdl
__________________

Last edited by Bugsy; 01-27-2020 at 13:58.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-27-2020 , 09:58   Re: Error: could not load file
Reply With Quote #2

How are you setting the model? Show the code.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-27-2020 , 10:00   Re: Error: could not load file
Reply With Quote #3

Tried using some code u provided me earlier, here it is.

PHP Code:
#include <amxmodx>
#include <cstrike>

#define PLUGIN "FFA: WeaponBased PlayerModels"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

enum _:ModelsInfo
{
    
szName[32],
    
iWeapon,
    
CsTeams:iTeams
}

new 
szWeapons[][ModelsInfo] =
{
    { 
"wbknife"CSW_KNIFE },         // Knife
    
"wbawp"CSW_AWP },             // AWP
    
"wbfamas"CSW_FAMASCS_TEAM_CT },     // Famas
    
"wbm4a1"CSW_M4A1CS_TEAM_CT },     // M4A1
    
"wbak47"CSW_AK47CS_TEAM_T },     // AK47 
    
"wbgalil"CSW_GALILCS_TEAM_T },     // Galil
    
"wbtmp"CSW_TMPCS_TEAM_CT },     // TMP
    
"wbump45"CSW_UMP45 },         // Ump45
    
"wbscout"CSW_SCOUT },         // Scout
    
"wbxm1014"CSW_XM1014 },         // XM1014
    
"wbaug"CSW_AUGCS_TEAM_CT },     // AUG
    
"wbsg550"CSW_SG550CS_TEAM_CT },     // SG550
    
"wbmp5navy"CSW_MP5NAVY },         // MP5 Navy
    
"wbm249"CSW_M249 },             // M249
    
"wbm3"CSW_M3 },             // M3
    
"wbg3sg1"CSW_G3SG1CS_TEAM_T },     // G3SG1
    
"wbsg552"CSW_SG552CS_TEAM_T }     // SG552
};

precache_player_model(szModel[])
{
    static 
szFile[128];
    
formatex(szFilecharsmax(szFile), "models/player/wbmodels/%s/%s.mdl"szModelszModel);
    
precache_model(szFile);
    
replace(szFilecharsmax(szFile), ".mdl""T.mdl");

    if(
file_exists(szFile))
    {
        
precache_model(szFile);
    }
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_event("CurWeapon""CheckWeapons""be""1=1");
}

public 
plugin_precache()
{
    for(new 
isizeof(szWeapons); i++)
    {
        
precache_player_model(szWeapons[i][szName]);
    }
}

public 
CheckWeapons(id)
{
    for(new 
isizeof(szWeapons); i++)
    {
        if(
get_user_weapon(id) == szWeapons[i][iWeapon])
        {
            if(
cs_get_user_team(id) & szWeapons[i][iTeams]) 
            {
                
cs_set_user_model(idszWeapons[i][szName]);
                break;
            }
        }
    }

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-27-2020 , 11:08   Re: Error: could not load file
Reply With Quote #4

I am not sure, but I do not think you can have subfolders for player models. For example a model called test.mdl should be inside models/player/test/test.mdl not models/player/subfolder/test/test.mdl
__________________
HamletEagle is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-27-2020 , 11:11   Re: Error: could not load file
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
I am not sure, but I do not think you can have subfolders for player models. For example a model called test.mdl should be inside models/player/test/test.mdl not models/player/subfolder/test/test.mdl
I'll try that out.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-27-2020 , 13:18   Re: Error: could not load file
Reply With Quote #6

That's right. Player model paths are hardcoded in the engine. You musy obey the path rule for all models, so don't change the one I put in the function.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-27-2020 , 13:45   Re: Error: could not load file
Reply With Quote #7

Thanks for the help, that solved my problem
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-27-2020 , 15:20   Re: Error: could not load file
Reply With Quote #8

One more question about the code, as u can see i specify models to be set only for certain teams since certain guns are only available to T's or CT's. So the problem is that i have empty spaces that should fill in the team, causing my models not to be set, how can i fix this?

Current code:
PHP Code:
new szWeapons[][ModelsInfo] =
{
    { 
"wbknife"CSW_KNIFE },         // Knife    - DOESN'T WORK - REPLACED
    
"wbawp"CSW_AWP },             // AWP        - DOESN'T WORK - REPLACED
    
"wbfamas"CSW_FAMASCS_TEAM_CT },     // Famas    - WORKS
    
"wbm4a1"CSW_M4A1CS_TEAM_CT },     // M4A1     - WORKS
    
"wbak47"CSW_AK47CS_TEAM_T },     // AK47     - DOESN'T WORK - REPLACED
    
"wbgalil"CSW_GALILCS_TEAM_T },     // Galil    - DOESN'T WORK - REPLACED
    
"wbtmp"CSW_TMPCS_TEAM_CT },     // TMP        - DOESN'T WORK - REPLACED
    
"wbump45"CSW_UMP45 },         // Ump45    - DOESN'T WORK - REPLACED
    
"wbscout"CSW_SCOUT },         // Scout    - DOESN'T WORK - REPLACED
    
"wbxm1014"CSW_XM1014 },         // XM1014    - DOESN'T WORK - REPLACED
    
"wbaug"CSW_AUGCS_TEAM_CT },     // AUG         - DOESN'T WORK - REPLACED
    
"wbsg550"CSW_SG550CS_TEAM_CT },     // SG550    - WORKS
    
"wbmp5navy"CSW_MP5NAVY },         // MP5 Navy    - DOESN'T WORK - REPLACED
    
"wbm249"CSW_M249 },             // M249        - DOESN'T WORK - REPLACED
    
"wbm3"CSW_M3 },             // M3        - DOESN'T WORK - REPLACED
    
"wbg3sg1"CSW_G3SG1CS_TEAM_T },     // G3SG1    - WORKS
    
"wbsg552"CSW_SG552CS_TEAM_T }     // SG552    - DOESN'T WORK - REPLACED
}; 
how i set my models

PHP Code:
public CheckWeapons(id)
{
    for(new 
isizeof(szWeapons); i++)
    {
        if(
get_user_weapon(id) == szWeapons[i][iWeapon])
        {
            if(
cs_get_user_team(id) & szWeapons[i][iTeams]) 
            {
                
cs_set_user_model(idszWeapons[i][szName]);
                break;
            }
        }
        else
        {
            
cs_reset_user_model(id);
        }
    }

__________________

Last edited by Napoleon_be; 01-27-2020 at 15:21.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-27-2020 , 16:16   Re: Error: could not load file
Reply With Quote #9

Try this:
PHP Code:
new szWeapons[][ ModelsInfo ] =
{
    { 
"wbknife"CSW_KNIFE CS_TEAM_UNASSIGNED },         // Knife    - DOESN'T WORK - REPLACED
    
"wbawp"CSW_AWP CS_TEAM_UNASSIGNED },             // AWP        - DOESN'T WORK - REPLACED
    
"wbfamas"CSW_FAMASCS_TEAM_CT },     // Famas    - WORKS
    
"wbm4a1"CSW_M4A1CS_TEAM_CT },     // M4A1     - WORKS
    
"wbak47"CSW_AK47CS_TEAM_T },     // AK47     - DOESN'T WORK - REPLACED
    
"wbgalil"CSW_GALILCS_TEAM_T },     // Galil    - DOESN'T WORK - REPLACED
    
"wbtmp"CSW_TMPCS_TEAM_CT },     // TMP        - DOESN'T WORK - REPLACED
    
"wbump45"CSW_UMP45 CS_TEAM_UNASSIGNED},         // Ump45    - DOESN'T WORK - REPLACED
    
"wbscout"CSW_SCOUT CS_TEAM_UNASSIGNED},         // Scout    - DOESN'T WORK - REPLACED
    
"wbxm1014"CSW_XM1014 CS_TEAM_UNASSIGNED},         // XM1014    - DOESN'T WORK - REPLACED
    
"wbaug"CSW_AUGCS_TEAM_CT },     // AUG         - DOESN'T WORK - REPLACED
    
"wbsg550"CSW_SG550CS_TEAM_CT },     // SG550    - WORKS
    
"wbmp5navy"CSW_MP5NAVY CS_TEAM_UNASSIGNED},         // MP5 Navy    - DOESN'T WORK - REPLACED
    
"wbm249"CSW_M249 CS_TEAM_UNASSIGNED},             // M249        - DOESN'T WORK - REPLACED
    
"wbm3"CSW_M3 CS_TEAM_UNASSIGNED},             // M3        - DOESN'T WORK - REPLACED
    
"wbg3sg1"CSW_G3SG1CS_TEAM_T },     // G3SG1    - WORKS
    
"wbsg552"CSW_SG552CS_TEAM_T }     // SG552    - DOESN'T WORK - REPLACED
}; 

public 
CheckWeapons(id)
{
    new 
iWeapon get_user_weaponid );
    new 
CsTeams:csTeam cs_get_user_teamid );
    
    for ( new 
sizeofszWeapons ) ; i++ )
    {
        if ( 
iWeapon == szWeapons][ WeaponID ] )
        {
            if ( ( 
szWeapons][ TeamID ] == CS_TEAM_UNASSIGNED ) || ( csTeam == szWeapons][ TeamID ] ) ) 
            {
                
cs_set_user_modelid szWeapons][ szModel ] );
            }
            else
            {
                
cs_reset_user_modelid );
            }
            
            break;
        }
    }

__________________

Last edited by Bugsy; 01-27-2020 at 16:18.
Bugsy is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-27-2020 , 16:28   Re: Error: could not load file
Reply With Quote #10

Awesome, thanks Bugsy. Worked like a charm
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Reply



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 05:01.


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