Raised This Month: $ Target: $400
 0% 

hit indicator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-30-2012 , 16:40   hit indicator
Reply With Quote #1

I can't seem to get a hit indicator to work at all. nothing seems to print. here's my code.

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("Damage""event_damage""be""2!0")
    
    
g_SyncOb CreateHudSyncObj()
}

public 
event_damage(id)
{
    new 
pi_attackerIDp_weaponp_hitzone
    pi_attackerID 
get_user_attacker(idp_weaponp_hitzone)

    new 
i_damage read_data(2)
    
    
client_print(pi_attackerIDprint_chat"You hit him!")
    
    
set_hudmessage(1811811810.0, -0.510.14.00.020.02, -1)
    
ShowSyncHudMsg(pi_attackerIDg_SyncOb"X")
    
    return 
PLUGIN_CONTINUE

as you can see all it will do is print an X to where i'd assume would be a little lower than the crosshair. but it doesn't. any ideas?

Last edited by Liverwiz; 04-30-2012 at 16:41.
Liverwiz is offline
Bilal Pro
Senior Member
Join Date: Mar 2012
Location: Holland
Old 04-30-2012 , 17:27   Re: hit indicator
Reply With Quote #2

Try to use HamTakeDamage
__________________
  • Point System with rank titles for sale [X] [100% private]
  • VIP Menu for sale [X] [100% private]
  • HnS shop more features for sale [X] [100% private]
Contact: Bilalzaandam1234, on steam if you are interested.
Bilal Pro is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-30-2012 , 18:02   Re: hit indicator
Reply With Quote #3

Quote:
Originally Posted by Bilal Pro View Post
Try to use HamTakeDamage
i'll see how that goes. But i don't understand why this isn't working....at all.
Liverwiz is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 04-30-2012 , 19:31   Re: hit indicator
Reply With Quote #4

I tried using Ham_TakeDamage, but it still doesn't work. Here is my code:

PHP Code:
//init
    
RegisterHam(Ham_TakeDamage"player""ham_dammich"1)

public 
ham_dammich(victimIDinflictorIDattackerIDFloat:f_damagetype)
{
    if(
get_pcvar_num(g_pcvar_toggle)==|| !is_user_alive(victimID) || !is_user_alive(attackerID))
        return 
HAM_HANDLED
    
    
new sz_attackerMsg[32] = "Hit:"
    
new sz_victimMsg[32] = "Damage:"
    
    
client_print(attackerIDprint_chat"You hit him!")
    
    
format(sz_attackerMsg31"%s %d"sz_attackerMsgfloatround(f_damage))
    
format(sz_victimMsg31"%s -%d"sz_victimMsgfloatround(f_damage))
    
    
client_print(attackerIDprint_centersz_attackerMsg)
    
client_print(victimIDprint_centersz_victimMsg)
    
    
set_hudmessage(1811811810.0, -0.510.14.00.020.02, -1)
    
ShowSyncHudMsg(attackerIDg_SyncOb"X")
    
    return 
HAM_IGNORED


Last edited by Liverwiz; 04-30-2012 at 19:33. Reason: added RegisterHam
Liverwiz is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-01-2012 , 12:41   Re: hit indicator
Reply With Quote #5

You can format the strings directly in the client_print native - there's no need to make variables and use format.
__________________
<VeCo> is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-01-2012 , 16:59   Re: hit indicator
Reply With Quote #6

Quote:
Originally Posted by <VeCo> View Post
You can format the strings directly in the client_print native - there's no need to make variables and use format.
I know. I have plans for this code that will need that functionality.

But can ANYONE help me figure out why this won't show the X to the attacker, or any of the prints when damage is done. Its driving me mad. I've looked at 3 different examples of similar functionality and it should work. Am i missing anything? Is the server stupid? Is my compiler a craphole? Here's my current code, shortened to keep the extraneous code out of people's minds.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <float>
#include <hamsandwich>
//init
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage"player""ham_dammich"1)
    
g_SyncOb CreateHudSyncObj()


public 
ham_dammich(victimIDinflictorIDattackerIDFloat:f_damagetype)
{
    if(
get_pcvar_num(g_pcvar_toggle)==|| !is_user_alive(victimID) || !is_user_alive(attackerID))
        return 
HAM_HANDLED
    
    client_print
(attackerIDprint_chat"You hit him!")
    
    
set_hudmessage(1811811810.0, -1.510.14.00.020.02, -1)
    
ShowSyncHudMsg(attackerIDg_SyncOb"X")
    
    
set_hudmessage(181001.00.510.14.00.020.02, -1)
    
ShowSyncHudMsg(victimIDg_SyncOb"Run!")
    
    return 
HAM_HANDLED

it doesn't show anything. Not once. Shots taken slow, or at real-time playing. HELP! 2 plugins are suffering.

Last edited by Liverwiz; 05-01-2012 at 17:01. Reason: More code snipping.
Liverwiz is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-13-2012 , 12:52   Re: hit indicator
Reply With Quote #7

I'm going to be blatant.

Bump.
Liverwiz is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-13-2012 , 13:06   Re: hit indicator
Reply With Quote #8

I tested it now.
The chat message works fine.
The "X" HUD message doesn't show - you have typed -1.5 as Y coordinate, but that's wrong, you meant -1.0?
__________________

Last edited by <VeCo>; 05-13-2012 at 13:06.
<VeCo> is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-13-2012 , 13:31   Re: hit indicator
Reply With Quote #9

Quote:
Originally Posted by <VeCo> View Post
I tested it now.
The chat message works fine.
The "X" HUD message doesn't show - you have typed -1.5 as Y coordinate, but that's wrong, you meant -1.0?
Its weird that it works for you but not in my servers. I meant -1.5 to be just a little lower than the -1.0 so i know its off the crosshair and off your center of mass. I'll take your suggestion into account and test it again when i can get my server back up.

Just wondering, what makes the "-1.5" wrong? Is it just obscure to move in half-marks or does the float really not work like that?
Liverwiz is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-13-2012 , 13:39   Re: hit indicator
Reply With Quote #10

The maximum is 1.0, the minimum is 0.0 (-1.0 is centered), another values will be outside the screen.
__________________

Last edited by <VeCo>; 05-13-2012 at 13:41.
<VeCo> 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 07:54.


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