Raised This Month: $ Target: $400
 0% 

How to make a weapon to show damage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 12-09-2021 , 15:21   How to make a weapon to show damage?
Reply With Quote #1

Hello. Most weapons i have on my ZM server show damage dealt to zombies. However, I have some weapons (extra items) that deal damage, but don't show the numbers of damage.

This is the flamethrower weapon I added as an extra item to the server: https://pastebin.com/hJVQNeag
It deals damage, but it doesn't show the numbers of dealt damage.

Yes, my server already has a plugin that shows you how much damage you deal to your enemy while you are damaging your enemy. In case you want to know, this is the Bullet Damage plugin i use: https://forums.alliedmods.net/showthread.php?p=789735

If you add the code needed to make the flamethrower weapon to show damage, please, also mention what codes you added and where exactly you added them, so I can learn how to make weapons to show damage, because i have several more weapons that don't show damage, and i want to make them to show damage.

Thanks.

NOTE: Flamehtrower's code is uploaded on another hosting because AlliedModders doesn't accept codes that are too large.

Last edited by GlobalPlague; 12-09-2021 at 15:23.
GlobalPlague is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-09-2021 , 15:51   Re: How to make a weapon to show damage?
Reply With Quote #2

Your bullet damage plugin usses the "Damage" event to detect damage.
Your weapon uses the custom_weapon_dmg() function that calls only the client_damage() forward.

This means that the bullet damage plugin cannot detect the damage because it doesn't use the same callback.

You need to include the client_damage() function in your bullet damage plugin just like the "Damage" one is used.

Code:
#include <csx> public client_damage(attacker, id, damage) {     // bullet damage code here... }
__________________

Last edited by OciXCrom; 12-09-2021 at 15:51.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
GlobalPlague
Senior Member
Join Date: Feb 2016
Location: Pluto
Old 12-10-2021 , 13:39   Re: How to make a weapon to show damage?
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Your bullet damage plugin usses the "Damage" event to detect damage.
Your weapon uses the custom_weapon_dmg() function that calls only the client_damage() forward.

This means that the bullet damage plugin cannot detect the damage because it doesn't use the same callback.

You need to include the client_damage() function in your bullet damage plugin just like the "Damage" one is used.

Code:
#include <csx> public client_damage(attacker, id, damage) {     // bullet damage code here... }
Thank you for helping me. I did what you said, and now the problem is solved.
GlobalPlague 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 11:35.


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