Raised This Month: $ Target: $400
 0% 

[VIP] Show Damage - weird result


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SEnergyable
Junior Member
Join Date: Oct 2011
Old 07-04-2012 , 20:15   [VIP] Show Damage - weird result
Reply With Quote #1

Hello,

I'm trying to do custom VIP plugin, everything works fine so far except showing damage, I've tried the plugin that's everyone using and it's working fine, so there's something wrong with my code; when I damage someone it will show 0 as damage, HOWEVER I've tried to show it in chat (client_print) and got result of 2 client prints, first one was normal damage and second was 0, therefore my hud message is always changed to that 0 after normal damage

so I've got output like this when I shot someone:

Quote:
Damage Report: 20
Damage Report: 0
and my hud message showed only 0

what's weird is that with HEgrenade it's working normally

Grenade: http://i.imgur.com/NfKem.png
Gun: http://i.imgur.com/h9wyE.png

source: (not whole ofc, only damage)

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define PLUGIN "VIP"
#define VERSION "1.0"
#define AUTHOR "SEnergy!"

new g_MsgSync;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_event("Damage","myDmg","b")
	g_MsgSync = CreateHudSyncObj()
}

public myDmg(id)
{
	new attacker = get_user_attacker(id);
	
	if(is_user_connected(id) && is_user_connected(attacker))
	{
		if(get_user_team(id) != get_user_team(attacker))
		{
			if(get_user_flags(attacker) & ADMIN_LEVEL_C)
			{
				new damage = read_data(2);
				set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
				ShowSyncHudMsg(attacker, g_MsgSync, "%i^n", damage)
				client_print(attacker, print_chat, "Damage Report: %i", damage) 
			}
		}
	}
	return PLUGIN_HANDLED;
}

Last edited by SEnergyable; 07-04-2012 at 20:19.
SEnergyable is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-04-2012 , 20:31   Re: [VIP] Show Damage - weird result
Reply With Quote #2

new t[32]; formatex(t, charsmax(t), "%d", damage)
ShowSyncHudMsg(attacker, g_MsgSync, t)

try that.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
SEnergyable
Junior Member
Join Date: Oct 2011
Old 07-05-2012 , 06:22   Re: [VIP] Show Damage - weird result
Reply With Quote #3

same result, any other ideas?
SEnergyable is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-05-2012 , 06:44   Re: [VIP] Show Damage - weird result
Reply With Quote #4

PHP Code:
register_event("Damage","myDmg","be","2>0"
__________________
<VeCo> is offline
SEnergyable
Junior Member
Join Date: Oct 2011
Old 07-05-2012 , 09:37   Re: [VIP] Show Damage - weird result
Reply With Quote #5

Quote:
Originally Posted by <VeCo> View Post
PHP Code:
register_event("Damage","myDmg","be","2>0"
well this works pretty much, except that when I hit the head it won't do anything, so it works only with normal hits, also it don't shows when I kill someone with grenade :X any suggestions?

edit: so far I noticed it's that it's not working with damage over 100 and when I kill someone with grenade :X

Last edited by SEnergyable; 07-05-2012 at 09:45.
SEnergyable is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-05-2012 , 10:02   Re: [VIP] Show Damage - weird result
Reply With Quote #6

PHP Code:
register_event("DeathMsg""event_death""a"
Damage isn't fired when they die. That's misleading....But should work with grenades.
This might be weird with grenade kills, i'm not sure.
You're going to want to filter out id == 0 and id == id as to not register suicide or fall-death
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 07-05-2012 at 10:03.
Liverwiz is offline
SEnergyable
Junior Member
Join Date: Oct 2011
Old 07-05-2012 , 10:12   Re: [VIP] Show Damage - weird result
Reply With Quote #7

Quote:
Originally Posted by Liverwiz View Post
PHP Code:
register_event("DeathMsg""event_death""a"
Damage isn't fired when they die. That's misleading....But should work with grenades.
This might be weird with grenade kills, i'm not sure.
You're going to want to filter out id == 0 and id == id as to not register suicide or fall-death
what about that damage higher than 100?
SEnergyable is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 07-05-2012 , 10:44   Re: [VIP] Show Damage - weird result
Reply With Quote #8

I would use Ham_TakeDamage. It's more controllable.
__________________
<VeCo> is offline
SEnergyable
Junior Member
Join Date: Oct 2011
Old 07-05-2012 , 10:55   Re: [VIP] Show Damage - weird result
Reply With Quote #9

super edit: holy fck, I had "e" flag in register_event -.-'

Last edited by SEnergyable; 07-05-2012 at 11:23.
SEnergyable 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 15:19.


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