Raised This Month: $ Target: $400
 0% 

ResetHUD spawning model bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 12-13-2006 , 04:31   ResetHUD spawning model bug
Reply With Quote #1

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

Attached Thumbnails
Click image for larger version

Name:	bug.JPG
Views:	188
Size:	82.7 KB
ID:	12483  
__________________
It's a mystery.
Mini_Midget is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 12-14-2006 , 05:12   Re: ResetHUD spawning model bug
Reply With Quote #2

I don't understand why it shouldn't work. Does it work with the bots if they spawn at the right time??
mateo10 is offline
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 12-14-2006 , 08:12   Re: ResetHUD spawning model bug
Reply With Quote #3

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.
__________________
It's a mystery.
Mini_Midget is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 12-14-2006 , 08:43   Re: ResetHUD spawning model bug
Reply With Quote #4

I don't really know if this works but it compiles.

EDIT: Why do the other bots spawn later?
Attached Files
File Type: sma Get Plugin or Get Source (zombie_swarm.sma - 705 views - 1.3 KB)
mateo10 is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 12-14-2006 , 09:57   Re: ResetHUD spawning model bug
Reply With Quote #5

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).
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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