/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <nvault>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Rendszergazda"
#define PARACHUTE_LEVEL ADMIN_ALL
#define FL_WATERJUMP (1<<11)
#define FL_ONGROUND (1<<9)
new points[33];
new pBunny, pMulti, pParac, pAK, pM4, pAWP, pVIP
new gBunny[33], gMulti[33], gVIP[33];
new g_vault
new jumpnum[33] = 0
new bool:dojump[33] = false
new has_parachute[33]
new para_ent[33]
new gCStrike = 0
new pDetach, pFallSpeed, pEnabled;
public client_connect(id)
{
LoadInformation(id);
if(gVIP[id])
{
gBunny[id] = true; gMulti[id] = true; has_parachute[id] = true;
}
}
public client_disconnect(id)
{
SaveInformation(id);
}
public client_PreThink(id)
{
bunny(id);
multi(id);
parac(id);
}
public parac(id)
{
if (!get_pcvar_num(pEnabled)) return
if (!is_user_alive(id) || !has_parachute[id]) return
new Float:fallspeed = get_pcvar_float(pFallSpeed) * -1.0
new Float:frame
new button = get_user_button(id)
new oldbutton = get_user_oldbutton(id)
new flags = get_entity_flags(id)
if (para_ent[id] > 0 && (flags & FL_ONGROUND)) {
if (get_pcvar_num(pDetach)) {
if (get_user_gravity(id) == 0.1) set_user_gravity(id, 1.0)
if (entity_get_int(para_ent[id],EV_INT_sequence) != 2) {
entity_set_int(para_ent[id], EV_INT_sequence, 2)
entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
return
}
frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
entity_set_float(para_ent[id],EV_FL_fuser1,frame)
entity_set_float(para_ent[id],EV_FL_frame,frame)
if (frame > 254.0) {
remove_entity(para_ent[id])
para_ent[id] = 0
}
}
else {
remove_entity(para_ent[id])
set_user_gravity(id, 1.0)
para_ent[id] = 0
}
return
}
if (button & IN_USE) {
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
if (velocity[2] < 0.0) {
if(para_ent[id] <= 0) {
para_ent[id] = create_entity("info_target")
if(para_ent[id] > 0) {
entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
entity_set_edict(para_ent[id], EV_ENT_aiment, id)
entity_set_edict(para_ent[id], EV_ENT_owner, id)
entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_model(para_ent[id], "models/parachute.mdl")
entity_set_int(para_ent[id], EV_INT_sequence, 0)
entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
}
}
if (para_ent[id] > 0) {
entity_set_int(id, EV_INT_sequence, 3)
entity_set_int(id, EV_INT_gaitsequence, 1)
entity_set_float(id, EV_FL_frame, 1.0)
entity_set_float(id, EV_FL_framerate, 1.0)
set_user_gravity(id, 0.1)
velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
entity_set_vector(id, EV_VEC_velocity, velocity)
if (entity_get_int(para_ent[id],EV_INT_sequence) == 0) {
frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
entity_set_float(para_ent[id],EV_FL_fuser1,frame)
entity_set_float(para_ent[id],EV_FL_frame,frame)
if (frame > 100.0) {
entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
entity_set_int(para_ent[id], EV_INT_sequence, 1)
entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
}
}
}
}
else if (para_ent[id] > 0) {
remove_entity(para_ent[id])
set_user_gravity(id, 1.0)
para_ent[id] = 0
}
}
else if ((oldbutton & IN_USE) && para_ent[id] > 0 ) {
remove_entity(para_ent[id])
set_user_gravity(id, 1.0)
para_ent[id] = 0
}
}
public multi(id)
{
if(!is_user_alive(id) && !gMulti[id]) return PLUGIN_CONTINUE
new nbut = get_user_button(id)
new obut = get_user_oldbutton(id)
if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
{
if(jumpnum[id] < 1)
{
dojump[id] = true
jumpnum[id]++
return PLUGIN_CONTINUE
}
}
if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
jumpnum[id] = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if(!is_user_alive(id) && !gMulti[id]) return PLUGIN_CONTINUE
if(dojump[id] == true)
{
new Float:velocity[3]
entity_get_vector(id,EV_VEC_velocity,velocity)
velocity[2] = random_float(265.0,285.0)
entity_set_vector(id,EV_VEC_velocity,velocity)
dojump[id] = false
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public bunny(id)
{
if (!gBunny[id])
return PLUGIN_CONTINUE
entity_set_float(id, EV_FL_fuser2, 0.0)
if (!gBunny[id])
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)
}
return PLUGIN_CONTINUE
}
public plugin_natives()
{
set_module_filter("module_filter")
set_native_filter("native_filter")
}
public module_filter(const module[])
{
if (!cstrike_running() && equali(module, "cstrike")) {
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public native_filter(const name[], index, trap)
{
if (!trap) return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public plugin_precache()
{
precache_model("models/parachute.mdl")
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("DeathMsg", "onDeath", "a", "1>0");
register_clcmd("say /menu", "menu");
register_clcmd("say_team /menu", "menu");
register_clcmd("/menu", "menu");
register_clcmd("menu", "menu");
pBunny = register_cvar("ps_bunny_cost", "50");
pMulti = register_cvar("ps_multi_cost", "100");
pParac = register_cvar("ps_parac_cost", "50");
pAK = register_cvar("ps_ak_cost", "7");
pM4 = register_cvar("ps_m4_cost", "10");
pAWP = register_cvar("ps_awp_cost", "20");
pVIP = register_cvar("ps_vip_cost", "800");
pEnabled = register_cvar("sv_parachute", "1" )
pFallSpeed = register_cvar("parachute_fallspeed", "100")
pDetach = register_cvar("parachute_detach", "1")
if (gCStrike)
{
register_concmd("amx_parachute", "admin_give_parachute", PARACHUTE_LEVEL, "<nick, #userid or @team>" )
}
}
public onDeath()
{
new killer = read_data(1);
new victim = read_data(2);
if(killer != victim)
{
points[killer]++
set_hudmessage(0, 255, 0, 0.05, 0.88, 2, 6.0, 12.0)
show_hudmessage(killer, "Kaptal 1 pontot! Menuhoz ird be, hogy /menu.")
}
}
public menu(id)
{
new menu = menu_create("Valassz targyat!", "handler");
menu_additem(menu, "Bunnyhop", "0", 0);
menu_additem(menu, "Dupla ugras", "1", 0);
menu_additem(menu, "Ejtoernyo", "2", 0);
menu_additem(menu, "AK-47 Kalasnikov", "3", 0);
menu_additem(menu, "M4A1 Colt", "4", 0);
menu_additem(menu, "AWP Magnum Sniper", "5", 0);
menu_additem(menu, "*V.I.P.*", "6", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu);
}
public handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
}
new szCommand[6] , szName[64]; new access , callback;
menu_item_getinfo(menu , item , access , szCommand , 5 , szName , 63 , callback);
new i = str_to_num(szCommand)
switch(i)
{
case 0:
{
if(points[id] >= get_pcvar_num(pBunny))
{
gBunny[id] = true;
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(pBunny));
}
else
{
set_hudmessage(255, 0, 0, 0.30, 0.41, 1, 6.0, 4.0)
show_hudmessage(id, "Nincs eleg penzed a vasarlashoz!")
}
}
case 1:
{
if(points[id] >= get_pcvar_num(pMulti))
{
gMulti[id] = true;
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(pMulti));
}
else
{
set_hudmessage(255, 0, 0, 0.30, 0.41, 1, 6.0, 4.0)
show_hudmessage(id, "Nincs eleg penzed a vasarlashoz!")
}
}
case 2:
{
if(points[id] >= get_pcvar_num(pParac))
{
has_parachute[id] = true;
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(pParac));
}
else
{
set_hudmessage(255, 0, 0, 0.30, 0.41, 1, 6.0, 4.0)
show_hudmessage(id, "Nincs eleg penzed a vasarlashoz!")
}
}
case 3:
{
if(points[id] >= get_pcvar_num(pAK))
{
give_item(id, "weapon_ak47");
give_item(id, "ammo_762nato");
give_item(id, "ammo_762nato");
give_item(id, "ammo_762nato");
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(pAK));
}
else
{
set_hudmessage(255, 0, 0, 0.30, 0.41, 1, 6.0, 4.0)
show_hudmessage(id, "Nincs eleg penzed a vasarlashoz!")
}
}
case 4:
{
if(points[id] >= get_pcvar_num(pM4))
{
give_item(id, "weapon_m4a1");
give_item(id, "ammo_556nato");
give_item(id, "ammo_556nato");
give_item(id, "ammo_556nato");
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(pM4));
}
else
{
set_hudmessage(255, 0, 0, 0.30, 0.41, 1, 6.0, 4.0)
show_hudmessage(id, "Nincs eleg penzed a vasarlashoz!")
}
}
case 5:
{
if(points[id] >= get_pcvar_num(pAWP))
{
give_item(id, "weapon_awp");
give_item(id, "ammo_338magnum");
give_item(id, "ammo_338magnum");
give_item(id, "ammo_338magnum");
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(pAWP));
}
else
{
set_hudmessage(255, 0, 0, 0.30, 0.41, 1, 6.0, 4.0)
show_hudmessage(id, "Nincs eleg penzed a vasarlashoz!")
}
}
case 6:
{
if(points[id] >= get_pcvar_num(pVIP))
{
gVIP[id] = true;
gBunny[id] = true; gMulti[id] = true; has_parachute[id] = true;
cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(pVIP));
}
else
{
set_hudmessage(255, 0, 0, 0.30, 0.41, 1, 6.0, 4.0)
show_hudmessage(id, "Nincs eleg penzed a vasarlashoz!")
}
}
}
}
public LoadInformation(id)
{
new name[32]
get_user_name(id, name, 31)
new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%sPONTSYSTEM", name)
format(vaultdata,255,"%i#%i#%i#%i#", gBunny[id], gMulti[id], gVIP[id], has_parachute[id])
nvault_get(g_vault,vaultkey,vaultdata,255)
replace_all(vaultdata, 255, "#", " ")
new nbunny[33], nmulti[33], nvip[33], nparac[33];
parse(vaultdata, nbunny, 32, nmulti, 32, nvip, 32, nparac, 32)
gBunny[id] = str_to_num(nbunny)
gMulti[id] = str_to_num(nmulti)
gVIP[id] = str_to_num(nvip)
has_parachute[id] = str_to_num(nparac)
return PLUGIN_CONTINUE
}
public SaveInformation(id)
{
new name[32]
get_user_name(id, name, 31)
new vaultkey[64],vaultdata[256]
format(vaultkey,63,"%sPONTSYSTEM", name)
format(vaultdata,255,"%i#%i#%i#%i#", gBunny[id], gMulti[id], gVIP[id], has_parachute[id])
nvault_set(g_vault,vaultkey,vaultdata)
return PLUGIN_CONTINUE
}