AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hud Messages don't work (https://forums.alliedmods.net/showthread.php?t=251305)

Andu. 11-10-2014 10:13

Hud Messages don't work
 
Hi, i have a problem with this code:

PHP Code:

        set_hudmessage(422552550.010.9406.01.0);
        
ShowSyncHudMsg(id,SyncHudMessage"HP : %d       AP : %d"pev(idpev_health),get_user_armor(id));
        
        
set_hudmessage(422552550.010.8006.01.0);
        
ShowSyncHudMsg(id,SyncHudMessage"Credits : %d"Credits[id]); 

Why it show only last message?

ImYourBro 11-10-2014 10:33

Re: Hud Messages don't work
 
You need to post the full code or i cant try to help you.

jimaway 11-10-2014 12:54

Re: Hud Messages don't work
 
showing both messages on the same channel, second message overwrites first one

zmd94 11-10-2014 20:07

Re: Hud Messages don't work
 
Then, you need to send the message using different channel. ;)

.Dare Devil. 11-11-2014 02:23

Re: Hud Messages don't work
 
Quote:

Originally Posted by zmd94 (Post 2222643)
Then, you need to send the message using different channel. ;)

Quote:

Originally Posted by jimaway (Post 2222492)
showing both messages on the same channel, second message overwrites first one

Channel default value for hudmessage is -1 if you don't set it.
It means random.

The thing what is overwriting is variable SyncHudMessage.
You need 2 different sync object to show 2 hudmessages at same time.

zmd94 11-11-2014 04:12

Re: Hud Messages don't work
 
.Dare Devil., do you mean like this?
Code:

        set_hudmessage(42, 255, 255, 0.01, 0.94, 0, 6.0, 1.0);
        ShowSyncHudMsg(id,SyncHudMessage1, "HP : %d      AP : %d", pev(id, pev_health),get_user_armor(id));
       
        set_hudmessage(42, 255, 255, 0.01, 0.80, 0, 6.0, 1.0);
        ShowSyncHudMsg(id,SyncHudMessage2, "Credits : %d", Credits[id]);


Jhob94 11-11-2014 04:32

Re: Hud Messages don't work
 
Quote:

Originally Posted by .Dare Devil. (Post 2222689)
Channel default value for hudmessage is -1 if you don't set it.
It means random.

The thing what is overwriting is variable SyncHudMessage.
You need 2 different sync object to show 2 hudmessages at same time.

As far as i know, it will type one over the other. Wont delete, but that isnt what he wants either...

Andu, dont make 2 hud, here what you do need is to put ^n at the end of first hud and put the second one after it.

PHP Code:

set_hudmessage(422552550.010.9406.01.0);
        
ShowSyncHudMsg(id,SyncHudMessage1"HP : %d       AP : %d ^nCredits : %d"pev(idpev_health),get_user_armor(id), Credits[id]); 


zmd94 11-11-2014 04:42

Re: Hud Messages don't work
 
Quote:

Originally Posted by Jhob94 (Post 2222706)
PHP Code:

set_hudmessage(422552550.010.9406.01.0);
        
ShowSyncHudMsg(id,SyncHudMessage"HP : %d       AP : %d ^nCredits : %d"pev(idpev_health),get_user_armor(id), Credits[id]); 


This is better. :up:

I forgot already, that actually we have ^n.

Jhob94 11-11-2014 05:57

Re: Hud Messages don't work
 
Yeah, i did right. Now, WHERE IS MY COOKIE?

zmd94 11-11-2014 06:09

Re: Hud Messages don't work
 
Sorry, Jhob94. "Firefox" has kept the cookies. You need to ask "him" if you want it.

http://img.ctrlv.in/img/14/11/11/5461ed8f5dfa0.jpg

By the way, pev(id, pev_health) can be changed into get_user_health(id).


All times are GMT -4. The time now is 17:32.

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