AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved precaching model!(not precaching!) (https://forums.alliedmods.net/showthread.php?t=299751)

leonardo121 07-24-2017 15:16

precaching model!(not precaching!)
 
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]);
        }
    }



Black Rose 07-24-2017 16:45

Re: precaching model!(not precaching!)
 
Precaching works fine, don't know about the change of model. Not sure what it's supposed to do.

leonardo121 07-25-2017 08:55

Re: precaching model!(not precaching!)
 
It's supposed to change model, to new one, but it does not work!

leonardo121 07-25-2017 09:43

Re: precaching model!(not precaching!)
 
fixed!

changed the
PHP Code:

set_pev(idpev_weaponmodel2gWeaponModels[weaponId]); 

to:
PHP Code:

set_pev(idpev_viewnmodel2gWeaponModels[weaponId]); 



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

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