This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Headshot = +35hp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rpm
Member
Join Date: Aug 2007
Location: Brazil
Old 11-28-2008 , 11:19   Headshot = +35hp
Reply With Quote #1

I know that a lot of things here are wrong =)
I want that every time the player give a headshot he win 35hp, if he has 100, goes to 135

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

#define PLUGIN "+35hp"
#define VERSION "1.0"
#define AUTHOR "rpm"
    
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
         register_event ( "DeathMsg" , "e_DeathMsg" , "a" );
}

public e_DeathMsg ()
{
    if ( read_data ( 3 ) )
    {
    new vida = get_user_health (id)
    new vida2 = (vida + 35)
    set_user_health(id, vida2)
    }
}
rpm is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-28-2008 , 11:28   Re: Headshot = +35hp
Reply With Quote #2

Your function doesn't pass any player id, and it can not.
You need to first retrieve killer id, see DeathMsg args : http://wiki.amxmodx.org/index.php/Ha...vents#DeathMsg

new id = read_data(1) // killer
new vida = min(get_user_health(id) + 35, 100)
set_user_health(id, vida)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 11-28-2008 , 23:03   Re: Headshot = +35hp
Reply With Quote #3

Search for repay

It has all of that, and just for that.
__________________
bmann_420 is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 12-08-2008 , 12:55   Re: Headshot = +35hp
Reply With Quote #4

Euhm, just use this plugin:

Vampire by Shalfee

I putted so you don't get anything when normal kill, +35 when you kill someone with headshot and maximum HP is 250

Quote:
public plugin_init()
{
register_plugin("Vampire", PLUGIN_VERSION, "Shalfey")
health_add = register_cvar("amx_vampire_hp", "0")
health_hs_add = register_cvar("amx_vampire_hp_hs", "45")
health_max = register_cvar("amx_vampire_max_hp", "250")
register_event("DeathMsg", "hook_death", "a", "1>0")
}
Attached Files
File Type: sma Get Plugin or Get Source (vampire.sma - 739 views - 1.7 KB)
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
rpm
Member
Join Date: Aug 2007
Location: Brazil
Old 12-09-2008 , 17:43   Re: Headshot = +35hp
Reply With Quote #5

thanks crazyeffect =)

+ Karma
rpm is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 12-10-2008 , 06:02   Re: Headshot = +35hp
Reply With Quote #6

Done with pleasure
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
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:29.


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