Raised This Month: $ Target: $400
 0% 

Offset MODELINDEX


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 10-20-2009 , 14:31   Offset MODELINDEX
Reply With Quote #1

So I saw how in zplague is setting modelindex offset , I set in my plugin too, is this correct?
PHP Code:
// Other
#define MAX_CLASSES 4

new const ZOMBIE_CLASSES[MAX_CLASSES][]= {
    
"zombieap1"// Player Model of hunter
    
"panic"// Player Model of boomer
    
"mummy"// Player Model of smoker
    
"zombieap4" // Player Model of tank


new 
PlayerClass[33];

new Array:
g_modelindex_zombie;

// plugin_precache
g_modelindex_zombie ArrayCreate(11);

new 
modelpath_human[100];
for(new 
0MAX_CLASSESi++)
{
    
formatex(modelpath_humansizeof modelpath_human 1"models/player/%s/%s.mdl"ZOMBIE_CLASSES[i], ZOMBIE_CLASSES[i])
    if( !
file_existsmodelpath_human ) )
    {
        return 
0;
    }

    
ArrayPushCell(g_modelindex_zombieengfunc(EngFunc_PrecacheModelmodelpath_human))

    
formatex(modelpath_humansizeof modelpath_human 1"models/player/%s/%st.mdl"ZOMBIE_CLASSES[i], ZOMBIE_CLASSES[i])
    if ( 
file_existsmodelpath_human ) )
    {
        
engfunc(EngFunc_PrecacheModelmodelpath_human);

        return 
1;
    }

    
formatex(modelpath_humansizeof modelpath_human 1"models/player/%s/%sT.mdl"ZOMBIE_CLASSES[i], ZOMBIE_CLASSES[i])
    if ( 
file_existsmodelpath_human ) )
    {
        
engfunc(EngFunc_PrecacheModelmodelpath_human);

        return 
1;
    }
}
// Ham Spawn Post
PlayerClass[id] = random_num(03)

fm_cs_set_user_model_index(idArrayGetCell(g_modelindex_zombiePlayerClass[id]))

// Stock
// Set the precached model index (updates hitboxes server side)
stock fm_cs_set_user_model_index(idvalue)
{
    
set_pdata_int(id491value5)

Btw I don't know anything about Arrays... But I learned a bit from zplague.
I'm just confused...
__________________

Last edited by xbatista; 10-20-2009 at 14:39.
xbatista is offline
Send a message via Skype™ to xbatista
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-20-2009 , 16:52   Re: Offset MODELINDEX
Reply With Quote #2

It looks correct to me. I don't really know what else to say. I guess I should qualify it by stating that I only looked at your ArrayPushCell() and fm_cs_set_user_model_index() calls.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 10-20-2009 , 18:12   Re: Offset MODELINDEX
Reply With Quote #3

Generally you can assume that code from such plugins is in a working state.

Nevertheless, if you have a problem understanding the arrays, you should make things easier to understand everything in it's entirety. The base method of setting the index shouldn't be a problem.
__________________
In Flames we trust!
Nextra is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 10-21-2009 , 09:03   Re: Offset MODELINDEX
Reply With Quote #4

Btw all says that it eats MUCH CPU, dunno why you think that ,but in my server with 32 slots works normally as was previous maybe + 0.3; +0.5 it really eats ,but not much.Also it will eat more CPU if you use more models , I have only 4, seems no problem.
__________________

Last edited by xbatista; 10-21-2009 at 09:17.
xbatista is offline
Send a message via Skype™ to xbatista
Reply


Thread Tools
Display Modes

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 17:37.


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