4percel beelőztél

Kód:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <colorchat>
#define FL_WATERJUMP (1<<11) // popping out of the water
#define FL_ONGROUND (1<<9) // not moving on the ground
new Delay[33]
new valasztas[2]
new is = 1
new cvar
public plugin_init() {
register_plugin("Bhop&Szavazas", "1.0", "homorapian&kiki33")
register_cvar("sbhopper_version", "1.0", FCVAR_SERVER)
cvar = register_cvar("amx_bhopszavazas", "1")
register_cvar("bh_enabled", "0")
register_cvar("bh_autojump", "0")
register_cvar("bh_showusage", "0")
register_menucmd(register_menuid("menu_1"),(1<<0)|(1<<1),"jelenlegi_szavazas")
set_task(30.0,"menu2");
is = 1
}
public szavazas() {
if (get_pcvar_num(cvar) == 1)
{
show_menu(0,(1<<0)|(1<<1), "Szeretnel BunnyHoppot??^n^n1: Igen^n2: Nem", 15, "menu_1")
set_task(15.0,"szavazas_eredmeny")
valasztas[0] = 0
valasztas[1] = 0
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public szavazas_eredmeny(id){
if (valasztas[0] >= valasztas[1]){
server_cmd("bh_enabled 1")
server_cmd("bh_autojump 1")
server_cmd("bh_showusage 1")
server_cmd("sv_restart 1")
ColorChat(id, RED, "[SERVER]^x04BunnyHopp Bekapcsolva (Legyen ^"%d^") (Ne legyen ^"%d^"). *",valasztas[0],valasztas[1]);
is = 1
} else {
server_cmd("bh_enabled 0")
server_cmd("bh_autojump 0")
server_cmd("bh_showusage 0")
server_cmd("sv_restart 1")
ColorChat(id, RED, "[SERVER]^x04BunnyHopp NEM lett bekapcsolva. (Legyen ^"%d^") (Ne legyen ^"%d^"). *",valasztas[0],valasztas[1]);
is = 0
}
return PLUGIN_CONTINUE
}
public jelenlegi_szavazas(id,key){
new name[32]
get_user_name(id,name,31)
new what[6] = "Igen"
if (key == 1) what = "Nem"
ColorChat(id, RED, "[SERVER]^x04Szavazatod: %s", what);
++valasztas[key]
return PLUGIN_HANDLED
}
public menu2(id,level,cid) {
if (get_pcvar_num(cvar) == 1)
{
if (!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED
}
szavazas()
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public client_PreThink(id) {
if (!get_cvar_num("bh_enabled"))
return PLUGIN_CONTINUE
entity_set_float(id, EV_FL_fuser2, 0.0) // Won't slow down after a jump
if (!get_cvar_num("bh_autojump"))
return PLUGIN_CONTINUE
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) // Jump graphics
}
return PLUGIN_CONTINUE
}
public client_authorized(id)
set_task(30.0, "showUsage", id)
public showUsage(id) {
if ( !get_cvar_num("bh_enabled") || !get_cvar_num("bh_showusage") )
return PLUGIN_HANDLED
if ( !get_cvar_num("bh_autojump") ) {
client_print(id, print_chat, "[AMXX] B-hopping is enabled on this server. You will not slow down after jumping. By homorapian")
} else {
client_print(id, print_chat, "[AMXX] B-hopping is enabled on this server. Just hold down jump to bunny hop. By homorapian")
}
return PLUGIN_HANDLED
}