2. Jeżeli abh jest włączone to po wpisaniu /bh będzie menu: Wyłączyć auto bh? 1. Tak 2. Nie
3. Menu pojawia się po 5s od dołączenia do gry, nie po ok 20.
Tutaj znajduje się kod:
#include <amxmodx>
#include <engine>
#include <colorchat>
#define FL_WATERJUMP (1<<11)
#define FL_ONGROUND (1<<9)
#define autobhopkeys (1<<0)|(1<<1)
new bool:bhop_enabled[33]
public plugin_init()
{
register_plugin("Bunny Hop", "1.0", "CheesyPeteza & Lucky")
register_menucmd(register_menuid("autobhop"), autobhopkeys, "autobhopselect")
register_clcmd("say /bhop", "say /bh")
register_clcmd("say_team /bhop", "say /bh")
set_task(120.0, "autobhop_advert", 100, _, _, "b")
}
public autobhop_advert(id)
{
ColorChat(0, BLUE, "^4[Volta-sq.pl]^3 Wpisz^4 /bh^3, aby wlaczyc^4 auto bh!")
}
public client_connect(id)
{
bhop_enabled[id] = false
set_task(20.0, "autobhop_menu", id)
}
public autobhop_menu(id)
{
show_menu(id, autobhopkeys, "Wlaczyc auto bh?^n^n1. Tak^n2. Nie^n", -1, "autobhop")
}
public autobhopselect(id, key)
{
if(key == 0)
{
bhop_enabled[id] = true
}
else if(key == 1)
{
bhop_enabled[id] = false
}
}
public client_PreThink(id)
{
if(bhop_enabled[id] == true)
{
entity_set_float(id, EV_FL_fuser2, 0.0)
if (entity_get_int(id, EV_INT_button) & 2)
{
new flags = entity_get_int(id, EV_INT_flags)
if (flags & FL_WATERJUMP)
return PLUGIN_CONTINUE
if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
return PLUGIN_CONTINUE
if ( !(flags & FL_ONGROUND) )
return PLUGIN_CONTINUE
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
velocity[2] += 250.0
entity_set_vector(id, EV_VEC_velocity, velocity)
entity_set_int(id, EV_INT_gaitsequence, 6)
}
}
return PLUGIN_CONTINUE
}