AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawn with speed change (https://forums.alliedmods.net/showthread.php?t=49077)

Mini_Midget 12-27-2006 03:50

Spawn with speed change
 
I'm having problems making zombies(terrorists) spawn with a speed increase.
PHP Code:

new zomb_speed
public plugin_init() {
    
register_plugin(PLUGIN"2.0a"AUTHOR)
    
    
register_event("CurWeapon","event_cur_weapon","be")
    
    
zomb_speed register_cvar("zs_speed","500")
}

public 
event_cur_weapon(id) {
    if(!
is_user_alive(id) || !is_user_connected(id))
        return 
PLUGIN_CONTINUE
    
    
if(cs_get_user_team(id) == CS_TEAM_T) {
        
set_user_maxspeed(id,float(get_pcvar_num(zomb_speed)))
    }
    return 
PLUGIN_CONTINUE



The Specialist 12-27-2006 03:55

Re: Spawn with speed change
 
you dont need to make a float out of the pcvar use .:wink:
Code:
  get_pcvar_float()

Also , your using a weapon event to start a max speed . Bad way. The player might not change weapons or shoot etc etc for awhile . Using curweapon event should only be a back up to giving the speed on spawn. Which will make the speed flawless. Go to the tutorials section and use VEN's Spawn code to give speed. Also you could use fakemeta to give speed
Code:
pev(id,pev_maxspeed , get_pcvar_float(zomb_speed))

Mini_Midget 12-27-2006 14:52

Re: Spawn with speed change
 
ahh...
Yep cheers all good now


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

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