Garry's Mod

Garry's Mod

gTerminal Universal
 This topic has been pinned, so it's probably important
Zanik231  [developer] 6 Aug @ 4:31pm
Addon guide
// Also you can use other gmod lua functions, but addon have some own lua functions.
MOD
:f sound_play command
Simple file for :f sound_play <filename>:
600 1000
700 1000
800 1000
0 1000
1000 1000
2000 1000
2500 1000
P.S first value is frequency, second is time of playing. Frequency: Min: 37 Max: 32767

CODING
How to write own program

First you need root computer it's only computer where you can write lua files
You need :f touch NAME.lua or :f luapad NAME.lua for create file and write code (luapad is better for coding)

In editor you need create main function for better leave from program(exit not present in mod)

Example:
local function main()
// Main function start
end
main()

All code you need to write in function main
For stop program you need to write return

FUNCTIONS:

print(arg) - It's simple console output command, where arg is text of output
colorPrint(arg, color) - It's another console output command, but with index colored text
Example: colorPrint("Hello World", GT_COL_SUCC)

Indexex:
GT_COL_NIL - nil, gray text
GT_COL_MSG - simple white text
GT_COL_WRN - yellow text
GT_COL_ERR - red text
GT_COL_INFO - blue text
GT_COL_INTL - cyan text
GT_COL_CMD - gray text (brighter than nil)
GT_COL_SUCC - green text

input() - input command, return string of inputed text
Example: local a = input()

input(true) - same as input() but inputed text not appearing in console
getch() - input one char(symbol) command, return string with one letter
getch(true) - same as getch() but inputed text not appearing in console

sleep(milliseconds) - terminal nothing do for given time

nativePrint( ... ) - Standart lua print into server console

beep(frequency, duration) - Play beep sound with pc speaker and when playing stop pc
beepAsync(frequency, duration) - Play beep sound with pc speaker (not stop pc)

table.HasValue(entity.periphery, "sent_pc_spk") -

gTerminal:Broadcast(entity, text, colorType, position, xposition, onlyColor) - check what this do in source code (low level print)

VARIABLES:

entity - terminal entity
client - player entity who use terminal (maybe some buggy, entity:GetUser() is better)
arguments - console arguments (table-array type) (maybe some buggy, and don't recomended to use)
spk - boolean value, contain true if pc_speaker is connected

This guide may update with new addon updates
Last edited by Zanik231; 11 Aug @ 2:58pm
< >
Showing 1-2 of 2 comments
my god, thanks, the gtasm is now based on assembly and is buggy, this is understandable, many thanks
Zanik231  [developer] 7 Aug @ 10:58am 
Originally posted by 7H3_HuN73R-03:
my god, thanks, the gtasm is now based on assembly and is buggy, this is understandable, many thanks
:resmile:
< >
Showing 1-2 of 2 comments
Per page: 1530 50