Raised This Month: $ Target: $400
 0% 

parachute


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Vegetaz
Member
Join Date: Oct 2006
Old 02-03-2007 , 08:42   parachute
Reply With Quote #1

ok i got this Krotal's plugin, its realy awesome, but it REALY pisses me off to buy the parachute every time you die, so i was thinking, why not making it like 10k for parachute, but u dont loose it on death...
anyway heres the code, i realy would apriciate if some1 would give theyr time to lightly modify it..:
Code:
/***************************************************************************************************
AMX Parachute
Version: 0.1.8
Author: KRoTaL
0.1 Release
0.1.1 Players can't buy a parachute if they already own one
0.1.2 Minor changes
0.1.3 Players lose their parachute if they die
0.1.4 Added amx_parachute cvar
0.1.5 Changed set_origin to movetype_follow (you won't see your own parachute)
0.1.6 Added sell_parachute command
0.1.7 Added parachute_payback cvar
0.1.8 Added say give_parachute and parachute_fallspeed cvar
Plays the release animation when you touch the ground
 
Commands:
say/say_team buy_parachute - buys a parachute
say/say_team sell_parachute - sells your parachute (75% of the purchase price)
say/say_team give_parachute <name/#userid/authid> - gives your parachute to the player
Press +use to slow down your fall.
 
Cvars:
amx_parachute "1" - 0: disables the plugin
1: enables the plugin
parachute_cost "1000" - cost of the parachute
parachute_payback "75" - how many percent of the parachute cost you get when you sell your parachute
(ie. (75/100) * 1000 = 750$)
parachute_fallspeed "100" - speed of the fall when you use the parachute
 
Setup:
Install the amx file.
Enable VexdUM.
Put the parachute.mdl file in the cstrike/models folder.
 
***************************************************************************************************/
#include <amxmod>
#include <amxmisc>
#include <fun>
#include <VexdUM>
#include <VexdUM_stock>
new bool:has_parachute[33]
new para_ent[33]
new g_maxplayers
public plugin_init()
{
register_plugin("AMX Parachute", "0.1.8", "KRoT@L")
register_concmd("say", "handleSay")
register_concmd("say_team", "handleSay")
register_cvar("amx_parachute", "1")
register_cvar("parachute_cost", "10000")
register_cvar("parachute_payback", "75")
register_cvar("parachute_fallspeed", "100")
register_event("ResetHUD", "resethud_event", "be")
register_event("DeathMsg", "death_event", "a")
 
g_maxplayers = get_maxplayers() + 1
}
public plugin_precache()
{
precache_model("models/parachute.mdl")
}
public client_connect(id)
{
if(para_ent[id] > 0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
}
has_parachute[id] = false
para_ent[id] = 0
}
public resethud_event(id)
{
if(para_ent[id] > 0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
para_ent[id] = 0
}
}
public death_event()
{
new id = read_data(2)
if(is_user_connected(id))
{
if(para_ent[id] > 0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
}
has_parachute[id] = false
para_ent[id] = 0
}
}
public buy_parachute(id)
{
if(!is_user_connected(id)) return PLUGIN_CONTINUE
if(get_cvar_num("amx_parachute") == 0)
{
client_print(id, print_chat, "[AMX] Parachute plugin is disabled.")
return PLUGIN_HANDLED
}
if(has_parachute[id])
{
client_print(id, print_chat, "[AMX] You already have a parachute.")
return PLUGIN_HANDLED
}
new money = get_user_money(id)
new cost = get_cvar_num("parachute_cost")
if(money < cost)
{
client_print(id, print_chat, "[AMX] You don't have enough money ($%i needed).", cost)
return PLUGIN_CONTINUE
}
set_user_money(id, money - cost)
client_print(id, print_chat, "[AMX] You have bought a parachute. To use it, press +use while falling.")
has_parachute[id] = true
return PLUGIN_CONTINUE
}
public sell_parachute(id)
{
if(!is_user_connected(id)) return PLUGIN_CONTINUE
if(has_parachute[id])
{
if(para_ent[id] > 0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
}
has_parachute[id] = false
para_ent[id] = 0
new money = get_user_money(id)
new cost = get_cvar_num("parachute_cost")
set_user_money(id, money + floatround(float(cost)*(get_cvar_float("parachute_payback")/100)))
client_print(id, print_chat, "[AMX] You have sold your parachute.")
}
else
{
client_print(id, print_chat, "[AMX] You can't sell your parachute, you don't have one!")
}
return PLUGIN_CONTINUE
}
public handleSay(id)
{
if(!is_user_connected(id)) return PLUGIN_CONTINUE
new args[128]
read_args(args, 127)
while(replace(args, 127, "^"", "")) {}
if(equali(args, "give_parachute", 14))
{
if(has_parachute[id])
{
copy(args, 127, args[15])
new player = cmd_target(id, args, 0)
if(!player || player == id) return PLUGIN_HANDLED
new id_name[32], pl_name[32]
get_user_name(id, id_name, 31)
get_user_name(player, pl_name, 31)
if(has_parachute[player])
{
client_print(id, print_chat, "[AMX] %s already has a parachute.", pl_name)
return PLUGIN_CONTINUE
}
if(para_ent[id] > 0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
}
has_parachute[id] = false
para_ent[id] = 0
has_parachute[player] = true
client_print(id, print_chat, "[AMX] You have given your parachute to %s.", pl_name)
client_print(player, print_chat, "[AMX] %s has given his parachute to you.", id_name)
}
else
{
client_print(id, print_chat, "[AMX] You can't give your parachute, you don't have one!")
}
}
else if(equali(args, "buy_parachute", 13))
{
buy_parachute(id)
}
else if(equali(args, "sell_parachute", 14))
{
sell_parachute(id)
}
return PLUGIN_CONTINUE
}
public server_frame()
{
if(get_cvar_num("amx_parachute") == 0)
{
return PLUGIN_CONTINUE
}
new button, oldbutton, flags
new Float:speed
new Float:fallspeed = get_cvar_float("parachute_fallspeed")
new Float:frame
for(new id = 1; id < g_maxplayers; id++)
{
if(!is_user_alive(id))
{
continue
}
if(has_parachute[id])
{
button = get_user_button(id)
oldbutton = get_user_oldbutton(id)
flags = get_entity_flags(id)
if(button & IN_USE)
{
if(!(flags & FL_ONGROUND))
{
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
if(velocity[2] < 0)
{
if(para_ent[id] == 0)
{
para_ent[id] = create_entity("info_target")
if(para_ent[id] > 0)
{
entity_set_model(para_ent[id], "models/parachute.mdl")
entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_edict(para_ent[id], EV_ENT_aiment, id)
}
}
if(para_ent[id] > 0)
{
speed = fallspeed * -1.0
velocity[2] = (velocity[2] + 40.0 < speed) ? velocity[2] + 40.0 : speed
entity_set_vector(id, EV_VEC_velocity, velocity)
frame = entity_get_float(para_ent[id], EV_FL_frame)
if(frame < 0.0 || frame > 254.0)
{
if(entity_get_int(para_ent[id], EV_INT_sequence) != 1)
{
entity_set_int(para_ent[id], EV_INT_sequence, 1)
}
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
}
else
{
if(entity_get_float(para_ent[id], EV_FL_fuser1) != 0.0)
{
entity_set_int(para_ent[id], EV_INT_sequence, 0)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
continue
}
entity_set_float(para_ent[id], EV_FL_frame, frame + 1.0)
}
}
}
else
{
if(para_ent[id] > 0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
para_ent[id] = 0
}
}
}
}
else if(oldbutton & IN_USE && !(flags & FL_ONGROUND))
{
if(para_ent[id] > 0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
para_ent[id] = 0
}
}
if(flags & FL_ONGROUND && para_ent[id] > 0)
{
frame = entity_get_float(para_ent[id], EV_FL_fuser1)
if(frame == 254.0)
{
if(is_entity(para_ent[id])) remove_entity(para_ent[id])
para_ent[id] = 0
continue
}
if(frame == 0.0)
{
entity_set_int(para_ent[id], EV_INT_sequence, 2)
}
frame += 1.0
entity_set_float(para_ent[id], EV_FL_fuser1, frame)
entity_set_float(para_ent[id], EV_FL_frame, frame)
}
}
}
return PLUGIN_CONTINUE
}
Vegetaz is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode