Hello. I have a SWEP coded, and I need to make it display some text on screen in a custom font along with custom position and color (Clientside) in a sequence ( like first “String1”, after some times “String2” and so on ) on secondary attack. I am in a dead end currently, as I have tried many ideas and none of them seem to work. Could anyone help me?
So, did you want this to be for the singular client themself, a target, every client, or something else entirely?
What exactly are you stuck on?
But anyway, this is probably what you are looking for: http://wiki.garrysmod.com/page/Player/PrintMessage
That won’t help him achieve a custom position, font, or color.
If you wanted all of that, you would need to use drawing functions like this:
And since you wanted it to display on secondary attack, then you would nee to make a secondary attack function client side, set a variable, and then draw from
Ignore last line of what I said, I misread, however, question still applies but with added clarification, what exactly are you stuck on…allowing custom text?
Thank you for pointing out my clear mistake Raven
Well, thanks for pointing out that I had to do it from SWEP:DrawHUD().
Second, right now I am stuck on the “set a variable part”. Where and how do I set it?
If i use something like
text = “String”
then it draws nothing.
Just set it like a regular variable. Also, make sure this is being run clientside:
local text = "String" function SWEP:SecondaryAttack() text = "Blah" end function SWEP:DrawHUD() draw.DrawText( text ) end
Could you explain the “make sure this is being run clientside” part? I’m very new to GLUA/LUA and GMod coding in general.
EDIT: Nevermind, a user helped me on steam forums. Consider this solved!