Raised This Month: $ Target: $400
 0% 

HE Bonus Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 11-08-2011 , 11:14   HE Bonus Plugin
Reply With Quote #1

I wrote a plugin I give you only kill the enemy with hand grenades health.

Once I get compile errors.

What do I do?

Code:
#include <amxmodx>
#include <fun>

public plugin_init()
{
	register_plugin("PLUGIN", "VERSION", "AUTHOR")

	register_event("DeathMsg", "EventDeathMsg", "a", "1>0")
}

public EventDeathMsg()
{
    	if(get_user_weapon() == CSW_HEGRENADE)
	{
		Bonus()
    	}
}

public Bonus(id)
{
	client_print(id, print_center, "Since You killed the enemy with the HE\nYou add 25 to health")
	set_user_health(id, (get_user_health(id) + 25))
}
RuRuRu612754 is offline
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 11-08-2011 , 11:27   Re: HE Bonus Plugin
Reply With Quote #2

PHP Code:
get_user_weapon(read_data(1))
Bonus(read_data(1)) 
But i think you'll need read_data(4, weapon, 31) (with new weapon[32] before) instead of get_user_weapon, but i don't know what name it will return for HE. You can test it by printing the 'weapon' string.

And if I've got the idea of your plugin, you should check if the killer is not the victim, becase you can suicide with the HE

PHP Code:
if(read_data(1) != read_data(2))
    
Bonus(read_data(1)) 
Or, an easy way:

PHP Code:
new killer read_data(1)
new 
victim read_data(2)
new 
weapon[32]
read_data(4weapon31

Last edited by Blue Snake.; 11-08-2011 at 11:29.
Blue Snake. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-08-2011 , 11:57   Re: HE Bonus Plugin
Reply With Quote #3

register_event("DeathMsg", "EventDeathMsg_HeGrenade", "a", "1>0", "4=grenade")

Then you don't have to check weapon in callback.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 11-08-2011 , 21:09   Re: HE Bonus Plugin
Reply With Quote #4

thanks for all answer

@ConnorMcLeod

compile is success
However, the message is displayed to all players.
And health is not added

What should I do?

Code:
#include <amxmodx>
#include <fun>

public plugin_init()
{
	register_plugin("PLUGIN", "VERSION", "AUTHOR")

	register_event("DeathMsg", "EventDeathMsgHeGrenade", "a", "1>0", "4=grenade")
}

public EventDeathMsgHeGrenade(id)
{
	client_print(id, print_center, "Since You killed the enemy with the HE\nYou add 25 to health")
	set_user_health(id, (get_user_health(id) + 25))
}
RuRuRu612754 is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 11-09-2011 , 00:41   Re: HE Bonus Plugin
Reply With Quote #5

PHP Code:
public EventDeathMsgHeGrenade()
{
        static 
iKilleriVictim
        
        iKiller 
read_data)
        
iVictim read_data)
        
        if( 
iKiller != iVictim )
        {
                
client_printiKillerprint_center"Since You killed the enemy with the HE\nYou add 25 to health" )
                
                
set_user_healthiKillerget_user_healthiKiller ) + 25 )
        }

dark_style is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 11-09-2011 , 01:55   Re: HE Bonus Plugin
Reply With Quote #6

@dark_style

thanks

I was able to complete your thanks to this plugin
RuRuRu612754 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 14:16.


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