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

Problem with precache model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ROKronoS
Senior Member
Join Date: Oct 2010
Location: Bucharest, Romania
Old 01-01-2011 , 10:25   Problem with precache model
Reply With Quote #1

Hi!I used this tutorial: http://forums.alliedmods.net/showthr...nu+item+native for a zombie mod but i have a problem.I created the structure for the zombie classes and it looks like this:
Code:
enum _:ClassData
{
    ClassName[32],
    ClassDes[32],
    ClassModel[32],
    ClassHP,
    ClassSpeed,
    ClassGrav
}
Every class has it's own model but i don't know how to precache it.I have the g_itotalclasses variable which grows with every registered class but in plugin_precache it's value it's 0.
Code:
public plugin_precache()
{
new eItemData[ClassData]

for(new class = 0;class < g_itotalclasses; class++)
{
ArrayGetArray(g_classes, class, eItemData)
        
new pzModel[128]
formatex(pzModel, charsmax(pzModel), "models/player/%s/%s.mdl", eItemData[ClassModel], eItemData[ClassModel])
precache_model(pzModel)
}
precache_model(V_KNIFE_ZOMBIE)
}
ROKronoS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-01-2011 , 14:48   Re: Problem with precache model
Reply With Quote #2

Instead of doing it like that, you should make the sub-plugins register the classes in plugin_precache().
Then, in the main plugin, you precache the model when the register native is called.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ROKronoS
Senior Member
Join Date: Oct 2010
Location: Bucharest, Romania
Old 01-02-2011 , 02:53   Re: Problem with precache model
Reply With Quote #3

I've done the first part.What about the precache?I don't understand...

EDIT: I figured it out.It works.Thanks

Last edited by ROKronoS; 01-02-2011 at 03:11.
ROKronoS 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 00:24.


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