Raised This Month: $ Target: $400
 0% 

Solved precaching model!(not precaching!)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 22:53.


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