Raised This Month: $ Target: $400
 0% 

[REQ] menu proprieties


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-12-2017 , 15:30   Re: [REQ] menu proprieties
Reply With Quote #5

Can I use the same topic for another simple suggestion? Yes? Thanks.

Add a bool in the precache_model function to set whether the model being precached is a player model or anything else. If the bool is set to true, the function will check if a player model with a T.mdl file exists and will automatically precache that file if found. Also, if the string doesn't contain ".mdl" and the bool is set to true, it will automatically form the proper player model path, so the function can be used in three different ways:

PHP Code:
precache_model("models/some_model.mdl"// for regular models
precache_model("models/player/McDonalds/McDonalds.mdl"true// for player models (with path)
precache_model("McDonalds"true// for player models (without path) 
Not precaching T.mdl files can lead to server crash and most coders seem to forget about this when changing player models in plugins. Another variant can be adding a separate precache_player_model function. This is what I use:

PHP Code:
precache_player_model(szModel[])
{
    static 
szFile[128]
    
formatex(szFilecharsmax(szFile), "models/player/%s/%s.mdl"szModelszModel)
    
precache_model(szFile)
    
replace(szFilecharsmax(szFile), ".mdl""T.mdl")
    
    if(
file_exists(szFile))
        
precache_model(szFile)

__________________

Last edited by OciXCrom; 12-12-2017 at 15:30.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
 



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 23:19.


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