Raised This Month: $ Target: $400
 0% 

Please help code dosent works


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-05-2014 , 20:44   Re: Please help code dosent works
Reply With Quote #6

The newround event doesn't provide a client-parameter, stop adding one.
Also your else-if() is the same as a regular else() in this case.

I optimized some things for you. Every time a CT becomes the last CT or the last CT kills someone, he gets the hudmessage.

PHP Code:
#include < amxmodx >  
#include < cstrike >  
#include < hamsandwich >  

new iLastCTKillsiLastCT 

public plugin_init()  

    
RegisterHam(Ham_Killed"player""hamKilledPost"true 
     
    
RegisterHam(Ham_TakeDamage"player""hamTakeDamagePre"false 

    
register_logevent("eventRoundStart"2"1=Round_Start"


public 
searchLastCT()
{
    new 
iPlayers[32], iNum   
     
    get_players
(iPlayersiNum"ae""CT")   

    if(
iNum == 1)   
    {   
        
iLastCT iPlayers[0]  
        return 

    


    return 
0
}
     
public 
eventRoundStart() 

    
iLastCT = -
    iLastCTKills 

     
    
if(searchLastCT()) Information(iLastCT)


public 
client_disconnect(id)
{
    if(
cs_get_user_team(id) == CS_TEAM_CT)
    {
        if(
searchLastCT()) Information(iLastCT)
    }
}

public 
hamKilledPost(victimattackershouldgib

    if(
iLastCT == -&& cs_get_user_team(victim) == CS_TEAM_CT 
    {
        if(
searchLastCT()) Information(iLastCT)
    } 
     
    if( 
attacker == iLastCT && iLastCTKills 10 && cs_get_user_team(victim) == CS_TEAM_T 
    { 
        
iLastCTKills += 1
        
Information(iLastCT)
    } 
     
    return 
1


public 
hamTakeDamagePre(const victim, const inflictor, const attackerFloat:damage, const iDamageType)  

    if( 
victim == attacker 
        return 
HAM_IGNORED 

    
if(attacker != iLastCT 
        return 
HAM_IGNORED 
     
    SetHamParamFloat
(4damage * (iLastCTKills 0.1 ) ) 
         
    return 
HAM_IGNORED
}   

public 
Informationclient 

    if( !
is_user_aliveclient ) ) 
        return 
PLUGIN_CONTINUE
         
    new 
szBar[11]

    for(new 
0iLastCTKillsi++)
    {
        
szBar[i] = '+';
    }

    for(new 
iLastCTKills10i++)
    {
        
szBar[i] = '-';
    }

    
set_hudmessage025500.300.7806.01.0 )       
    
show_hudmessageclient"Power Attack [ %i%% ]^n [ %s ]"100 iLastCTKills 10szBar
     
    return 
PLUGIN_CONTINUE


Last edited by mottzi; 07-05-2014 at 20:45.
mottzi is offline
Send a message via MSN to mottzi
 



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 21:14.


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