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

Solved precaching model!(not precaching!)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
leonardo121
Member
Join Date: Sep 2013
Old 07-24-2017 , 15:16   precaching model!(not precaching!)
Reply With Quote #1

Hello everyone!

i have this plugin, made by exolent , (thanks)

The problem is the plugin is not precaching the model,
On the server it shows that everything is okay, but no downloading and not seting the new model!!

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

new gWeaponModels[CSW_P90 1][64];

public 
plugin_precache() {
    new 
configFile[64];
    
get_configsdir(configFilecharsmax(configFile));
    
add(configFilecharsmax(configFile), "/weapon_models.ini");
    
    new 
fopen(configFile"rt");
    
    if(
f) {
        new 
data[128], lineclassName[32], model[64], weaponId;
        
        while(!
feof(f)) {
            
fgets(fdatacharsmax(data));
            
trim(data);
            
line++;
            
            if(!
data[0] || data[0] == ';' || data[0] == '/' && data[1] == '/') {
                continue;
            }
            
            
parse(dataclassNamecharsmax(className), modelcharsmax(model));
            
            if((
weaponId get_weaponid(className))) {
                if(
file_exists(model)) {
                    
precache_model(model);
                    
                    
RegisterHam(Ham_Item_DeployclassName"FwdItemDeployPost"1);
                    
                    
copy(gWeaponModels[weaponId], charsmax(gWeaponModels[]), model);

                    
server_cmd("echo Model file ^"%s^" found from config file on line %d"modelline);
                } else {
                    
server_cmd("echo Model file ^"%s^" not found from config file on line %d"modelline);
                }
            } else {
                
server_cmd("echo Invalid weapon class ^"%s^" from config file on line %d"classNameline);
            }
        }
        
        
fclose(f);
    }
}

public 
plugin_init() {
    
register_plugin("Weapon Models""0.0.1""Exolent");
}

public 
FwdItemDeployPost(entity) {
    const 
m_pPlayer 41;
    const 
m_iId 43;
    
    new 
id get_pdata_cbase(entitym_pPlayer4);
    
    if(
is_user_alive(id)) {
        new 
weaponId get_pdata_int(entitym_iId4);
        
        if(
weaponId <= CSW_P90 && gWeaponModels[weaponId][0]) {
            
set_pev(idpev_weaponmodel2gWeaponModels[weaponId]);
        }
    }


Last edited by leonardo121; 07-27-2017 at 11:33.
leonardo121 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-24-2017 , 16:45   Re: precaching model!(not precaching!)
Reply With Quote #2

Precaching works fine, don't know about the change of model. Not sure what it's supposed to do.

Last edited by Black Rose; 07-24-2017 at 16:53.
Black Rose is offline
leonardo121
Member
Join Date: Sep 2013
Old 07-25-2017 , 08:55   Re: precaching model!(not precaching!)
Reply With Quote #3

It's supposed to change model, to new one, but it does not work!
leonardo121 is offline
leonardo121
Member
Join Date: Sep 2013
Old 07-25-2017 , 09:43   Re: precaching model!(not precaching!)
Reply With Quote #4

fixed!

changed the
PHP Code:
set_pev(idpev_weaponmodel2gWeaponModels[weaponId]); 
to:
PHP Code:
set_pev(idpev_viewnmodel2gWeaponModels[weaponId]); 
leonardo121 is offline
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 02:16.


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