AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ghost Touch to damage event HELP (https://forums.alliedmods.net/showthread.php?t=92287)

dstopgunner 05-13-2009 00:40

Ghost Touch to damage event HELP
 
Hello all!
Im making a ghost plugin. Very basic idea , ghost pounce on humans and kills them =]

1 ghost on t rest ct.

When a ghost touches an enemy he will pounce on them with animation :D
from model seqences. Then the enemy will -5 health per "pounce" which is continuous like every 3 seconds ( I dont know how to make the 3 seconds delay yet) . The ghost will + frags when it pounce on them.

But from this plugin I tested , it seems that the plugin hasnt even reached to the "public ghost_is_killing(id)" , its not touched it all. No frags are added or anyones dying. Help!! Thanks!!

PHP Code:

new bool:ghost[33]

new 
bool:ghost_killing[33]
new 
bool:victim_dying[33]
public 
fwd_touch(victimid)
{
 if(!
ghost[id])
 {
  return 
PLUGIN_HANDLED
 
}
 if(
ghost[id] && get_user_team(id) != get_user_team(victim) && is_user_alive(id) && is_user_alive(victim) && !victim_dying[victim])
 {
  
ghost_killing[id] = true
  victim_dying
[victim] = true
  set_task
(0.1"ghost_is_killing"id)
 }
 return 
PLUGIN_CONTINUE
}
public 
ghost_is_killing(id)
{
 new 
victim fake_touch(id victim)
 if(
ghost_killing[id] && is_user_alive(id) && is_user_alive(victim))
 {
  new 
hp get_user_health(victim)
  new 
score get_user_frags(id)
  new 
deaths cs_get_user_deaths(victim)
  
  
entity_set_int(idEV_INT_gaitsequence1)
  
entity_set_int(victimEV_INT_gaitsequence98)
 
  if(
hp 5)
  {
   
fm_set_user_health(victimhp 5)
   
fm_set_user_frags(idscore 1)
   
ghost_pounces[id] ++
   new 
Name[32]
   
get_user_name(victimName31)
   
client_print(idprint_center"You pounced %s %s times!",Name,ghost_pounces)
  }
  else if (
hp <)
  {
   
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
   
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {000}, 0)
   
write_byte(id)
   
write_byte(victim)
   
write_byte(0)
   
write_string("death")
   
message_end()
   
fm_set_user_frags(id score 3)
   
cs_set_user_deaths(id deaths 1)
   
   
ghost_killing[id] = false
   victim_dying
[victim] = false
   ghost_pounces
[id] = 0
   user_silentkill
(victim)
  }
 }



{PHILMAGROIN} 05-13-2009 01:26

Re: Ghost Touch to damage event HELP
 
No errors or warnings when compiling?

EDIT: is the ghost going to have noclip? cuz i think he should =]

dstopgunner 05-13-2009 04:02

Re: Ghost Touch to damage event HELP
 
Nope No errors . But damage doesnt work =/

I think "set_task(0.1, "ghost_is_killing", id)" is wrong. I think i should have done it another way to make it to another task. Can someone help?

Dr.G 05-13-2009 05:43

Re: Ghost Touch to damage event HELP
 
search for "touch" and see how others did it. the problem is not your task

dstopgunner 05-13-2009 06:12

Re: Ghost Touch to damage event HELP
 
Ive serached many of them , most of them are touching weapons or simple stuff like that. Its easy for them because they can do everything in the same line like

"client_print(id, print_center, "%s Picked up %s",Gun , person)"

they do not need to set a task like mine :

"set_task(0.1, "ghost_is_killing", id)"

I need to do this because I need to make checks like every second to see if the ghost is still on the human.
If its not then I will stop adding frags / killing human and stuff.
Please give a hint? I cant see whats wrong with my code =/

Dr.G 05-13-2009 06:18

Re: Ghost Touch to damage event HELP
 
attach the sma

dstopgunner 05-13-2009 07:13

Re: Ghost Touch to damage event HELP
 
PHP Code:

#include <amxmodx>
#include <fakemeta_util>
#include <cstrike>
#include <engine>
#include <hamsandwich>
public plugin_init(){
register_plugin("Ghost","1.0","DS_ToP_GunNeR")
register_forward(FM_Touch"fwd_touch")
RegisterHam(Ham_Spawn,"player","spawned")
 
}
new 
bool:ghost[33]
new 
bool:ghost_killing[33]
new 
bool:victim_dying[33]
new 
ghost_pounces[33] = 0
 
public spawned(id)
{
ghost_killing[id] = false
victim_dying
[id] = false
ghost_pounces
[id] = 0
 
set_task
(5.0 "showhealth")
 
if(
ghost[id])
{
fm_strip_user_weapons(id)
fm_give_item(id"weapon_knife")
}
}
 
public 
showhealth(id)
{
if(!
is_user_alive(id))
{
return 
PLUGIN_HANDLED
}
else

set_hudmessage(25525500.010.9006.012.0)
show_hudmessage(id"Health: %i Armor: %i",get_user_health(id), get_user_armor(id))
 
set_task(1.0"showhealth"id)
}
return 
PLUGIN_HANDLED
}
public 
fwd_touch(victimid)
{
if(!
ghost[id])
{
return 
PLUGIN_HANDLED
}
if(
ghost[id] && get_user_team(id) != get_user_team(victim) && is_user_alive(id) && is_user_alive(victim) && !victim_dying[victim])
{
ghost_killing[id] = true
victim_dying
[victim] = true
set_task
(0.1"ghost_is_killing"id)
}
return 
PLUGIN_CONTINUE
}
public 
ghost_is_killing(id)
{
new 
victim fake_touch(id victim)
if(
ghost_killing[id] && is_user_alive(id) && is_user_alive(victim))
{
new 
hp get_user_health(victim)
new 
score get_user_frags(id)
new 
deaths cs_get_user_deaths(victim)
 
entity_set_int(idEV_INT_gaitsequence1)
entity_set_int(victimEV_INT_gaitsequence98)
 
if(
hp 5)
{
fm_set_user_health(victimhp 5)
fm_set_user_frags(idscore 1)
ghost_pounces[id] ++
new 
Name[32]
get_user_name(victimName31)
client_print(idprint_center"You pounced %s %s times!",Name,ghost_pounces)
}
else if (
hp <)
{
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {000}, 0)
write_byte(id)
write_byte(victim)
write_byte(0)
write_string("death")
message_end()
fm_set_user_frags(id score 3)
cs_set_user_deaths(id deaths 1)
 
ghost_killing[id] = false
victim_dying
[victim] = false
ghost_pounces
[id] = 0
user_silentkill
(victim)
}
}



{PHILMAGROIN} 05-13-2009 13:23

Re: Ghost Touch to damage event HELP
 
Quote:

Originally Posted by dstopgunner (Post 826672)
"client_print(id, print_center, "%s Picked up %s",Gun , person)"

this is not detecting if they are touching a gun. this is just printing to the players who and what gun someone picked up.

dstopgunner 05-13-2009 23:25

Re: Ghost Touch to damage event HELP
 
sry Thats not the exact code Im just saying that i serached forums and yes if they touch a gun or something like that they can do its function in the same

public fwd_touch

event but i used a task from the touch event its not working so I need help.
Anyone see anything wrong??????

dstopgunner 05-14-2009 07:48

Re: Ghost Touch to damage event HELP
 
I think i should have set task to victim instead?

set_task(0.1, "ghost_is_killing", victim)

Or both?

set_task(0.1, "ghost_is_killing", id)
set_task(0.1, "ghost_is_killing", victim)

Anyone..?


All times are GMT -4. The time now is 01:32.

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