Raised This Month: $ Target: $400
 0% 

Virtual Reality


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-14-2009 , 01:28   Virtual Reality
Reply With Quote #1

Hey got some questions

Using ham or FM how do you get to see if player shot.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2009 , 01:29   Re: Virtual Reality
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?t=54887
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-14-2009 , 01:34   Re: Virtual Reality
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
That gets if gun is fired not if player is shot.

can you do something like

i get this error with that code

/home/groups/amxmodx/compiler3/core(0) : error 075: input line too long (after substitutions)
for lines 0 - 29
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>

#define MAX_PLAYERS 32
new limitreductiontoggle_pluginsaveslowbandaidcostarmbandcostlegpatchcost;
new 
bleeding[32] = 0
new legshot[32] = 0
new usedbandaid[32] = 0
new armshot[32] = 0
public plugin_init() 
{
 
register_plugin("Virtual Reality","1.0","NcB_Sav");
 
//Extra Item Costs
 
bandaidcost register_cvar("vr_bandaid""500"// Bandaid costs
 //armbandcost = register_cvar("vr_armband", "500") // Arm band costs
 
legpatchcost register_cvar("vr_legband""500"// Leg band costs
 
slow register_cvar("vr_slow""50.0"// Slower with leg shot
 
 
reduction register_cvar("vr_reduction""1");
 
toggle_plugin register_cvar("vr_mod","1");
 
limit register_cvar("vr_limit""65");
 
save register_cvar("vr_stop" "10");
 
 
RegisterHam(Ham_Spawn"player""playerspawn"1)
 
 
register_event("Damage""damage_msg""b""2!0""3=0""4!0")
 
register_event("DeathMsg""death_msg""a")
 
 
register_logevent("round_end"2"1=Round_End")
 
 
//Checks for leg shot
 
RegisterHam(Ham_TraceAttack"player""ham_traceattack_player")
 
  
//Extra Item Costs
 
bandaidcost register_cvar("vr_bandaid""500"// Bandaid costs
 //armbandcost = register_cvar("vr_armband", "500") // Arm band costs
 
legpatchcost register_cvar("vr_legband""500"// Leg band costs
 
 //Client cmds
 
register_clcmd("say /bandaid""bandaid"// Use bandaid
 
register_clcmd("say /legpatch""legpatch1"//Use Legpatch
 //register_clcmd("say /armband", "armband1") // Use Armband
 
}
public 
damage_msg(victim)
{
 new 
attacker get_user_attacker(victim)
 
 if (!
attacker || !is_user_alive(victim) || bleeding[victim] > 1)
  return;
 
 if(
get_user_health(victim) > get_pcvar_num(limit))
  return;
 
 if(
get_pcvar_num(toggle_plugin))
 {
  
set_task(1.0,"victim_stuff"victim+35435,"",0"b")
 }
}
public 
death_msg()
{
 new 
victim read_data(2)
 
 if(
task_exists(victim+35435))
  
remove_task(victim+35435);
}
public 
victim_stuff(taskid)
{
 new 
victim taskid 35435;
 
 new 
health get_user_health(victim);
 
 if(
health get_pcvar_num(save))
  
remove_task(victim+35435);
 
 
set_user_health(victimhealth get_pcvar_num(reduction));
 ++
bleeding[victim]
 
 new 
iOrigin[3]
 
get_user_origin(victim,iOrigin)
 
 
fx_bleed(iOrigin)
}
public 
round_end()
{
 new 
players[32], num
 get_players
(playersnum)
 
 new 
player
 
for(new 0numi++)
 {
  
player players[i]
  
  if(
task_exists(player+35435))
   
remove_task(player+35435);
 }
}
public 
fx_bleed(origin[3])
{
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
 
write_byte(TE_BLOODSTREAM);
 
write_coord(origin[0]);
 
write_coord(origin[1]);
 
write_coord(origin[2]+10);
 
write_coord(random_num(-360,360));
 
write_coord(random_num(-360,360));
 
write_coord(-10);
 
write_byte(70);
 
write_byte(random_num(50,100));
 
message_end()
}
 
public 
stopbleeding(id
{
 
bleeding[id] = 0
}
public 
playerspawn(id)
{
 if(
is_user_alive(id))
 {
  
stopbleeding(id)
  
bleeding[id] = 0
  armshot
[id] = 0
  legshot
[id] = 0
  usedbandaid
[id] = 0
 
}
}
public 
ham_traceattack_player(iVictimiAttackerFloat:damageFloat:direction[3], traceresultdamagebitsid)
{
 if(
get_tr2(traceresultTR_iHitgroup) == HIT_LEFTLEG || get_tr2(traceresultTR_iHitgroup) == HIT_RIGHTLEG)
 {
  
slowdown(id)
  ++
legshot[id]
 }
 
/*else (get_tr2(traceresult, TR_iHitgroup) == HIT_LEFTARM ||get_tr2(traceresult, TR_iHitgroup) == HIT_RIGHTARM && armshot <= 2)
 {
  shake(id)
  ++armshot[id]
 }*/
 
return HAM_IGNORED
}
/*public shake(id)
{
 if(armshot == 1 )
 {
 message_begin(MSG_SCREENSHAKE);
 write_short(1<<12);
 write_short(3<<12);
 write_short(10<<12);
 message_end()
 }
}*/
public slowdown(id)
{
 new 
Float:speed get_user_maxspeed(id) - slow;
 if(
legshot[id] == 1)
 {
  
set_user_maxspeed(idspeed)
 }
 else(
legshot[id] == 2)
 {
  
set_user_maxspeed(idspeed)
 }
 else(
legshot[id] >= 3)
 {
  return 
HAM_IGNORED
 
}
}
public 
bandaid(id)
{
 new 
oldmoney get_user_money(id)
 if(
bleeding[id] && usedbandaid[id] == 0)
 {
  
event_player_spawn(id)
  
set_user_money(oldmoney bandaidcost)
  ++
usedbandaid[id]
 }
 else(
usedbandaid[id])
 {
  
client_print(idprint_chat"[Virtual Reality] You have used your only bandaid for this round.")
 }
 else(
isbleeding[id] = 0)
 {
  
client_print(idprint_chat"[Virtual Reality] you are not bleeding.")
 }

/*public armband1(id)
{
 new oldmoney = get_user_money(id)
 if(armband[id] == 0)
 {
  set_user_money(id, oldmoney - armbandcost)
  client_print(id, print_chat, "[Virtual Reality] You have one Armband left")
  ++armband[id]
 }
 else(armband[id] == 1)
 {
  set_user_money(id, oldmoney - armbandcost)
  client_print(id, print_chat, "[Virtual Reality] You have 0 Armband's left")
  ++armband[id]
 }
 else(armband[id] == 2)
 {
  client_print(id, print_chat, "[Virtual Reality] You Have used all of your Armbands")
 }
}*/
public legpatch1(id)
{
 new 
oldmoney get_user_money(id)
 new 
Float:speed get_user_maxspeed(id) + slow;
 if(
legpatch[id] == && legshot[id] >= 1)
 {
  
set_user_money(idoldmoney legpatchcost)
  
set_user_maxspeed(idspeed)
  
client_print(idprint_chat"[Virtual Reality] You have one Legpatch left")
  ++
legpatch[id]
 }
 else(
legpatch[id] == 1)
 {
  
set_user_money(idoldmoney legpatchcost)
  
set_user_maxspeed(idspeed)
  
client_print(idprint_chat"[Virtual Reality] You have 0 Legpatch's left")
  ++
legpatch[id]
 }
 else(
legpatch[id] == 2)
 {
  
client_print(idprint_chat"[Virtual Reality] You Have used all of your Legpatch's")
 }


Last edited by Doc-Holiday; 01-14-2009 at 04:47.
Doc-Holiday is offline
Reply



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 01:42.


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