Raised This Month: $ Target: $400
 0% 

small problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-09-2010 , 10:50   small problem
Reply With Quote #1

hello, can someone tell me why this doesnt work ?
should work like this: when you do headshot, get 15 hp (cvar)
and Kill should be 5 hp (cvar)

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

#define VERSION "1.0.1"

new cvar_hs;
new 
cvar_kill;

public 
plugin_init()     
{
    
register_plugin("Headshot"VERSION"afro-ankan")
    
    
register_event("DeathMsg""eDeath""a");
    
    
cvar_hs register_cvar"amx_hs""15" )
    
cvar_kill register_cvar"amx_kill""5" )
}

public 
fw_GotKilled( )
{
    
register_plugin("Headshot"VERSION"Zpoke")
    
    new 
iAttacker read_data(1);
    
    new 
iHeadshot read_data(3);
    
    if( 
iHeadshot )
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_kill ) )
    }
    else
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_hs ) )
    }

__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 10-09-2010 , 10:59   Re: small problem
Reply With Quote #2

Quote:
Originally Posted by Afro-Ankan View Post
hello, can someone tell me why this doesnt work ?
should work like this: when you do headshot, get 15 hp (cvar)
and Kill should be 5 hp (cvar)

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

#define VERSION "1.0.1"

new cvar_hs;
new 
cvar_kill;

public 
plugin_init()     
{
    
register_plugin("Headshot"VERSION"afro-ankan")
    
    
register_event("DeathMsg""eDeath""a");
    
    
cvar_hs register_cvar"amx_hs""15" )
    
cvar_kill register_cvar"amx_kill""5" )
}

public 
fw_GotKilled( )
{
    
register_plugin("Headshot"VERSION"Zpoke")
    
    new 
iAttacker read_data(1);
    
    new 
iHeadshot read_data(3);
    
    if( 
iHeadshot )
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_kill ) )
    }
    else
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_hs ) )
    }

PHP Code:
public fw_GotKilled( ) 
->

PHP Code:
public eDeath( ) 
__________________
Reality is wrong, dreams are for real.
g_often is offline
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-09-2010 , 11:05   Re: small problem
Reply With Quote #3

yes, ofc.... fixed it

PHP Code:
public eDeath( )  
{
    
register_plugin("Headshot"VERSION"Zpoke")
    
    new 
iAttacker read_data(1);
    
    new 
iHeadshot read_data(3);
    
    if( 
iHeadshot )
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_hs ) )
    }
    else
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_kill ) )
    }

__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 10-09-2010 , 11:07   Re: small problem
Reply With Quote #4

Quote:
Originally Posted by Afro-Ankan View Post
yes, ofc.... fixed it

PHP Code:
public eDeath( )  
{
    
register_plugin("Headshot"VERSION"Zpoke")
    
    new 
iAttacker read_data(1);
    
    new 
iHeadshot read_data(3);
    
    if( 
iHeadshot )
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_hs ) )
    }
    else
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + get_pcvar_numcvar_kill ) )
    }

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

#define VERSION "1.0.1"

new PcvarHsPcvarKill;

public 
plugin_init()     
{
    
register_plugin("Headshot"VERSION"afro-ankan")
    
    
register_event"DeathMsg""EventDeathMsg""a""1>0" );
    
    
PcvarHs register_cvar"amx_hs""15" )
    
PcvarKill register_cvar"amx_kill""5" )
}

public 
EventDeathMsg( )
{
    static 
iAttackeriHeadshot;
    
    
iAttacker read_data(1);
    
iHeadshot read_data(3);
    
    if( 
iAttacker != read_data(2) )
    {
        
set_user_healthiAttackerget_user_healthiAttacker ) + ((iHeadshot) ? get_pcvar_numPcvarHs ) : get_pcvar_numPcvarKill )) )
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;

__________________
Reality is wrong, dreams are for real.

Last edited by g_often; 10-09-2010 at 11:09.
g_often is offline
Afro-Ankan
Member
Join Date: Jul 2009
Location: Sweden
Old 10-09-2010 , 11:41   Re: small problem
Reply With Quote #5

how should i do to make a HUD message then ?

PHP Code:
show_hudmessage(iAttacker"Healed %i HP"get_pcvar_numcvar_hs ) ? get_pcvar_numcvar_kill ) ); 
__________________
My Current Projects:
Pistols vs Pistols Public
Progress [ | | | | | | | | | | ]
Only 10% Completed

Last edited by Afro-Ankan; 10-09-2010 at 11:44.
Afro-Ankan is offline
Send a message via MSN to Afro-Ankan
g_often
Senior Member
Join Date: Jan 2010
Location: In your mind
Old 10-09-2010 , 13:07   Re: small problem
Reply With Quote #6

Quote:
Originally Posted by Afro-Ankan View Post
how should i do to make a HUD message then ?

PHP Code:
show_hudmessage(iAttacker"Healed %i HP", (iHeadshot) ? get_pcvar_numcvar_hs ) : get_pcvar_numcvar_kill ) ); 
To show how many life he won?

PHP Code:
set_hudmessage25500, -1.0, -1.006.012.0 )
show_hudmessageiAttacker"Healed %i HP", (iHeadshot) ? get_pcvar_numPcvarHs ) : get_pcvar_numPcvarKill ) ) 
__________________
Reality is wrong, dreams are for real.
g_often 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 10:17.


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