AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   small problem (https://forums.alliedmods.net/showthread.php?t=140161)

Afro-Ankan 10-09-2010 10:50

small problem
 
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 ) )
    }



g_often 10-09-2010 10:59

Re: small problem
 
Quote:

Originally Posted by Afro-Ankan (Post 1320101)
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( ) 


Afro-Ankan 10-09-2010 11:05

Re: small problem
 
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 ) )
    }



g_often 10-09-2010 11:07

Re: small problem
 
Quote:

Originally Posted by Afro-Ankan (Post 1320119)
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;



Afro-Ankan 10-09-2010 11:41

Re: small problem
 
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 ) ); 


g_often 10-09-2010 13:07

Re: small problem
 
Quote:

Originally Posted by Afro-Ankan (Post 1320161)
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 ) ) 



All times are GMT -4. The time now is 10:17.

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