Hello GMAD! This is my first post so go Easy on me!
So I am trying to use a custom font on a friend's server we are working on and I have followed the advice of this thread: [[url]https://facepunch.com/showthread.php?t=1196247][/url]
& this article on the wiki [[url]http://wiki.garrysmod.com/page/surface/CreateFont][/url]
In the end I imported this font [[url]http://www.fontspace.com/tension-type/overspray][/url] to [B]\garrysmod\resource\fonts[/B]
And added this import code:
[CODE]resource.AddFile("resouce/fonts/Overspray.ttf")[/CODE]
After this I attempted to initialize the font with this call [B](This is where the issue lies) [/B]
[CODE]surface.CreateFont( "Overspray", {
font = "Overspray",
extended = false,
size = 13,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
})[/CODE]
And then I referenced the font in the Draw object's DrawText method using this code:
```
[CODE]draw.DrawText(War:GetTeamName(2), "Oversprayed", CenterX + 20, CenterY + fontsize * 0.5, Color(255, 255, 255, 100), TEXT_ALIGN_LEFT)[/CODE]
```
[I]Much of the above information is not necessary to understand what went wrong but I have included it for those curious. [/I]
The error is:
[U][ERROR] addons/war/lua/autorun/wars.lua:7: attempt to index global 'surface' (a nil value)
1. unknown - addons/war/lua/autorun/wars.lua:7[/U]
--------------------
I think this might be because I am running a client side script on the server side.
[B][I]Why I present this to you, is that I have no clue how to solve it!! [/I][/B]
--------------------
THANKS IN ADVANCE
-Texas Writer
Put the clientside file in lua/autorun/client instead of autorun or server.
Also, you can remove all of these since they are set by default:
[CODE]
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
[/CODE]
Sorry, you need to Log In to post a reply to this thread.