AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to make a weapon to show damage? (https://forums.alliedmods.net/showthread.php?t=335492)

GlobalPlague 12-09-2021 15:21

How to make a weapon to show damage?
 
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.

OciXCrom 12-09-2021 15:51

Re: How to make a weapon to show damage?
 
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... }

GlobalPlague 12-10-2021 13:39

Re: How to make a weapon to show damage?
 
Quote:

Originally Posted by OciXCrom (Post 2765440)
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. :)


All times are GMT -4. The time now is 11:34.

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