Raised This Month: $ Target: $400
 0% 

checking for last player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zombiezzz
Veteran Member
Join Date: Nov 2009
Location: Nov 2009
Old 12-23-2009 , 00:07   checking for last player
Reply With Quote #1

I need a code that checks for last player alive. Like it gives he last player alive a M249 but it wouldnt work if there are only 4 people in the server.
Crab if you help
__________________
Zombiezzz is offline
hectorz0r
Senior Member
Join Date: Oct 2008
Old 12-23-2009 , 00:20   Re: checking for last player
Reply With Quote #2

...

Last edited by hectorz0r; 04-09-2010 at 16:35.
hectorz0r is offline
Zombiezzz
Veteran Member
Join Date: Nov 2009
Location: Nov 2009
Old 12-23-2009 , 00:21   Re: checking for last player
Reply With Quote #3

thats not realy what im looking for.
__________________
Zombiezzz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-23-2009 , 09:00   Re: checking for last player
Reply With Quote #4

Quote:
Originally Posted by Zombiezzz View Post
thats not realy what im looking for.
If you used it properly then it would work just fine.
__________________
Bugsy is offline
Zombiezzz
Veteran Member
Join Date: Nov 2009
Location: Nov 2009
Old 12-23-2009 , 11:40   Re: checking for last player
Reply With Quote #5

ill see what i can do :S ty hecktor

so your plugin has this.
PHP Code:
public GetLastPlayer( &iTerrorist , &iCT )
{
    new 
iPlayers32 ] , iNum iPlayer;
 
    
iTerrorist = -1;
    
iCT = -1;
 
    
get_playersiPlayers iNum );
 
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
 
        if ( 
is_user_aliveiPlayer ) )
        {
            switch ( 
get_user_teamiPlayer ) )
            {
                case 
1iTerrorist = ( iTerrorist == -) ? iPlayer 0;
                case 
2iCT = ( iCT == -) ? iPlayer 0;
            }
        }
    }

would it work if i do this?
PHP Code:
public GetLastPlayer( &iTerrorist , &iCT )
{
    new 
iPlayers32 ] , iNum iPlayer;
 
    
iTerrorist = -1;
    
iCT = -1;
    
get_playersiPlayers iNum );
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
 
        if ( 
is_user_aliveiPlayer ) )
        {
                 
give_item(id,, "weapon_m249")
        }
    }

__________________

Last edited by Zombiezzz; 12-23-2009 at 11:45.
Zombiezzz is offline
hectorz0r
Senior Member
Join Date: Oct 2008
Old 12-23-2009 , 13:12   Re: checking for last player
Reply With Quote #6

...

Last edited by hectorz0r; 04-09-2010 at 16:34.
hectorz0r is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-24-2009 , 09:11   Re: checking for last player
Reply With Quote #7

This will check if only one player is remaining and if so give him m249. You can add a hook to DeathMsg or Ham_Killed and call GiveM249() from within. (untested)
PHP Code:
public GiveM249()
{
    new 
iT iCT ;
    
    
GetLastPlayeriT iCT );
    
    if ( ( 
iT ) && ( iCT == -) )
        
give_itemiT "weapon_m249");
    else if ( ( 
iCT ) && ( iT == -) )
        
give_itemiCT "weapon_m249");
}

public 
GetLastPlayer( &iTerrorist , &iCT )
{
    new 
iPlayers32 ] , iNum iPlayer;
    
    
iTerrorist = -1;
    
iCT = -1;

    
get_playersiPlayers iNum );

    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        if ( 
is_user_aliveiPlayer ) )
        {
            switch ( 
get_user_teamiPlayer ) )
            {
                case 
1iTerrorist = ( iTerrorist == -) ? iPlayer 0;
                case 
2iCT = ( iCT == -) ? iPlayer 0;
            }
        }
    }

__________________

Last edited by Bugsy; 12-24-2009 at 09:18.
Bugsy is offline
Zombiezzz
Veteran Member
Join Date: Nov 2009
Location: Nov 2009
Old 12-24-2009 , 13:36   Re: checking for last player
Reply With Quote #8

ty
__________________
Zombiezzz 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 04:15.


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