Raised This Month: $ Target: $400
 0% 

[REQ] Hud Msg for alive players


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 04-29-2023 , 15:33   Re: [REQ] Hud Msg for alive players
Reply With Quote #17

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <hamsandwich>

#define PLUGIN  "Alive Player"
#define VERSION "1.0"
#define AUTHOR  "vato loco [GE-S]"

#define TASK_GETPLAYER     37852
#define SetBits(%1,%2)       %1 |= 1<<(%2 & 31)
#define ClearBits(%1,%2)   %1 &= ~(1<<(%2 & 31))
#define GetBits(%1,%2)       %1 &  1<<(%2 & 31)

new g_bitAlive
new g_SyncTeam1
new g_SyncTeam2
new g_iMaxPlayers

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled"1)
    
    
g_SyncTeam1 CreateHudSyncObj()
    
g_SyncTeam2 CreateHudSyncObj()
    
g_iMaxPlayers get_maxplayers()
    
    
set_task(0.5"GetPlayer"TASK_GETPLAYER__"b")
}

public 
client_putinserver(id)
{
    
ClearBits(g_bitAliveid)
}

public 
client_disconnected(id)
{
    
ClearBits(g_bitAliveid)
}

public 
fw_PlayerSpawn(id)
{
    if(
is_user_alive(id))
    {
        
SetBits(g_bitAliveid)
    }
}

public 
fw_PlayerKilled(id)
{
    
ClearBits(g_bitAliveid)
}

public 
GetPlayer()
{
    static 
idiTeam
    
new iPlayerTrroNumiPlayerCtNum
    
    
for(id 1id <= g_iMaxPlayersid++)
    {
        if(
GetBits(g_bitAliveid))
        {
            
iTeam get_user_team(id)
            
            switch(
iTeam)
            {
                case 
1: ++iPlayerTrroNum
                    
                
case 2: ++iPlayerCtNum
                    
            
}
            
ShowCustomSync(idg_SyncTeam1"TE vivos: %d"255000.011iPlayerTrroNum)
            
ShowCustomSync(idg_SyncTeam2"^nCT vivos: %d"01002550.012iPlayerCtNum)
        }
    }
}

ShowCustomSync(idSyncTypeMsg[], RedGreenBlueFloat:xPosChannelTeamCount
{
    
set_hudmessage(RedGreenBluexPos0.14__2.0_,  _Channel)
    
ShowSyncHudMsg(idSyncTypeMsgTeamCount)

Hello 12 years later
The code wrote by ConnorMcLeod is not working properly for me.
I have edited line 75 so the plugin shows 2 separated messages, 1 on each line.
But the plugin is not counting players as it should.
Example:
We are 20 on server, 10 vs 10.
Plugin shows 8 vs 7.
Some times we are 9 vs 8.
The plugin shows 5 vs 5.
Or like the image below:


Or any other amounts.
What can it be?
I compiled it using the latest amx 10.
I use rehlds, regame, amx10 and metamod-r.

Thank you.

Last edited by MAJESTIC_SZ; 04-29-2023 at 15:42.
MAJESTIC_SZ is offline
 


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 10:23.


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