HUD_PRINTCENTER won't work, when HUD_PRINTTALK will

In my init.lua for my gamemode I have

			ply:PrintMessage( HUD_PRINTTALK, "You are a Admin. You may have all the weapons.") -- Gives the message
			ply:PrintMessage( HUD_PRINTCENTER, "You are a Admin. You may have all the weapons.") -- Gives the message

The one in the chat shows up. But the second one doesn’t. There isn’t any error in the console or the logs. Can it only be used client side? I am stumped.

When are you calling this.

inside GM:PlayerInitialSpawn

Stick a timer on it then. In initial spawn some things don’t work correctly because the LocalPlayer hasn’t spawned yet.

timer.Simple(1, ply.PrintMessage, ply, HUD_PRINTCENTER, “message”)

Might work.

if ply:IsAdmin then
ply:PrintMessage( HUD_PRINTTALK “You are a Admin. You may have all the weapons.” )
ply:Give( “gunhere” )
elseif ply:IsSuperAdmin then
ply:PrintMessage( HUD_PRINTTALK “You are a Superadmin. You may have all the weapons.” )
ply:Give( “gunhere” )
else
ply:PrintMessage( HUD_PRINTTALK “You are NOT an admin or superadmin. You may not have all the weapons.” )
end

Their is a code and it should work.

that works but the message doesn’t stay there very long. Any way to make it stay up there longer?

@nofear, that puts it in the chat area, I don’t wish to have it there.

You can do two things:

  1. Use timer.Create (see the wiki on how to use it) to make the timer run more than once. (Bad way)

  2. Send a usermessage and use the draw library to make your own system of messaging. (Good way)

  3. Try fiddling with the delay (first argument) increasing it might make it stay up for longer.

Great thanks. That is good to know. Time to get busy working then :smiley: