AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with HUD (https://forums.alliedmods.net/showthread.php?t=221196)

connoisseur 07-19-2013 03:56

Help with HUD
 
I need to display a HUD message which stays permanently on the screen and will update automatically, when some variable's value changes.
Example Plugin:Show Admins Online
I went through its source and found sync-hud, but I'm new to scripting and din't get the mechanism to use it.
Also it had some register_think value which I don't understand yet.
Tried to search about sync-hud but couldn't find any useful info.
Can someone explain how the sync-hud works?

K1d0x 07-19-2013 05:24

Re: Help with HUD
 
What you try to do?

connoisseur 07-19-2013 06:04

Re: Help with HUD
 
Quote:

Originally Posted by K1d0x (Post 1994269)
What you try to do?

I'm trying to display the number of alive players in a HUD message that stays permanently, and updates instantly when the number of alive players change.

_Pro_ 07-19-2013 07:53

Re: Help with HUD
 
The flag "b" is to be replayed forever, you can stop de task seting an ID and make remove_task(ID)
PHP Code:

set_task(1.0"PermanentHud"0__"b")

public 
PermanentHud()
{
    
set_hudmessage(25500, -1.00.3506.01.00.00.0)
    
show_hudmessage(0"Players Alive: %d"cts)


Sorry for my bad english :C

connoisseur 07-19-2013 10:05

Re: Help with HUD
 
Quote:

Originally Posted by _Pro_ (Post 1994329)
The flag "b" is to be replayed forever, you can stop de task seting an ID and make remove_task(ID)
PHP Code:

set_task(1.0"PermanentHud"0__"b")

public 
PermanentHud()
{
    
set_hudmessage(25500, -1.00.3506.01.00.00.0)
    
show_hudmessage(0"Players Alive: %d"cts)


Sorry for my bad english :C

Thanks for the idea, but you see, I already know this way.
I was actually looking forward to learn the sync-hud method.
Plus this one includes set_task which will be CPU consuming.
Sync-hud method, which I observed didn't use set_task.

Quote:

Originally Posted by LordOfNothing (Post 1994337)
xLoL , You dont need to determinate the number of players ? just put %d an cts and thats all ??

No need of that, I have already coded that part. I was just searching for a way to display permanently.

AwesomeMan 07-19-2013 10:15

Re: Help with HUD
 
Code:

public plugin_init()
{
        register_event("HLTV", "asd", "a", "1=0", "2=0");
        RegisterHam(Ham_Killed, "player", "asd", true);
        RegisterHam(Ham_Spawn, "player", "asd", 1)
}
public asd()
{
        set_hudmessage(255, 255, 255, -1,0 0.00, 0, 6.0, 9999.0)
        show_hudmessage(0, "Admins Online: %d", adminonline)

This is one way, it will update everytime someone dies, new round and when someone spawns. This might not be the best way and I didn't test it if it will work.

connoisseur 07-19-2013 10:25

Re: Help with HUD
 
Quote:

Originally Posted by AwesomeMan (Post 1994402)
This is one way, it will update everytime someone dies, new round and when someone spawns. This might not be the best way and I didn't test it if it will work.

Thanks for that idea, but again I'm trying to learn the "sync-hud" way here.
Please suggest a display using sync-hud only.

K1d0x 07-19-2013 10:48

Re: Help with HUD
 
PHP Code:

SyncHudMessage(id255100501.01.0006.0__3"Alive Players: %i"players


connoisseur 07-19-2013 12:24

Re: Help with HUD
 
Quote:

Originally Posted by K1d0x (Post 1994433)
PHP Code:

SyncHudMessage(id255100501.01.0006.0__3"Alive Players: %i"players


Some explanation would be great.
There was more sync hud stuff which i saw, than this statement.
And more importantly how to use it to update the value automatically :?:

K1d0x 07-19-2013 12:28

Re: Help with HUD
 
Why you want to use synchud and you don't want to use set_hudmessage?


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

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