AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   model precaching (https://forums.alliedmods.net/showthread.php?t=77132)

allenwr 09-06-2008 05:39

model precaching
 
Well, i have messed up again.

My plugin is not precaching the models. The bool is working, another part of the plugin has shown me that already.

The game is dod and the models' directories are correct, even uploaded to the right places. But the models are not being downloaded from the fastdownload site or the game server site.

PHP Code:

public plugin_precache() {
    if(
forest) {
        
precache_model("models/player/axis/axis.mdl")
        
precache_model("models/player/axis/axisT.mdl")
        
precache_model("models/player/allies/allies.mdl")
        
precache_model("models/player/allies/alliesT.mdl")
    }
}

public 
hudmodelset(id) {
    new 
team get_user_team(id)
    
    if(
forest) {
        switch(
team) {
            case 
1dod_set_model(id"allies")
            case 
2dod_set_model(id"axis")
        }
    }



Alka 09-06-2008 05:47

Re: model precaching
 
1.Where do you set the boolean true?
2.Make shure the precache limit has not be reached.

allenwr 09-06-2008 05:52

Re: model precaching
 
bool is set true in the plugin_init

and this is the only custom plugin that precaches anything.

Alka 09-06-2008 06:45

Re: model precaching
 
plugin_init() is called after plugin_precache() that explains why is not working.

allenwr 09-06-2008 13:24

Re: model precaching
 
Ok, well I guess I could make a plugin that only loads on the map for the precache, but is there another way for me to make the downloads happen only when the map is forest?

I think I have seen some plugins where they do this using:

PHP Code:

#if
    //something
#endif 


Prajch 09-06-2008 13:33

Re: model precaching
 
One less elegant way is specifically enabling that plugin only for that map, in your maps configs.

You'd create something like
Code:

amxmodx/configs/maps/plugins-de_forest.ini
and add the line
Code:

myplugin.amxx
to it.

allenwr 09-06-2008 13:44

Re: model precaching
 
I thought about that, but that cant work for me, you see, this plugin is actually my DoD Class Menu that I am modifying, and I really do not want to disable the plugin for the rest of the server and this is also a good learning area for me so I can understand something I have not done before.

But if the above does not work, how can I disable a plugin for a certain map as well?

allenwr 09-06-2008 13:49

Re: model precaching
 
Why didn't someone just tell me to do this:
PHP Code:

public plugin_precache() {
    
get_mapname(g_map,31)
    if(
equali(g_map,"dod_forest")) {
        
forest true
    
}
    if(
forest) {
         
//stuff
    
}



Prajch 09-06-2008 15:25

Re: model precaching
 
:!: Good question. Guess it slipped my mind.

Anyway if you wanna disable a plugin by that method I mentioned, put "disable" next to its name.

Vet 09-07-2008 22:52

Re: model precaching
 
Quote:

Originally Posted by allenwr (Post 682155)
Why didn't someone just tell me to do this:

Because I just read the thread. lol
Just remember, plugin_precache gets executed before plugin_init


All times are GMT -4. The time now is 03:09.

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