- #include <zombie_escape>
- // Trail effect configs
- #define TRAIL_LIFE 2 // Life
- #define TRAIL_WIDTH 10 // Width
- #define TRAIL_RED 90 // Red color
- #define TRAIL_GREEN 200 // Green color
- #define TRAIL_BLUE 90 // Blue color
- #define TRAIL_ALPHA 220 // Alpha
- new g_pCvarSpeedAmount, g_pCvarBoostTime, g_pCvarSpeedBoostDelay
- new bool:g_bCanUseSB[33], g_iCoolDown_Time[33]
- new g_iSpeedTrail
- new const g_iSpeedSound[] = "zombie_escape/sprint.wav"
- public plugin_precache()
- {
- precache_sound(g_iSpeedSound)
- g_iSpeedTrail = precache_model("sprites/smoke.spr")
- }
- public plugin_init()
- {
- register_plugin("[ZE] Addons: Speed Boost", "1.0", "Jack GamePlay")
- register_clcmd("say /sb", "SpeedBoost")
- g_pCvarBoostTime = register_cvar("ze_boost_time", "3.0")
- g_pCvarSpeedAmount = register_cvar("ze_speed_amount", "450")
- g_pCvarSpeedBoostDelay = register_cvar("ze_speedboost_delay", "10.0")
- }
- public client_putinserver(id)
- {
- g_bCanUseSB[id] = false
- }
- public client_disconnected(id)
- {
- g_bCanUseSB[id] = false
- }
- public ze_user_infected(id)
- {
- if (!is_user_alive(id))
- return
- g_bCanUseSB[id] = true
- }
- public ze_user_humanized(id)
- {
- if (!is_user_alive(id))
- return
- g_bCanUseSB[id] = false
- }
- public SpeedBoost(id)
- {
- if (!is_user_alive(id))
- return PLUGIN_CONTINUE
- if (!ze_is_user_zombie(id))
- {
- ze_colored_print(id, "!tThis option is for !gzombies !tonly!y.")
- return PLUGIN_HANDLED
- }
- if (g_bCanUseSB[id])
- {
- g_bCanUseSB[id] = false
- ze_set_zombie_speed(id, get_pcvar_num(g_pCvarSpeedAmount))
- ze_colored_print(id, "!tYou got !y[!g%i!y] !tspeed for !y[!g%i!y] !tsec!y.", get_pcvar_num(g_pCvarSpeedAmount), floatround(get_pcvar_float(g_pCvarBoostTime)))
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
- write_byte(TE_BEAMFOLLOW)
- write_short(id)
- write_short(g_iSpeedTrail)
- write_byte(TRAIL_LIFE)
- write_byte(TRAIL_WIDTH)
- write_byte(TRAIL_RED)
- write_byte(TRAIL_GREEN)
- write_byte(TRAIL_BLUE)
- write_byte(TRAIL_ALPHA)
- message_end()
- emit_sound(id, CHAN_STREAM, g_iSpeedSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
- set_task(get_pcvar_float(g_pCvarBoostTime), "Remove_Boost", id)
- }
- return PLUGIN_CONTINUE
- }
- public Remove_Boost(id)
- {
- if (!is_user_alive(id) || !ze_is_user_zombie(id))
- return
- g_bCanUseSB[id] = false
- g_iCoolDown_Time[id] = floatround(get_pcvar_float(g_pCvarSpeedBoostDelay))
- ze_reset_zombie_speed(id)
- ze_colored_print(id, "!gSpeed boost has ended!y.")
- set_task(1.0, "ShowHUD", id, _, _, "a", g_iCoolDown_Time[id])
- set_task(get_pcvar_float(g_pCvarSpeedBoostDelay), "Allow_Again", id)
- }
- public ShowHUD(id)
- {
- if (!is_user_alive(id))
- return
- if (!g_bCanUseSB[id])
- {
- g_iCoolDown_Time[id] = g_iCoolDown_Time[id] - 1
- set_hudmessage(200, 200, 200, 0.75, 0.92, 0, 1.0, 1.1, 0.0, 0.0, -1)
- show_hudmessage(id, "Sprint cooldown: %i", g_iCoolDown_Time[id])
- }
- }
- public Allow_Again(id)
- {
- if (!is_user_alive(id) || !ze_is_user_zombie(id))
- return
- g_bCanUseSB[id] = true
- ze_colored_print(id, "!gSpeed boost can be used!y.")
- }
- }
This plugin gaves for zombies a little speed for few seconds.
I want it to be made for humans and the zombies can't use it and can be used one per round.