Raised This Month: $ Target: $400
 0% 

HELP this code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
w5014560
Member
Join Date: Mar 2009
Old 05-23-2009 , 05:10   HELP this code
Reply With Quote #1

PHP Code:
public plugin_init() 
{
register_event("Damage""damage_msg""b""2!0""3=0""4!0")
}
public 
damage_msg()
{
 new 
attacker get_user_attacker(attacker)
 new 
damage read_data(2)
 new 
victim read_data(2)
if(!
is_user_connected(attacker)) {
return 
PLUGIN_CONTINUE
}
if(
attacker != victim)
{
new 
iExperienceGain
if(damage <= 15)
{
iExperienceGain 2
}
if(
75 damage 15)
{
iExperienceGain 8
}

if(
100 damage >= 75)
{
iExperienceGain 15
}
if(
120 damage >= 100)
{
iExperienceGain 22
}
if(
180 damage >= 120)
{
iExperienceGain 35
}
if(
250 damage >= 180)
{
iExperienceGain 55
}
if(
450 damage >= 250)
{
iExperienceGain 80
}
add_experience(attackeriExperienceGain)
}
return 
PLUGIN_CONTINUE

Run time error 10: native error (native "get_user_attacker")
Invalid player id 20140

Who knows what the problem is that
w5014560 is offline
--kml--
Senior Member
Join Date: Jan 2009
Old 05-23-2009 , 06:18   Re: HELP this code
Reply With Quote #2

not sure will work or even work o.o

PHP Code:
public plugin_init() 
{
register_event("Damage""damage_msg""b""2!0""3=0""4!0")
}
public 
damage_msg()
{
 new 
attacker read_data(1)
 new 
damage read_data(2)
 new 
victim read_data(2)
if(!
is_user_connected(attacker)) {
return 
PLUGIN_CONTINUE
}
if(
attacker != victim)
{
new 
iExperienceGain
if(damage <= 15)
{
iExperienceGain 2
}
if(
75 damage 15)
{
iExperienceGain 8
}

if(
100 damage >= 75)
{
iExperienceGain 15
}
if(
120 damage >= 100)
{
iExperienceGain 22
}
if(
180 damage >= 120)
{
iExperienceGain 35
}
if(
250 damage >= 180)
{
iExperienceGain 55
}
if(
450 damage >= 250)
{
iExperienceGain 80
}
add_experience(attackeriExperienceGain)
}
return 
PLUGIN_CONTINUE

__________________
wooT now is asking season
will ask you plenty of things for learning
--kml-- is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-23-2009 , 12:04   Re: HELP this code
Reply With Quote #3

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "bugsy"

public plugin_init() 
{
    
register_pluginPLUGIN VERSION AUTHOR );
    
register_event"Damage" "fwDamage" "b" "2!0" "3=0" "4!0" )    
}

public 
fwDamage(id)
{    
    static 
iAttackeriAttacker get_user_attackerid );
    static 
iDamageiDamage read_data);    
        
    if ( 
iAttacker && ( id != iAttacker ) ) 
    {
        new 
iExperienceGain;
    
        if( 
iDamage <= 15 )
            
iExperienceGain 2;
        else if( 
75 iDamage 15 )
            
iExperienceGain 8;
        else if( 
100 iDamage >= 75 )
            
iExperienceGain 15;
        else if( 
120 iDamage >= 100 )
            
iExperienceGain 22;
        else if( 
180 iDamage >= 120 )
            
iExperienceGain 35;
        else if( 
250 iDamage >= 180 )
            
iExperienceGain 55;
        else if( 
450 iDamage >= 250 )
            
iExperienceGain 80;
    
        
add_experience(attackeriExperienceGain);
    } 

Hamsandwich:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "bugsy"

public plugin_init() 
{
    
register_pluginPLUGIN VERSION AUTHOR );
    
RegisterHamHam_TakeDamage "player" "fwHamTakeDamage" );
}

public 
fwHamTakeDamageiVictim iInflictor iAttacker FloatfDamage iBitDamageType )
{
    if ( 
iAttacker && ( iVictim != iAttacker ) ) 
    {
        new 
iExperienceGain;
        
        if( 
fDamage <= 15.0 )
            
iExperienceGain 2;
        else if( 
75.0 fDamage 15.0 )
            
iExperienceGain 8;
        else if( 
100.0 fDamage >= 75.0)
            
iExperienceGain 15;
        else if( 
120.0 fDamage >= 100.0)
            
iExperienceGain 22;
        else if( 
180.0 fDamage >= 120.0)
            
iExperienceGain 35;
        else if( 
250.0 fDamage >= 180.0)
            
iExperienceGain 55;
        else if( 
450.0 fDamage >= 250.0)
            
iExperienceGain 80;
        
        
add_experience(attackeriExperienceGain);
    }

__________________

Last edited by Bugsy; 05-23-2009 at 12:12.
Bugsy 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 01:32.


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