AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Permanant HUD Message Help (https://forums.alliedmods.net/showthread.php?t=206867)

Blizzard_87 01-26-2013 22:50

[SOLVED] Permanant HUD Message Help
 
im trying to get a Constant HUD Message Display..

using same code from my other plugins but it doesnt seem to work...

and now showing any errors in logs..

in my plugin_init()

PHP Code:

set_task(1.0"ShowHud"___"b"

and then the ShowHud(id)

PHP Code:

public ShowHud(id)
{
    if(!
is_user_alive(id))
        return;
        
    
set_hudmessage(2552552550.010.1800.01.0__, -)
    
show_hudmessage(id"%s^n%s: %i"SKINS[sz_ModelName[id]], CurrencyShop_XP[id])


any ideas?

michal123 01-27-2013 02:36

Re: Permanant HUD Message Help
 
This task hasn't got id. You must do the loop. In the global variables add:
Code:

new g_MaxPlayers;
Next add function public plugin_cfg:
Code:

public plugin_cfg(){
        g_MaxPlayers = get_maxplayers();
}

Replace your code with this:
Code:

public ShowHud(){
        for(new i = 1; i <= g_MaxPlayers; i++){
                if(is_user_alive(i)){
                        set_hudmessage(255, 255, 255, 0.01, 0.18, 0, 0.0, 1.0, _, _, -1 );
                        show_hudmessage(i, "%s^n%s: %i", SKINS[sz_ModelName[i]], Currency, Shop_XP[i]);
                }
        }
}

You can replace this:
Code:

set_task(1.0, "ShowHud", _, _, _, "b")
For:
Code:

set_task(1.0, "ShowHud",.flags = "b")
If you want do this without loop, create task in:
Code:

public client_putinserver(id)

Blizzard_87 01-27-2013 03:04

Re: Permanant HUD Message Help
 
works thanks :P...


All times are GMT -4. The time now is 20:36.

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