public zx_extra_item_selected(player, itemid) { if (itemid == g_itemid_boost) { // Player frozen (or CS freezetime) if (pev(player, pev_maxspeed) <= 1) { client_print(player, print_chat, "[ZP] You can't use this item when frozen.") return ZP_PLUGIN_HANDLED; }
// Already using speed boost if (g_has_speed_boost[player]) { client_print(player, print_chat, "[ZP] You already have the speed boost.") return ZP_PLUGIN_HANDLED; }
// Remove speed boost task when infected, humanized, killed, or disconnected public zp_user_infected_pre(id, infector, nemesis) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) } public zp_user_humanized_pre(id, survivor) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) } public fw_PlayerKilled(victim) { g_has_speed_boost[victim] = false remove_task(victim+TASK_SPEED_BOOST) } public client_disconnect(id) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) }
// Remove speed boost at round start public event_round_start() { new id for (id = 1; id <= get_maxplayers(); id++) { g_has_speed_boost[id] = false remove_task(id+TASK_SPEED_BOOST) } }
public fw_ResetMaxSpeed_Post(id) { if (!is_user_alive(id) || !g_has_speed_boost[id]) return;