Raised This Month: $ Target: $400
 0% 

[help] Precache models


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
natkemon
Member
Join Date: Dec 2008
Old 03-14-2011 , 08:35   [help] Precache models
Reply With Quote #1

Is this the right way of precaching more then 1 model? and is there an easier way cause this way doesn't work and only works for 1 model

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

new const VIEW_MODEL[] =
{
    
"models/cod4/v_aug.mdl",
    
"models/cod4/v_scout.mdl"
}
new const 
PLAYER_MODEL[] = 
{
    
"models/cod4/p_aug.mdl",
    
"models/cod4/p_scout.mdl"
}
new const 
WORLD_MODEL[] =
{
    
"models/cod4/w_aug.mdl",
    
"models/cod4/w_scout.mdl"
}
new const 
OLDWORLD_MODEL[] =
{
    
"w_aug.mdl",
    
"w_scout.mdl"
}

new 
PLUGIN_NAME[]        = "Custom Knife Model" 
new PLUGIN_AUTHOR[]    = "Cheap_Suit" 
new PLUGIN_VERSION[]     = "1.0" 

public plugin_init() 
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)     
    
register_event("CurWeapon""Event_CurWeapon""be","1=1")
    
register_forward(FM_SetModel"fw_SetModel")


public 
plugin_precache() 
{    
    
precache_model(VIEW_MODEL)     
    
precache_model(PLAYER_MODEL
    
precache_model(WORLD_MODEL)


public 
Event_CurWeapon(id
{     
    new 
weaponID read_data(2

    if(
weaponID != CSW_AUG
        return 
PLUGIN_CONTINUE
    
    
if(weaponID != CSW_SCOUT)
        return 
PLUGIN_CONTINUE

    set_pev
(idpev_viewmodel2VIEW_MODEL)
    
set_pev(idpev_weaponmodel2PLAYER_MODEL)
    
    return 
PLUGIN_CONTINUE 
}

public 
fw_SetModel(entitymodel[])
{
    if(!
is_valid_ent(entity)) 
        return 
FMRES_IGNORED

    
if(!equali(modelOLDWORLD_MODEL)) 
        return 
FMRES_IGNORED

    
new className[33]
    
entity_get_string(entityEV_SZ_classnameclassName32)
    
    if(
equal(className"weaponbox") || equal(className"armoury_entity") || equal(className"grenade"))
    {
        
engfunc(EngFunc_SetModelentityWORLD_MODEL)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

natkemon 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 14:37.


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