Raised This Month: $ Target: $400
 0% 

A way to update hud_list


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 09-11-2013 , 10:45   A way to update hud_list
Reply With Quote #1

Hi modders, i need to check what a better solution to update an hud_list..


Actually i have this method:

PHP Code:
// plugin_init

register_event("ResetHUD","HudList","b");

// Other ways
public client_authorized(idHudList();
public 
client_putinserver(idHudList();
public 
client_infochanged(idHudList();
public 
client_disconnect(idHudList(); 
and this function:

PHP Code:

public HudList();
{
    
ReadyDisplay(999.0);
}

public 
ReadyDisplay(Float:fTime)
{
    new 
szReady[1056],szNotReady[1056],szName[32];
    
    new 
iPlayers[32],iNum,Players;
    
get_players(iPlayers,iNum,"ch");
    
    new 
iReadys;
    
    for(new 
i;iNum;i++)
    {
        
Players iPlayers[i];
        
        
get_user_name(Players,szName,charsmax(szName));
        
        if(
PUG_iReady[Players])
        {
            
iReadys++;
            
            
formatex(szReady,charsmax(szReady),"%s%s^n",szReady,szName);
        }
        else 
formatex(szNotReady,charsmax(szNotReady),"%s%s^n",szNotReady,szName);
    }
    new 
iMinPlayers get_pcvar_num(PUG_MinPlayers);

    
set_hudmessage(255,0,0,0.23,0.02,0,0.0,fTime,0.0,0.0,3);
    
show_hudmessage(0,"Not Ready (%d of %d):",PUG_GetPlayers() - iReadys,iMinPlayers);

    
set_hudmessage(0,255,0,0.58,0.02,0,0.0,fTime,0.0,0.0,2);
    
show_hudmessage(0,"Ready (%d of %d):",iReadys,iMinPlayers);

    
set_hudmessage(255,255,225,0.58,0.05,0,0.0,fTime,0.0,0.0,1);
    
show_hudmessage(0,szReady);

    
set_hudmessage(255,255,225,0.23,0.05,0,0.0,fTime,0.0,0.0,4);
    
show_hudmessage(0,szNotReady);

My doubt is: I need this to not use a repeated set_task, and really update list when player do some action..

It is sane and secure to replace all commands with register_forward(FM_Think,"HudList"); ?

I think have other ways to do this, when a forward called or player make some action.
Thanks.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
 


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 18:46.


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