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: [url]http://wiki.garrysmod.com/page/Player/PrintMessage[/url]
[QUOTE=Gl1tch3t;52546685]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: [url]http://wiki.garrysmod.com/page/Player/PrintMessage[/url][/QUOTE]
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: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/DrawText]draw.DrawText[/url].
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 [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/DrawHUD]SWEP:DrawHUD[/url].
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
function SWEP:SecondaryAttack()
text = "String"
end
function SWEP:DrawHUD()
draw.DrawText(text)
end
then it draws nothing.
Just set it like a regular variable. Also, make sure this is being run clientside:
[CODE]
local text = "String"
function SWEP:SecondaryAttack()
text = "Blah"
end
function SWEP:DrawHUD()
draw.DrawText( text )
end
[/CODE]
[QUOTE=MPan1;52547117]Just set it like a regular variable. Also, make sure this is being run clientside:
[CODE]
local text = "String"
function SWEP:SecondaryAttack()
text = "Blah"
end
function SWEP:DrawHUD()
draw.DrawText( text )
end
[/CODE][/QUOTE]
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!
Sorry, you need to Log In to post a reply to this thread.