Raised This Month: $ Target: $400
 0% 

Only on first kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 05-18-2010 , 15:33   Only on first kill
Reply With Quote #1

How to detect if Survivor killed a hunter first time and the survivor gets a achieviment , but only when first time , and save if that player has an achieviment

PHP Code:
public plugin_init()
{
        
register_event("DeathMsg""event_deathmsg3""a")
}

public 
event_deathmsg3(id)
{
        new 
victim read_data(2)
        new 
attacker read_data(1)

        if(
get_user_team(victim) == CS_TEAM_T && InfectedClass[victim] == 0)
        {
                
set_hudmessage(25500, -1.00.5500.02.02.01.0, -1);
                
ShowSyncHudMsg(attacker"[L4D]: You gained a hunter killer achieviment!");

                
HunterAchieviment[attacker] = true;
        }

DoviuX is offline
Send a message via Skype™ to DoviuX
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 #2

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
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 05-19-2010 , 07:27   Re: Only on first kill
Reply With Quote #3

Thanks , but i need that the server save if player already gotten the achieviment and when he came back to the server he still had that achieviment.
DoviuX is offline
Send a message via Skype™ to DoviuX
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-19-2010 , 08:45   Re: Only on first kill
Reply With Quote #4

Quote:
Originally Posted by DoviuX View Post
Thanks , but i need that the server save if player already gotten the achieviment and when he came back to the server he still had that achieviment.
Does this reset at map change?
__________________
Bugsy is offline
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 05-19-2010 , 08:13   Re: Only on first kill
Reply With Quote #5

By the way when i kill not hunter but something like boomer it gives achievement
DoviuX is offline
Send a message via Skype™ to DoviuX
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 05-19-2010 , 08:53   Re: Only on first kill
Reply With Quote #6

Yes , or when player reconnects.

And what about when i kill zombie not hunter but another class zombie it still show that i killed hunter.
DoviuX is offline
Send a message via Skype™ to DoviuX
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-19-2010 , 09:21   Re: Only on first kill
Reply With Quote #7

Quote:
Originally Posted by DoviuX
[..] and when he came back to the server he still had that achieviment.
Quote:
Originally Posted by bugsy
Does this reset at map change?
Quote:
Originally Posted by DoviuX View Post
Yes , or when player reconnects.
You contradict yourself, unless I am just not understanding you. You say you want it to remember achievement if he reconnects, then you say reset the achievement at map change or when player reconnects.
__________________
Bugsy is offline
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 05-19-2010 , 10:53   Re: Only on first kill
Reply With Quote #8

What i mean is player gets the achieviment when kills hunter (but when you kill even not hunter you get the achieviment) and he disconnects or map restarts he still had that achieviment. Something like xp in nVault.
DoviuX is offline
Send a message via Skype™ to DoviuX
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-20-2010 , 08:49   Re: Only on first kill
Reply With Quote #9

Quote:
Originally Posted by DoviuX View Post
What i mean is player gets the achieviment when kills hunter (but when you kill even not hunter you get the achieviment) and he disconnects or map restarts he still had that achieviment. Something like xp in nVault.
Ok so explain what you want...

?

Player dies - keep achievement
player reconnect - keep achievement
map\server restart - keep achievement
__________________
Bugsy is offline
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 05-20-2010 , 11:49   Re: Only on first kill
Reply With Quote #10

Yes , and there is one problem when i kill not hunter but another class zombie i still get the achieviment.
DoviuX is offline
Send a message via Skype™ to DoviuX
Reply


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:46.


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