Raised This Month: $ Target: $400
 0% 

Only on first kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-18-2010 , 19:54   Re: Only on first kill
Reply With Quote #1

If the player always gets achievement on his first kill with those conditions then you can just check if has yet gotten the achievement. I don't know if you are planning on taking action in a different function on first kill so I added a separate variable. I assume you want the first kill variable reset at each player spawn?

I hope you don't mind hamsandwich. Untested.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>

const MaxPlayers 32;

new 
InfectedClassMaxPlayers ];
new 
bool:g_bHunterAchievimentMaxPlayers ];
new 
bool:g_bFirstKillMaxPlayers ];
new 
g_HUDSyncObj;

public 
plugin_init()
{
    
RegisterHamHam_Spawn "player" "fwHamSpawn_Post" );
    
RegisterHamHam_Killed "player" "fwHamKilled" );
    
    
g_HUDSyncObj CreateHudSyncObj();
}

public 
fwHamSpawn_Postid )
{
    
g_bFirstKillid ] = true;
}

public 
fwHamKillediVictim iKiller iShouldGib )
{
    if ( 
iVictim == iKiller )
        return 
HAM_IGNORED;
        
    
/*If - killers first kill
         - killer has not yet gotten achievement
         - victim is not infected class ( == 0 )
         - victim is a terrorist                 */
         
    
if( g_bFirstKilliKiller ] && !g_bHunterAchievimentiKiller ] && !InfectedClassiVictim ] && ( cs_get_user_teamiVictim ) == CS_TEAM_T ) )
    {
        
set_hudmessage(25500, -1.00.5500.02.02.01.0, -1);
        
ShowSyncHudMsgiKiller g_HUDSyncObj "[L4D]: You gained a hunter killer achievement!");
    
        
g_bHunterAchievimentiKiller ] = true;
    }
    
    
g_bFirstKilliKiller ] = false;
    
    return 
HAM_IGNORED;

__________________

Last edited by Bugsy; 05-18-2010 at 20:04.
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 03:46.


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