Raised This Month: $ Target: $400
 0% 

i need help with HUD Messages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-12-2011 , 03:34   i need help with HUD Messages
Reply With Quote #1

I want to man who made someone action (for example, set the bomb) was one of HUD message, but for everyone else - other

like:
for man who set up the bomb - You set up the bomb!
for everyone - %s set up the bomb!

I need help!
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-12-2011 , 03:42   Re: i need help with HUD Messages
Reply With Quote #2

Show the 1 HUD message to the player by the player id.
Loop through all players and check for player ids that are not the same as the planter's player id and show the other message.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-12-2011 , 03:47   Re: i need help with HUD Messages
Reply With Quote #3

i need in examples
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 02-12-2011 at 03:56.
GordonFreeman (RU) is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-12-2011 , 03:54   Re: i need help with HUD Messages
Reply With Quote #4

No. I told you exactly what to do. It isn't hard to grasp.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-12-2011 , 03:56   Re: i need help with HUD Messages
Reply With Quote #5

please give me examples
__________________
The functional way is the right way
GordonFreeman (RU) is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-12-2011 , 04:18   Re: i need help with HUD Messages
Reply With Quote #6

Don't use get_user_team, it gives false results.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-12-2011 , 04:23   Re: i need help with HUD Messages
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
Don't use get_user_team, it gives false results.
I already knew

but give me examples please please... its not hard
__________________
The functional way is the right way
GordonFreeman (RU) is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-12-2011 , 04:32   Re: i need help with HUD Messages
Reply With Quote #8

This example directly checks against terrorist team because only Ts can plant, else, cache the player team and check against that team.

If you don't want to print the message with same colors for teamates than for player, then use again set_hudmessage once before the loop, you don't need to use it in each iteration.

PHP Code:
public Random_Player_Planted_Bomb_Handler(id)
{
    
set_hudmessage(Random Values// set only 1 times colors

    
show_hudmessage(id"You have planted the bomb !!!")

    new 
iPlayers[32], iNumiPlayer
    get_players
(iPlayersiNum"ch"// Don't collect bots ("c") nor HLTVs ("h")

    
new szName[32]//, CsTeams:iTeam = cs_get_user_team(id)
    
get_user_name(idszNamecharsmax(szName))
    for(new 
ii<iNumi++)
    {
        
iPlayer iPlayers[i]
        if( 
iPlayer != id && cs_get_user_team(iPlayer) == /* iTeam */ CS_TEAM_TERRORIST )
        {
            
show_hudmessage(iPlayer"%s has planted the bomb !!!"szName)
        }
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-12-2011 at 05:46.
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-12-2011 , 04:50   Re: i need help with HUD Messages
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
    show_hudmessage(iPlayer"You have planted the bomb !!!"
iPlayer id
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 02-12-2011 , 05:42   Re: i need help with HUD Messages
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
Don't use get_user_team, it gives false results.
https://forums.alliedmods.net/showthread.php?t=137996

When I want to use get_user_team, then I use your code.
Lulu the hero 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:19.


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