Raised This Month: $51 Target: $400
 12% 

[HELP] Regarding event_damage function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheSpaniard
Senior Member
Join Date: Jul 2017
Location: Hell
Old 10-03-2017 , 04:21   [HELP] Regarding event_damage function
Reply With Quote #1

I searched and searched but to no avail.
i am trying to get a standard format for event_damage
saw many examples like this:-
Spoiler

But each is specific to the plugin it is in.
Is there any general format and can someone explain it to me??

P.S. This is very relevant example cause i too want to make damage multiplier
__________________
And I Am Back.

Last edited by TheSpaniard; 10-03-2017 at 04:49.
TheSpaniard is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 10-03-2017 , 14:52   Re: [HELP] Regarding event_damage function
Reply With Quote #2

Use Ham_TakeDamage instead of event_damage.

https://forums.alliedmods.net/showthread.php?t=134262
__________________









Last edited by CrazY.; 10-03-2017 at 14:53.
CrazY. is offline
SkumTomteN
Veteran Member
Join Date: Oct 2013
Location: Asgard
Old 10-05-2017 , 20:12   Re: [HELP] Regarding event_damage function
Reply With Quote #3

I would say the same, use takedamage as its usually more simple, but event_damage shouldnt be a problem either.
as i dont usually use it, i wont comment on it.
__________________
Contact: Steam
Videos: Youtube
SkumTomteN is offline
TheSpaniard
Senior Member
Join Date: Jul 2017
Location: Hell
Old 10-06-2017 , 13:11   Re: [HELP] Regarding event_damage function
Reply With Quote #4

Quote:
Originally Posted by CrazY. View Post
Use Ham_TakeDamage instead of event_damage.

https://forums.alliedmods.net/showthread.php?t=134262
I want to multiply damage in a specific case as event_damage is a public function i can do it:-
PHP Code:
case 1:
{
      
event_damage(id)

But Ham_TakeDamage being a forward i can't execute it in a specific case or can i?
If i can tell me otherwise i will be happy.
__________________
And I Am Back.
TheSpaniard is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-06-2017 , 13:21   Re: [HELP] Regarding event_damage function
Reply With Quote #5

You can Use ExecuteHamB native
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 10-06-2017 , 14:15   Re: [HELP] Regarding event_damage function
Reply With Quote #6

Your way of thinking is really strange...
You cannot call it from other function and multiply damage outside the hook function.


If you want to do this just use standard ham Take damage and check some bools set from other functions.

For example I make a plugin which gives me possibility to have 2x more damage by activating some kind of extra energy potion (out of imagination, sorry).
For example you want it to last like for 10 seconds.

So you hook impulse (flashlight, standard when you press f) and when you press f function activate_damage will be called.

In this plugin you just set the time when this will end like
g_endtime[player] =get systime + how_many_seconds


Then in ham take damage you check
If get systime - g_endtime[player] >= 0
//then multiply damage or other stuff you want

Try to think more abstract instead of inventing weird things..

Last edited by siriusmd99; 10-06-2017 at 14:16.
siriusmd99 is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 10-06-2017 , 14:18   Re: [HELP] Regarding event_damage function
Reply With Quote #7

PHP Code:
public plugin_init() {
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Pre"0)
}

public 
Ham_TakeDamage_pre(victiminflictorattackerFloat:damagedamagebits) {
    if(!
is_user_connected(killer) || !is_user_connected(victim) || attacker == victim)
        return 
HAM_IGNORED
    
new Float:multiplier 1.2
    SetHamParamFloat
(4damage multiplier)//the number 4 stands for the parameter of a Ham_TakeDamage_pre() function, which is Float:damage. in example 5th parameter would be damagebits.

__________________
retired chump

Last edited by DjSoftero; 10-07-2017 at 01:20.
DjSoftero is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 10-06-2017 , 15:46   Re: [HELP] Regarding event_damage function
Reply With Quote #8

Quote:
Originally Posted by DjSoftero View Post
PHP Code:
public plugin_init() {
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Pre"0)
}

public 
Ham_TakeDamage_pre(victiminflictorattackerFloat:damagedamagebits) {
    new 
Float:multiplier 1.2
    SetHamParamFloat
(4multiplier)//the number 4 stands for the parameter of a Ham_TakeDamage_pre() function, which is Float:damage. in example 5th parameter would be damagebits.

You must multiply the damage by the multiplier.
PHP Code:
SetHamParamFloat(4damage multiplier

Last edited by KiLLeR.; 10-06-2017 at 15:46.
KiLLeR. is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-06-2017 , 20:40   Re: [HELP] Regarding event_damage function
Reply With Quote #9

Quote:
Originally Posted by DjSoftero View Post
PHP Code:
public plugin_init() {
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Pre"0)
}

public 
Ham_TakeDamage_pre(victiminflictorattackerFloat:damagedamagebits) {
    new 
Float:multiplier 1.2
    SetHamParamFloat
(4multiplier)//the number 4 stands for the parameter of a Ham_TakeDamage_pre() function, which is Float:damage. in example 5th parameter would be damagebits.

you should add some checks before doing the multiplier, such as victim != attacker and is_user_connected on both victim and attacker, otherwise you'll multiply things such as bomb explosion or fall damage
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 10-07-2017 , 01:17   Re: [HELP] Regarding event_damage function
Reply With Quote #10

I forgot to multiply, and about the checks, he has to do his own ones aswell. so didnt bother, but i guess i should have. edited first post
__________________
retired chump
DjSoftero 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 16:48.


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