i ported this but it gave no errors at compiling but when i buy a parachute and wanna use it it doens't work
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
new bool:has_parachute[33]
new para_ent[33]
public plugin_init()
{
register_plugin("AMX Parachute", "0.1.1", "KRoT@L")
register_concmd("say buy_parachute", "buy_parachute")
register_cvar("parachute_cost", "2000")
}
public plugin_precache()
{
precache_model("models/parachute.mdl")
}
public client_connect(id)
{
has_parachute[id] = false
para_ent[id] = 0
}
public buy_parachute(id)
{
if(has_parachute[id])
{
client_print(id, print_chat, "[AMXX] You already have a parachute.")
return PLUGIN_HANDLED
}
new money = cs_get_user_money(id)
new cost = get_cvar_num("parachute_cost")
if(money < cost)
{
client_print(id, print_chat, "[AMXX] You don't have enough money ($%i needed).", cost)
return PLUGIN_CONTINUE
}
cs_set_user_money(id, money - cost)
client_print(id, print_chat, "[AMXX] You have bought a parachute. To use it, press +use while falling.")
has_parachute[id] = true
return PLUGIN_CONTINUE
}
public client_prethink(id)
{
if(!is_user_alive(id))
{
return PLUGIN_CONTINUE
}
if(has_parachute[id] || get_user_flags(id) & ADMIN_LEVEL_A)
{
if(get_user_button(id) & IN_USE)
{
if(!(get_user_oldbutton(id) & IN_USE))
{
para_ent[id] = create_entity("info_target")
if(para_ent[id] > 0)
{
entity_set_model(para_ent[id], "models/parachute.mdl")
}
}
if(!(get_entity_flags(id) & FL_ONGROUND))
{
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
if(velocity[2] < 0)
{
velocity[2] = (velocity[2] + 40.0 < -100) ? velocity[2] + 40.0 : -100.0
entity_set_vector(id, EV_VEC_velocity, velocity)
if(para_ent[id] > 0)
{
if(entity_get_float(para_ent[id], EV_FL_frame) < 0.0 || entity_get_float(para_ent[id], EV_FL_frame) > 254)
{
if(entity_get_int(para_ent[id], EV_INT_sequence) == 0)
{
entity_set_int(para_ent[id], EV_INT_sequence, 1)
}
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
}
else
{
entity_set_float(para_ent[id], EV_FL_frame, entity_get_float(para_ent[id], EV_FL_frame) + 1.0)
}
new Float:origin[3]
entity_get_vector(id, EV_VEC_origin, origin)
origin[2] -= 46.0
entity_set_vector(para_ent[id], EV_VEC_origin, origin)
}
}
else
{
if(para_ent[id] > 0)
{
remove_entity(para_ent[id])
para_ent[id] = 0
}
}
}
else
{
if(para_ent[id] > 0)
{
remove_entity(para_ent[id])
para_ent[id] = 0
}
}
}
else
{
if(para_ent[id] > 0)
{
remove_entity(para_ent[id])
para_ent[id] = 0
}
}
}
return PLUGIN_CONTINUE
}