Raised This Month: $ Target: $400
 0% 

Improving and optimizing this thing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krystek.
Member
Join Date: May 2022
Old 05-29-2022 , 11:57   Re: Improving and optimizing this thing
Reply With Quote #1

Quote:
Originally Posted by Bugsy View Post
I'd consolidate item data into an enum sized array:
PHP Code:
enum Knives
{
    
DefaultKnife,
    
SomeKnife1,
    
SomeKnife2
}
enum P90s
{
    
DefaultP90,
    
SomeP901,
    
SomeP902
}
enum ItemData
{
    
ItemName64 ],
    
ItemModel64 ]
}

new const 
KnivesItemsKnives ][ ItemData ] =
{
    { 
"Default" "models/v_knife.mdl" },
    { 
"Knife \d×\w Skins" "models/v_knife_boreal_forest.mdl" },
    { 
"Knife \d×\w Skins" "models/v_knife_safari_mesh.mdl" }
};
new const 
P90ItemsP90s ][ ItemData ] =
{
    { 
"Default" "models/v_p90_rabbit.mdl" },
    { 
"P90 \d×\w Skins" "models/v_p90_assimov.mdl" },
    { 
"P90 \d×\w Skins" "models/v_p90_chicken_of_war.mdl" }
};

public 
plugin_precache() 
{
    for ( new 
Knives:kKnifeID DefaultKnife kKnifeID Knives kKnifeID++ )
    {
        
precache_modelKnivesItemskKnifeID ][ ItemModel ] );
    }
    
    for ( new 
P90s:pP90ID DefaultP90 pP90ID P90s pP90ID++ )
    {
        
precache_modelP90ItemspP90ID ][ ItemModel ] );
    }

And how do you see it, for example in @MENU?
Krystek. is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-29-2022 , 15:25   Re: Improving and optimizing this thing
Reply With Quote #2

Quote:
Originally Posted by Krystek. View Post
And how do you see it, for example in @MENU?
the same way you precache the model, but instead of ItemModel you use ItemName

Last edited by lexzor; 05-29-2022 at 15:25.
lexzor 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 21:22.


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