PrintMessage : change Color and Timer !

Hey !

I want to create message on the user screen with HUD_PRINTCENTER, but my my message disappears too quickly… and i cant set color !

I made this :


function chatCommand( ply, text, public )

	if (string.sub(text, 1, 7) == "!rappel") then

		text = string.Explode( " ", text )
	
		for _,playername in ipairs(player.GetHumans()) do
		
			if(string.find(string.lower(playername:Name()),text[2]) != nil) then 
				
				playername:PrintMessage( HUD_PRINTCENTER, "TEST" )

			end
		end

		return(false)

	end
		
end 


hook.Add( "PlayerSay", "Say", chatCommand)

How i can color, and change my timer for this message ?

Thx dude ! :smiley:

I’m 12.

the signature you put on your post actually made me cringe and now i think you are 12.

furthermore im not sure what you mean by a timer and if i recall PrintMessage prints in blue.

if you want to add color to your messages you will need to use chat.AddText which is client side only

there are 2 ways of filtering text from server to client.

1: you can send user/net messages to the client with information on coloring and such.
2: you can send text to the user with information on coloring.

if the 2 sound similar then take a look at this:

an example of number 1 could be like this: (mimics the way my gamemodes works)



{
   {"TEST", clrWhite},
   { TEST2", clrGreen}
}


and example of number 2 could be something like:



"[clrWhite]TEST [clrGreen]TEST2"


the first one would probably be easier for you and its definitely more flexible, but if you want to make your own parser then go for number 2

Okay, i want change my Timer Because my message stay 1-2s… And its Really hard to read this.

Thx for the color, now how i can make my délay :confused:

I’m 12.

well you dont need to be rude.

as far as i know you cant edit the default time for chat messages so you will need your own chat box

Im not rude ^^ just i Need to go sleeping. I have 1 h 30 and i will work xD

Okay dude, for you, What’s its your best method to send message for specific user?

well i use my own system for that but like i said you will most likely need your own chat box for changing the time a chat message stays up, unless someone else can shed some light.

other wise just usermessages i guess

This is not a “demand and we will do” sub-forum. We will assist but not do it for you.

Yeah you can assist me if i cant make my Line…

Well, i dumb etc etc Because i want just help for a text message, i used surface or draw. Really cool forum if i Need help :+1: