Raised This Month: $ Target: $400
 0% 

How To Get All ALives and show a hudmessage saying: Enemies : X


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-22-2009 , 12:16   Re: How To Get All ALives and show a hudmessage saying: Enemies : X
Reply With Quote #7

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

#define PLUGIN "Display Number Enemies"
#define VERSION "1.0"
#define AUTHOR "bugsy"

new g_iTeamNum[4];
new 
g_iTeam[33];

public 
plugin_init()
{
    
register_pluginPLUGIN VERSION AUTHOR );
    
register_event"TextMsg" "fwEvPlayerJoinedTeam" ,  "a" "2=#Game_join_terrorist" "2=#Game_join_ct" );
    
register_event"DeathMsg" "fwEvDeathMsg" "a" );
    
register_event"HLTV" "fwEvNewRound" "a" "1=0" "2=0" );
    
RegisterHamHam_Spawn "player" "fwHamPlayerSpawnPost" );
    
    
set_task1.0 "EnemiesRemaining" ,  _,  _,  _,  "b" );
}

public 
EnemiesRemaining()
{
    new 
iPlayers[32];
    new 
iPlayersNum;
    new 
iPlayer;
    
    
get_playersiPlayers iPlayersNum "a" );
    
set_hudmessage(255255255, -1.0 0.2506.03.0);
    
    for ( new 
iPlayersNum i++ )
    {
        
iPlayer iPlayers[i];
        
show_hudmessageiPlayer "Mission: Kill %d enemies" , ( g_iTeam[iPlayer] == ) ? g_iTeamNum[2] : g_iTeamNum[1] );
    }
}    

public 
client_disconnect(id)
{
    if ( 
is_user_alive(id) )
        
g_iTeamNumg_iTeam[id] ]--;
    
    
g_iTeam[id] = 0;
}

public 
fwHamPlayerSpawnPost(iPlayer
{
    if ( 
is_user_aliveiPlayer ) ) 
        
g_iTeamNumget_user_team(iPlayer) ]++;
}

public 
fwEvNewRound()
{
    
g_iTeamNum[1] = 0;
    
g_iTeamNum[2] = 0;
}

public 
fwEvPlayerJoinedTeam()
{
    new 
szName[33];
    new 
szTeam[13];
    
read_dataszName32 );
    
read_dataszTeam 12 );
    
    new 
id get_user_index(szName);
    
    if ( 
equalszTeam "#Game_join_t" ) )
        
g_iTeam[id] = 1;
    else if ( 
equalszTeam "#Game_join_c" ) )
        
g_iTeam[id] = 2;
}

public 
fwEvDeathMsg()
{
    
g_iTeamNumg_iTeamread_data(2) ] ]--;

__________________

Last edited by Bugsy; 03-22-2009 at 12:34.
Bugsy is offline
 



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 08:52.


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