AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Will it work ? (https://forums.alliedmods.net/showthread.php?t=105322)

DoviuX 10-03-2009 12:44

Will it work ?
 
will this code work ?

PHP Code:


    
new const Zombies[][] = {
        
"Zombie1",
        
"Zombie2",
        
"Zombie3"
    
};

    public 
fw_PlayerSpawn_Post(idclient)
    {
        if (!
is_user_alive(id))
            return 
HAM_IGNORED
        
        
static team;team get_user_team(id)
    
        if(
team == 1// Terrorist
        
{
                
strip_user_weapons(id)
         
cs_set_user_model(idzombies[random_num(0sizeof Zombies 1)]) 


Bugsy 10-03-2009 12:48

Re: Will it work ?
 
Show your full code chief.

xPaw 10-03-2009 12:51

Re: Will it work ?
 
The part of code you showed? Yes.

alan_el_more 10-03-2009 12:53

Re: Will it work ?
 
PHP Code:

cs_set_user_model(idZombies[random_num(0sizeof Zombies 1)]) 

z --> Z

DoviuX 10-03-2009 12:54

Re: Will it work ?
 
alan_el_more

thx and how can i precache these becouse i dont know how

PHP Code:

    new const gZombies[][] = {
        
"models/WM/Zombie1/Zombie1.mdl",
        
"models/WM/Zombie2/Zombie2.mdl",
        
"models/WM/Zombie3/Zombie3.mdl"
    
}; 

i tryed
PHP Code:

        for(new 0sizeof Zombiesi++)
            
precache_modelZombies] ); 

wont work.

xPaw 10-03-2009 13:15

Re: Will it work ?
 
Zombies -> gZombies...

DoviuX 10-03-2009 13:22

Re: Will it work ?
 
okey thanks.

Nice pic ;)

vitorrd 10-04-2009 07:17

Re: Will it work ?
 
Use plugin_prechace.

Code:
public plugin_precache () {     // Your precache_model stuff go here }

By the way, instead of using random_num(0, sizeof(Zombies) - 1), you can use random(sizeof(Zombies)) which has the exact same effect.


All times are GMT -4. The time now is 22:39.

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