Thread: ZP VIP System
View Single Post
riste.kgb
Junior Member
Join Date: Oct 2019
Location: Macedonia, Bogdanci
Old 11-09-2019 , 05:55   Re: ZP VIP System
Reply With Quote #5

Quote:
Originally Posted by edon1337 View Post
This code seems like a bunch of copy-pasting, especially Elite Admin System.

Suggestions:
1. You're only pre-caching 1 model from the array, then breaking the loop, resulting into server crash because of un-precached models.
PHP Code:
public plugin_precache(){
    
g_playerData ArrayCreate(PlayerData);
    
    
ReloadFile();
    
    new 
iPlayer[PlayerData];
    
    for(new 
iArraySize(g_playerData); i++)
    {
        
ArrayGetArray(g_playerData,i,iPlayer)
        new 
szModel[64]
        if(
iPlayer[Player_ModelCT][0])
        {
            
formatex(szModel,charsmax(szModel),"models/player/%s/%s.mdl",iPlayer[Player_ModelCT],iPlayer[Player_ModelCT])
            
precache_model(szModel)
        }
        
        if(
iPlayer[Player_ModelT][0])
        {
            
formatex(szModel,charsmax(szModel),"models/player/%s/%s.mdl",iPlayer[Player_ModelT],iPlayer[Player_ModelT])
            
precache_model(szModel)
        }
        break;
    }

2. Don't use ResetHUD to set models, it's not the appropriate event.

3. Implement ML
for the suggestion #2: - For now it will be like this, it's working very well every round the player model is reseting as it means to be.
ML - will be added later when i finish with /vm menu.

EDIT: The bug with precaching models should be fixed now. Updated the first post with a new update.

Last edited by riste.kgb; 11-09-2019 at 06:13.
riste.kgb is offline