Raised This Month: $ Target: $400
 0% 

[RESOLVED]deathmsg victim, never encountered?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-10-2010 , 02:59   [RESOLVED]deathmsg victim, never encountered?
Reply With Quote #1

PHP Code:
public overkill() 
{
    if (!
get_pcvar_num(amx_overkill))
        return 
PLUGIN_CONTINUE
    
new killerid read_data(1)
    new 
victimid read_data(2)
    new 
victimname[32]
    
get_user_name(victimid,victimname,31)
    if( (
killerid == ) || (victimid == 0) )
        return 
PLUGIN_CONTINUE
    
if( (killerid == victimid ) )
        return 
PLUGIN_CONTINUE
    
    
//users should already connected and killer should be alive... duh.. >< just check for safety
    
if (!is_user_alive(killerid) || !is_user_connected(victimid))
        return 
PLUGIN_CONTINUE
    
//Reward if it's a teamkill?
    
if (get_user_team(killerid) == get_user_team(victimid) && !get_pcvar_num(amx_ok_ff))
        return 
PLUGIN_CONTINUE
    g_health
[victimid] = 100    
    
new Float:hp float(get_user_health(victimid) * -1)
    if (!
hp)
        return 
PLUGIN_CONTINUE
    
new Float:rewardhp,Float:temp,Float:reward_cap float(get_pcvar_num(amx_ok_reward_cap)),Float:perc get_pcvar_num(amx_ok_perc) / 100.0,Float:perc_capped get_pcvar_num(amx_ok_perc_capped) / 100.0,Float:tempperc
    
new inloop 1
    
    
while (inloop)
    {    
        if (
hp <= reward_cap) {
            
temp hp perc
            inloop 
0
        
}
        
        else {
            
temp reward_cap perc
            hp 
-= reward_cap
            
            tempperc 
perc
            perc 
perc perc_capped
            
//client_print(killerid,print_chat,"perc %d hp %d",perc,hp)
            
if (perc 0) {
                
tempperc perc_capped perc
                temp 
+= tempperc hp
                inloop
=0
                
//client_print(killerid,print_chat,"in loop perc < 0 **perc=%d",perc)
            
}
        }
        
        
rewardhp += temp
    
}
    
    new 
Float:maxreward float(get_pcvar_num(amx_ok_max))
    if (
maxreward)
        
rewardhp rewardhp maxreward maxreward rewardhp
    
    
new Float:health float(get_user_health(killerid))
    
health += rewardhp
    
    
new Float:life_cap float(get_pcvar_num(amx_ok_life_cap))
    if (
life_cap)
        
health health life_cap life_cap health
    
    
    
if(is_user_alive(killerid))
    {
        if(
g_health[killerid] == life_cap)
        {
            
client_print(killerid,print_chat"[OK] Could not gain any more life, you are capped! (%d)",floatround(life_cap))
        }
        else
        {
            
g_health[killerid] = (floatround(health))
            
set_user_health(killerid,floatround(health))
            
client_print(killeridprint_chat"[OK] +%dhp!",floatround(rewardhp))
        }
    }
    if(
get_pcvar_num(amx_ok_bb_enable))
    {
        if(
killerid != victimid)
        {
            
get_user_name(victimid,victimname,31)
            new 
healthtransfer g_bhealth[victimid]/2
            
if(healthtransfer 1)
                
healthtransfer 1
            
new healthloss g_bhealth[victimid]/4
            
if((g_bhealth[killerid] + healthtransfer) <= (get_pcvar_num(amx_ok_bb_cap)))
            {
                
g_bhealth[victimid] -= healthloss
                g_bhealth
[killerid] += healthtransfer
                client_print
(killerid,print_chat,"[OK] (%d)  +%d blood for killing %s.",g_bhealth[killerid],healthtransfer,victimname)
                
client_print(victimid,print_chat,"[OK] (%d) -%d blood.",g_bhealth[victimid],healthloss)
                
DisplayHud(victimid)
                
DisplayHud(killerid)
            }
            else
            {
                
g_bhealth[killerid] = (get_pcvar_num(amx_ok_bb_cap))
                
client_print(killerid,print_chat,"[OK] You could not gain any more Blood, because your current bank is full(%d)!",(get_pcvar_num(amx_ok_bb_cap)))
            }
        }
    }
    else if(
get_cvar_num("amx_ok_bb_enable") == 0)
    {
        
client_print(killerid,print_chat,"[OK] No blood rewarded, because blood bank is disabled")
        
    }
    return 
PLUGIN_CONTINUE 

nothing ever happens to player "victimid" it acts as if its not a real index, im confused
__________________
+|- KARMA Respectively


Last edited by HLM; 05-10-2010 at 03:41.
HLM is offline
 


Thread Tools
Display Modes

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 03:37.


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