• Territories
    6 replies, posted
Hello, I know I am a new player and I will likely be looked upon as just a useless Leecher to the Community, but I am afraid I am going to ask anyway. I am currently looking for a way to have a GUI in the top left section of the screen (anywhere in all honesty) that will show territories which can be marked out in some way. For example, someone walks into a Bank, then it switches to "Government Territory", or when someone is out in the middle of the road it says "Neutral". This is a cosmetic thing I am searching for on the server and I was hoping someone could show me how to do it, or even link me to a GitHub which may hold the Addon. Regards.
[url]http://wiki.garrysmod.com/page/Derma_Basic_Guide[/url]
[QUOTE=txike;52905515][url]http://wiki.garrysmod.com/page/Derma_Basic_Guide[/url][/QUOTE] Cheers, but how could I take that and mark it out so it changes when people dwell into certain areas? [editline]19th November 2017[/editline] [QUOTE=Shendow;52905518]Since you want to draw stuff on the screen, you'd have to use the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/HUDPaint]GM:HUDPaint[/url] hook (if you don't know what a hook is, read [url=http://wiki.garrysmod.com/page/Hook_Library_Usage]this[/url]). In that hook you can draw text using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/SimpleText]draw.SimpleText[/url]. As for the logic to determine in which territory you are, it's a bit trickier. You want to loop through a table of tables of coordinates and see if your current position is in any of the boxes ([img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/WithinAABox]Vector:WithinAABox[/url]). Once that's done displaying the territory name becomes trivial because all you have to do is change a variable depending on the current territory and draw different texts accordingly. As a reference this is how I would structure my territories table. [lua] local territories = { {type = "Government", start = Vector(0, 0, 0), endpos = Vector(100, 100, 100)}, {type = "Criminal", start = Vector(200, 200, 200), endpos = Vector(400, 400, 400)}, } [/lua] You wouldn't need to make Neutral territories; for a territory to be neutral, you simply don't have to be inside one. I don't think dropping links without saying anything helps. I don't believe it's the first time you've done this either. It would help if you read the thread because making a DFrame doesn't help in this case.[/QUOTE] So after doing some fat research and learning how to do it, then actually making it. Would it have to go into the addon folder, or into the lua/autorun/server. (Sorry for the stupid question)
[QUOTE=Shendow;52905557]You can either make it an add-on or put it in lua/autorun. lua/autorun/server is for scripts that run only on the server, but since you want to make something GUI related you know it has to be clientside.[/QUOTE] With all of the information you have given me, would I have to make it all one big lua file then place it into the clientside of things on the server. I am pretty dumb but I would very much like to learn.
Sorry, you need to Log In to post a reply to this thread.