AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] how to reset Terror deaths in next round? (https://forums.alliedmods.net/showthread.php?t=133312)

jc980 07-24-2010 02:28

[HELP] how to reset Terror deaths in next round?
 
I tried this but it doesnt works. :|

PHP Code:

public event_round_start()
{
set_task(20.0"reset_deaths")
}

public 
reset_deaths(id) {       
    if(
cs_get_user_team(id) == CS_TEAM_T)
    {
        
cs_set_user_deaths id)
    }


Please help! thanks in advance!

also i got another problem:

The Custom Boss model doesnt work and only shows the Zombie model.
but after The player dies the boss model shows up in his respawn but its class is a normal zombie not a boss zombie.
PHP Code:

public ham_player_spawn(id)
{
    if(!
is_user_alive(id) || !cs_get_user_team(id))
        return
    
g_zombie[id] = cs_get_user_team(id) == CS_TEAM_T true false
    remove_task
(id 100)
    if(
g_zombie[id])
    {
        switch (
random_num(11))
        {
            case 
1copy(g_player_model[id], charsmaxg_player_model[] ), ZOMBIE_MODEL1)
                
/*case 2: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL2)
                case 3: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL3)
            case 4: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL4)
                case 5: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL5)
                case 6: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL6)
                case 7: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL7)
                case 8: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL8)
                case 9: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL9)
                case 10: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL10)
                case 11: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL11)
                case 12: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL12)
                case 13: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL13)
                case 14: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL14)
                case 15: copy(g_player_model[id], charsmax( g_player_model[] ), ZOMBIE_MODEL15)*/
            
}
        if(
g_boss_class[id])
            {
                switch (
random_num(11))
                {
                    case 
1copy(g_player_model[id], charsmaxg_player_model[] ), ZOMBIE_MODEL15)
                }
            }
        new 
currentmodel[32]
        
fm_get_user_model(idcurrentmodelcharsmax(currentmodel))
        if(!
equal(currentmodelg_player_model[id]))
        {
            if(
get_gametime() - g_roundstart_time 5.0)
                
set_task(5.0 0.5"fm_user_model_update"id 100)
            else
                
fm_user_model_update(id 100)
        }
    }
        
    else if(
g_has_custom_model[id])
        {
            
fm_reset_user_model(id)
        }
    }
    
    public 
fm_client_key(id, const infobuffer[], const key[])
    {   
        if(
g_has_custom_model[id] && equal(key"model"))
            return 
FMRES_SUPERCEDE
        
return FMRES_IGNORED
    
}
    
    public 
fm_client_info(id)
    {
        if(!
g_has_custom_model[id])
            return 
FMRES_IGNORED
        
        
static currentmodel[32]
        
fm_get_user_model(idcurrentmodelcharsmax(currentmodel))
        if(!
equal(currentmodelg_player_model[id]) && !task_exists(id 100))
            
fm_set_user_model(id 100)
        return 
FMRES_IGNORED
    
}
    
    public 
fm_user_model_update(taskid)
    {
        static 
Float:current_time
        current_time 
get_gametime()
        
        if(
current_time g_models_target_time >= 0.5)
        {
            
fm_set_user_model(taskid)
            
g_models_target_time current_time
        
}
        else
        {
            
set_task((g_models_target_time 0.5) - current_time"fm_set_user_model"taskid)
            
g_models_target_time g_models_target_time 0.5
        
}
    }
    
    public 
fm_set_user_model(player)
    {
        
player -= 100
        engfunc
(EngFunc_SetClientKeyValueplayerengfunc(EngFunc_GetInfoKeyBufferplayer), "model"g_player_model[player])
        
g_has_custom_model[player] = true
    



RedRobster 07-24-2010 02:38

Re: [HELP] how to reset Terror deaths in next round?
 
On the first one, you don't pass an id in the set_task().

You are going to have to loop through all of the players and set the deaths there.

nikhilgupta345 07-24-2010 02:45

Re: [HELP] how to reset Terror deaths in next round?
 
Post the full code for the second one?

Also for the first one:

Code:

public event_round_start()
{
set_task(20.0, "reset_deaths")
}

public
reset_deaths() {
    new players[32], player, num
    get_players(players, num)
    for(new i;i<num;i++)
    {
    player=players[i]
    if(
cs_get_user_team(player) == CS_TEAM_T)
    {
       
cs_set_user_deaths (player, 1 )
    }

}



jc980 07-24-2010 03:06

Re: [HELP] how to reset Terror deaths in next round?
 
1 Attachment(s)
Quote:

Originally Posted by nikhilgupta345 (Post 1249830)
Post the full code for the second one?

Also for the first one:

Code:

public event_round_start()
{
set_task(20.0, "reset_deaths")
}

public
reset_deaths() {
    new players[32], player, num
    get_players(players, num)
    for(new i;i<num;i++)
    {
    player=players[i]
    if(
cs_get_user_team(player) == CS_TEAM_T)
    {
       
cs_set_user_deaths (player, 1 )
    }

}



thanks for the first one.

the whole code?

how about the sma file? will that do?


All times are GMT -4. The time now is 00:10.

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