I don't get how to fix but respawn and speed add doesn't work, turbo works perfect but those two doesn't work
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Catch Mod Vip"
#define VERSION "1.0"
#define AUTHOR "Slimi.lt"
#define FLAG ADMIN_LEVEL_H
#define TID_RESP 2551
new cvar_speed;
new cvar_time;
new respawned[33];
new respawn[33];
new speed[33];
new turbos[33];
new wait = false
new team[32]
new turbo[32][2]
new choose[33];
new g_timeleft[33]
new g_max_players
new catch_t_speed;
new catch_speed,catch_f_speed,catch_o_speed,catch_l_speed
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
cvar_speed = register_cvar("speed_add", "200")
catch_speed = register_cvar("default_speed", "2.0")
catch_t_speed = register_cvar("turbo_add", "2.0")
catch_f_speed = register_cvar("catch_f_speed","1.0")
catch_o_speed = register_cvar("catch_o_speed","1.0")
catch_l_speed = register_cvar("catch_l_speed","1.15")
catch_t_speed = register_cvar("catch_t_speed","1.5")
register_event("CurWeapon", "event_cur_weapon", "be")
cvar_time = register_cvar("time_respawn", "5.0")
RegisterHam(Ham_Spawn, "player", "bacon_spawn", 1)
register_clcmd("say /vipmenu", "vipmenu")
register_logevent("round_end", 2, "1=Round_End")
register_logevent("round_start", 2, "1=Round_Start")
register_logevent("logevent_round_end", 2, "1=Round_End")
g_max_players = get_maxplayers()
}
public client_connect(client)
{
turbos[client] = 0;
respawned[client] = 0;
speed[client] = 0;
choose[client] = 0;
}
public client_disconnect(client)
{
turbos[client] = 0;
respawned[client] = 0;
speed[client] = 0;
choose[client] = 0;
}
public round_end(id)
{
turbos[id] = 0;
respawned[id] = 0;
speed[id] = 0;
choose[id] = 0;
}
public round_start(id)
{
turbos[id] = 0;
respawned[id] = 0;
speed[id] = 0;
choose[id] = 0;
}
public bacon_spawn(id)
{
if(!is_user_alive(id))
return;
if(get_user_flags(id) & FLAG)
{
vipmenu(id)
turbos[id] = 0;
respawned[id] = 0;
speed[id] = 0;
}
}
public vipmenu(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
new menu = menu_create("\rVip menu" , "Vip_Menu");
menu_additem(menu ,"\w200% Turbo", "1" , 0);
menu_additem(menu ,"\w200 Speed", "2" , 0);
menu_additem(menu ,"\r1 \wrespawn after death", "3" , 0);
menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
menu_display(id , menu , 0);
return PLUGIN_CONTINUE;
}
public Vip_Menu(id, menu, item, player)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
turbos[id] = 1;
respawn[id] = 0;
speed[id] = 0;
choose[id] = 1;
speedup(id);
}
case 2:
{
turbos[id] = 0;
respawn[id] = 1;
choose[id] = 1;
speed[id] = 0;
}
case 3:
{
turbos[id] = 0;
respawn[id] = 0;
choose[id] = 1;
speed[id] = 1;
}
}
menu_destroy(menu)
return PLUGIN_HANDLED;
}
public event_cur_weapon(id, player)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
if(speed[id] == 1)
{
static Float:speedas; speedas = get_pcvar_float(catch_speed) + get_pcvar_float(cvar_speed)
set_pev(id, pev_maxspeed, speedas)
}
return PLUGIN_CONTINUE
}
public speedup(id)
{
new Float:speed
if(team[id-1] == 1)
speed = 320.0 * get_pcvar_float(catch_speed) * get_pcvar_float(catch_f_speed)
else {
if(other_num() == 1 && !wait && get_playersnum() > 2)
speed = 320.0 * get_pcvar_float(catch_speed) * get_pcvar_float(catch_l_speed)
else
speed = 320.0 * get_pcvar_float(catch_speed) * get_pcvar_float(catch_o_speed)
}
if(turbo[id-1][0] == 1)
speed *= get_pcvar_float(catch_t_speed)
set_user_maxspeed(id,speed)
}
public other_num() {
new count = 0
for(new i=1;i<33;i++)
if(team[i-1] == 0 && is_user_connected(i) && is_user_alive(i))
count++
return count
}
public fwd_ClientKill(id)
{
if((respawned[id] == 0) && (respawn[id] == 1) && (get_user_flags(id) & FLAG))
{
static id
id = read_data(2)
if(!is_user_connected(id) || is_user_alive(id))
return
g_timeleft[id] = get_pcvar_num(cvar_time)
set_task(1.0, "count", TID_RESP+id)
if(is_user_bot(id))
return
}
}
public count(tid, id)
{
if((respawned[id] == 0) && (respawn[id] == 1) && (get_user_flags(id) & FLAG))
{
static id
id = tid-TID_RESP
if(!is_user_connected(id) || is_user_alive(id))
return
g_timeleft[id] -= 1
if(g_timeleft[id] <= 0){
set_pev(id,pev_deadflag,DEAD_RESPAWNABLE);
set_task(0.2, "respawna", id)
return
}else{
set_task(1.0, "count", TID_RESP+id)
}
if(is_user_bot(id))
return
}
}
public respawna(id)
{
if((respawned[id] == 0) && (respawn[id] == 1) && (get_user_flags(id) & FLAG))
{
if(!is_user_connected(id) || is_user_alive(id))
return
dllfunc(DLLFunc_Spawn, id)
respawned[id] = 1;
respawn[id] = 0;
}
}
public logevent_round_end(id)
{
new i
for(i=1; i<=g_max_players; i++){
if(task_exists(TID_RESP+i))
remove_task(TID_RESP+i)
}
}