Raised This Month: $ Target: $400
 0% 

[help] error on health add


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-02-2014 , 22:18   [help] error on health add
Reply With Quote #1

if u know about first blood kill
In map de_dust 2
when you are using mid you killed one enemy, you got first blood + some hp and instant other enemy killed you.
Health didnt add to attacker at the time this error will create someone help me
how to solve ?
Thanks in advanced

Quote:
[FUN] Player out of range (0)
[AMXX] Displaying debug trace (plugin "firstblood.amxx")
[AMXX] Run time error 10: native error (native "set_user_health")
https://forums.alliedmods.net/showth...ght=blood+kill
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 11-02-2014 at 22:30.
indraraj striker is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 11-03-2014 , 00:43   Re: [help] error on health add
Reply With Quote #2

show the source code.
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-03-2014 , 02:18   Re: [help] error on health add
Reply With Quote #3

Just need to check whether the attacker is alive or not. ;)

Just use below:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fun>

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

new boolg_bFirstKill

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event "DeathMsg""event_death""a" )
    
register_event "HLTV""event_new_round""a""1=0""2=0" )  
}

public 
plugin_precache ( )
{
    
// Precache our custom sound when first blood is happen
    
precache_sound "misc/firstblood.wav" );  
}

public 
event_death ( )
{
    new 
attacker read_data )
    
    
// If the attacker is dead or 
    // the attacker is the same with the victim (this mean the player has committed suicide, 
    // then the first blood reward will be paused
    
if ( !is_user_alive(attacker) || attacker == read_data ) )
        return
    
    
// If there is still nobody drew a first blood
    
if ( ! g_bFirstKill )
    {
        
        
// First blood has happen
        
g_bFirstKill true
        
        
// The reward for first blood
        
cs_set_user_money attackercs_get_user_money attacker ) + 2000 )
        
set_user_health attackerget_user_health attacker ) + 15 )
        
set_user_armor  attackerget_user_armor attacker ) + 15 )
        
        
// Emit a sound
        
emit_sound0CHAN_AUTO"misc/firstblood.wav"0.7ATTN_NORM0PITCH_NORM );
    }
}

public 
event_new_round ( )
{
    
// Reset our first blood in the new round
    
g_bFirstKill false  


Last edited by zmd94; 11-03-2014 at 02:25.
zmd94 is offline
Old 11-03-2014, 04:36
indraraj striker
This message has been deleted by indraraj striker. Reason: got it
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-03-2014 , 04:38   Re: [help] error on health add
Reply With Quote #5

read_data(2) is to detect the victim.
zmd94 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-03-2014 , 04:43   Re: [help] error on health add
Reply With Quote #6

Quote:
Originally Posted by zmd94 View Post
read_data(2) is to detect the victim.
Thanks
btw u need to define
new victim=read_data(2)
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-03-2014 , 04:45   Re: [help] error on health add
Reply With Quote #7

It is not so important, but it is not wrong to do it. ;)
zmd94 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-03-2014 , 04:46   Re: [help] error on health add
Reply With Quote #8

Quote:
Originally Posted by zmd94 View Post
It is not so important, but it is not wrong to do it. ;)
opps oki
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-03-2014 , 04:59   Re: [help] error on health add
Reply With Quote #9

Quote:
Originally Posted by zmd94 View Post
It is not so important, but it is not wrong to do it. ;)
what about if player get killled by camping
[walkguard plugin]
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-03-2014 , 05:07   Re: [help] error on health add
Reply With Quote #10

As far as I know when someone is being killed by camping, it is most likely the player is committed suicide. So, when we have this check attacker == read_data ( 2 ), it will not effect the first blood plugin. ;)

Last edited by zmd94; 11-03-2014 at 05:07.
zmd94 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 17:42.


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