Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 03-21-2009 , 16:33   How To Get All ALives and show a hudmessage saying: Enemies : X
Reply With Quote #1

Hello i want to make a plugin that makes a hudmessage permanently saying how many enemys are alives
for example:


Mission: Kill 23 Enemies

And check each x seconds if a enemie died.
AlejandroSk is offline
Send a message via MSN to AlejandroSk
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 03-21-2009 , 17:01   Re: How To Get All ALives and show a hudmessage saying: Enemies : X
Reply With Quote #2

PHP Code:
public plugin_init() 
{
    
register_plugin("Lalin""Ni Idea""ReymonARG")
    
    static 
iStrMsg[256], StrName[32]
    for( 
1<= 32i++ )
    {
        if( 
is_user_alive(i) )
        {
            
get_user_name(iStrName31)
            
add(StrMsg255StrName)
            
add(StrMsg255"^n")
        }
    }
    
    
set_hudmessage()
    
show_hudmessage(0StrMsg)

__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 03-21-2009 , 17:50   Re: How To Get All ALives and show a hudmessage saying: Enemies : X
Reply With Quote #3

Quote:
Originally Posted by AntiBots View Post
PHP Code:
public plugin_init() 
{
    
register_plugin("Lalin""Ni Idea""ReymonARG")
    
    static 
iStrMsg[256], StrName[32]
    for( 
1<= 32i++ )
    {
        if( 
is_user_alive(i) )
        {
            
get_user_name(iStrName31)
            
add(StrMsg255StrName)
            
add(StrMsg255"^n")
        }
    }
    
    
set_hudmessage()
    
show_hudmessage(0StrMsg)

can you explain me it TT
AlejandroSk is offline
Send a message via MSN to AlejandroSk
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 03-21-2009 , 18:09   Re: How To Get All ALives and show a hudmessage saying: Enemies : X
Reply With Quote #4

PHP Code:
#include <amxmodx>

new g_iHudChannel

public plugin_init() 
{
    
register_plugin("Alive MSG""1.0""ReymonARG")
    
set_task(1.0"ShowMsg"54523__"b")
    
g_iHudChannel CreateHudSyncObj()
}

public 
ShowMsg()
{
    static 
iiCountiCount 0
    
for( 1<= 32i++ )
    {
        if( 
is_user_alive(i) )
        {
            
iCount++
        }
    }
    
    
set_hudmessage(255255255, -1.00.0506.01.00.10.1, -1)
    
ShowSyncHudMsg(0g_iHudChannel"Alives: %d"iCount)

__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Old 03-21-2009, 20:37
hleV
This message has been deleted by hleV.
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 03-22-2009 , 05:55   Re: How To Get All ALives and show a hudmessage saying: Enemies : X
Reply With Quote #5

Still would be better checking it/showing it again when player dies, not every 1 or 2 secs.
SnoW is offline
Send a message via MSN to SnoW
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 #6

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


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