Raised This Month: $51 Target: $400
 12% 

Show Hud To Everyone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dakex
Junior Member
Join Date: Mar 2019
Old 03-18-2019 , 11:12   Show Hud To Everyone
Reply With Quote #1

Hi guys! I have this simple code:
PHP Code:
    SetHudTextParams(10.0,10.01.00,255,0,255);
    
ShowSyncHudText() 
But I do not know how to show the hudmessage to everyone. In Pawn I can do just simply
PHP Code:
ShowSyncHudText(0,myhandle"Welcome"
0 instead of clientID, and it would show it to everyone. Does it work this way also in SourcePawn?
Dakex is offline
farawayf
Senior Member
Join Date: Jan 2019
Old 03-18-2019 , 12:54   Re: Show Hud To Everyone
Reply With Quote #2

loop all players

PHP Code:
for (int i 1<= MAXPLAYERS 1i++)
    {
        if(
IsValidClient(i))
        {
            
ShowSyncHudText(i,myhandle"Welcome")  
        }
    } 
farawayf is offline
Dakex
Junior Member
Join Date: Mar 2019
Old 03-18-2019 , 13:04   Re: Show Hud To Everyone
Reply With Quote #3

I was Thinking about that. Thank you.
And, IsValidClient is not working for me. (SM 1.9).

Last edited by Dakex; 03-18-2019 at 13:05.
Dakex is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-18-2019 , 14:11   Re: Show Hud To Everyone
Reply With Quote #4

I highly suggest using this instead:

PHP Code:
for (int i 1<= MaxClientsi++)
{
    if(
IsClientInGame(i))
    {
        
ShowSyncHudText(i,myhandle"Welcome")  
    }

IsValidClient isn't a stock SourceMod function and can be a bad practice because what counts as a valid client is going to depend entirely on what you're doing.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-18-2019 at 14:12.
Powerlord is offline
Dakex
Junior Member
Join Date: Mar 2019
Old 03-18-2019 , 14:32   Re: Show Hud To Everyone
Reply With Quote #5

Yes you are right. Thank you very much!
Dakex is offline
Pilo
AlliedModders Donor
Join Date: Jan 2019
Location: Israel
Old 03-18-2019 , 17:35   Re: Show Hud To Everyone
Reply With Quote #6

That's doesn't matter anyway, IsValidClient is will not show for bots, IsClientInGame will show to everyone that are fully connected into the game
__________________

Taking Private(PAID) Plugins In PM
Feel free to Donate with PayPal
Feel free to message me in Discord Pilo#8253
Total donated : 25$
Pilo is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-18-2019 , 20:06   Re: Show Hud To Everyone
Reply With Quote #7

Quote:
Originally Posted by Pilo View Post
IsValidClient is will not show for bots
Again, IsValidClient isn't part of SourceMod, so what it does depends entirely on how you code it in your plugin.

Fixing it so it doesn't try to send to bots is just a matter of changing
PHP Code:
if(IsClientInGame(i)) 
to
PHP Code:
if(IsClientInGame(i) && !IsFakeClient(i)) 
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-18-2019 at 20:07.
Powerlord is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-19-2019 , 12:16   Re: Show Hud To Everyone
Reply With Quote #8

Quote:
Originally Posted by Pilo View Post
That's doesn't matter anyway, IsValidClient is will not show for bots, IsClientInGame will show to everyone that are fully connected into the game
Actually IsValidClient wont do anything since it'll error the compile since the code wasn't shared with the part that is using the stock.

oh boy here comes the IsValidClient rant.

Most of the time your IsValidClient is just doing IsClientInGame, and the other functions are returning false, like PowerLord said, it all depends on what exactly you're doing. Might as well make the IsValidClient a #define instead if you're that in love with it.

Last edited by Mitchell; 03-19-2019 at 12:16.
Mitchell is offline
Reply



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 14:42.


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