• ent:GetPrintName() broken?
    5 replies, posted
For some reason wep:GetPrintName() return GRENADE but when I do draw.DrawText( wep:GetPrintName() ) it turns it into #HL2_Grenade. Opposite thing happens in my PostDrawOpaqueRenderables hook where surface.GetTextSize( wep:GetPrintName() ) returns the scale of #HL2_Grenade and then when I draw the text it makes it into GRENADE which causes the scaling to be incorrect. [IMG]https://i.imgur.com/McfVlfw.png[/IMG] [B]This only happens with non-lua weapons.[/B]
Try at the beginning of the PostDrawOpaqueRenderables hook to have a local variable called "name" or something that is the GetPrintName() so the string remains the same. Also mind showing some of the code? Where did you get wep?
[QUOTE=Ubre;52781922]Try at the beginning of the PostDrawOpaqueRenderables hook to have a local variable called "name" or something that is the GetPrintName() so the string remains the same. Also mind showing some of the code? Where did you get wep?[/QUOTE] [code] local texty = wep:GetPrintName() local textwide, texthigh = surface.GetTextSize( texty ) print("texty") [/code] Thats how I set it all up. I wont use HL2 weapons anyways so I might just ignore this problem.
Not sure if you did it on purpose but having a print("texty") won't print the texty variable but it will just print "texty" as it's a string. Anyways, you haven't told me if it works yet.
Strings that start with # go through automatic translation. Might be a bug if it's not measuring their size of the text properly.
[QUOTE=wh1t3rabbit;52782710]Strings that start with # go through automatic translation. Might be a bug if it's not measuring their size of the text properly.[/QUOTE] To extend on this, it is getting the length of the #<text> not the translated outcome, to get the outcome you can use this; [url]http://wiki.garrysmod.com/page/language/GetPhrase[/url]
Sorry, you need to Log In to post a reply to this thread.