AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How To Get All ALives and show a hudmessage saying: Enemies : X (https://forums.alliedmods.net/showthread.php?t=88206)

AlejandroSk 03-21-2009 16:33

How To Get All ALives and show a hudmessage saying: Enemies : X
 
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.

AntiBots 03-21-2009 17:01

Re: How To Get All ALives and show a hudmessage saying: Enemies : X
 
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)



AlejandroSk 03-21-2009 17:50

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

Originally Posted by AntiBots (Post 786050)
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

AntiBots 03-21-2009 18:09

Re: How To Get All ALives and show a hudmessage saying: Enemies : X
 
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)



SnoW 03-22-2009 05:55

Re: How To Get All ALives and show a hudmessage saying: Enemies : X
 
Still would be better checking it/showing it again when player dies, not every 1 or 2 secs.

Bugsy 03-22-2009 12:16

Re: How To Get All ALives and show a hudmessage saying: Enemies : X
 
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) ] ]--;




All times are GMT -4. The time now is 08:52.

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