AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ResetHUD spawning model bug (https://forums.alliedmods.net/showthread.php?t=48495)

Mini_Midget 12-13-2006 04:31

ResetHUD spawning model bug
 
1 Attachment(s)
Whenever I start a new game with bots
They usually come all together in the game at once and join a team and spawn.
The problem I have is when the bots spawn a bit late. Their models do not change but there hp do.
PHP Code:

#define PLUGIN "Zombie Swarm"
#define AUTHOR "Mini_Midget"


#define MAX_PLAYERS 32
new bool:g_restart_attempt[MAX_PLAYERS 1]

//Pcvars...
new zomb_hpzomb_apzomb_speed


public plugin_init() {
    
register_plugin(PLUGIN"2.0"AUTHOR)
        
    
register_event("ResetHUD","event_hud_reset""be")
    
register_clcmd("fullupdate","clcmd_fullupdate"
    
register_event("TextMsg","event_restart_attempt""a""2=#Game_will_restart_in")
    
    
zomb_hp register_cvar("zs_health","550")
    
zomb_ap register_cvar("zs_armour","200")
}


public 
plugin_precache() {
    
precache_model("models/player/zombie_swarm/zombie_swarm.mdl")
}

public 
clcmd_fullupdate() {
    return 
PLUGIN_HANDLED
}

public 
event_restart_attempt() {
    new 
players[32], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_restart_attempt[players[i]] = true
}

public 
event_hud_reset(id) {
    if (
g_restart_attempt[id]) {
        
g_restart_attempt[id] = false
        
return
    }
    
    
event_player_spawn(id)
}

public 
event_player_spawn(id) {
    new 
CsTeams:team cs_get_user_team(id)
    new 
CsArmorType:ArmorType CS_ARMOR_VESTHELM
    
    
if(!is_user_alive(id) || !is_user_connected(id))
        return 
PLUGIN_CONTINUE
    
    
if(team == CS_TEAM_T)
    {
        
cs_set_user_model(id,"zombie_swarm")
        
set_user_health(id,get_pcvar_num(zomb_hp))
        
cs_set_user_armor(id,get_pcvar_num(zomb_ap),ArmorType)
        
set_user_gravity(id,0.75)
        
set_user_footsteps(id,1)
        
cs_set_user_money(id,0)
        
    } 
    else 
    {
        
cs_reset_user_model(id)
        
set_user_gravity(id,1.25)
        
cs_set_user_money(idcs_get_user_money(id) + 1200)
    }
    return 
PLUGIN_CONTINUE



mateo10 12-14-2006 05:12

Re: ResetHUD spawning model bug
 
I don't understand why it shouldn't work. Does it work with the bots if they spawn at the right time??

Mini_Midget 12-14-2006 08:12

Re: ResetHUD spawning model bug
 
when the round starts
after 2-3 secs, the rest of the bots which are joining don't change their models but the ones earlier do.

mateo10 12-14-2006 08:43

Re: ResetHUD spawning model bug
 
1 Attachment(s)
I don't really know if this works but it compiles.

EDIT: Why do the other bots spawn later?

dutchmeat 12-14-2006 09:57

Re: ResetHUD spawning model bug
 
Ehm, in each game the bots spawn after a few seconds, the reason why the other bots don't have models/ and proberly doesn't have the health modification, is because
'g_restart_attempt[id]' is resetted after the roundrestart(the earlier bots are included in this session).


All times are GMT -4. The time now is 06:58.

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