Wouldn't say Lua is the easiest language to learn. It all depends on the developer though.
Have you read this article about the Lua fundamentals on the Gmod wiki? If you're more of a visual learner, see if you can find some video tutorials on basic Lua.
You can learn a lot about a language just by experimenting with it. There's a bunch of code examples on the Gmod wiki you can play with.
Since you said you already know the basics, I encourage you to write some simple addons using the things you've learned so far. Use the Garry's Mod Wiki as a reference.
Here are some ideas:
- Console command that prints the nicknames of all players
- Kill every player that uses the words "kill", "dead" or "death" in a sentence
- Ulx command that tells you if any of your friends are also playing on that server
- ... (follow your curiosity)
Edit: Looking at your posts, I can see that's what you're already doing. Learning a programming language takes time. Experiment and play with them.
Hey! Sorry for the late response, I don't have loads of freetime, but I tryed to make a fix for sprays for users that can't see sprays in gmod (like me).
function ulx.fixspray( calling_ply )
calling_ply:ConCommand("r_decal_cullsize ","1")
calling_ply:ConCommand("r_decals ","200")
calling_ply:ConCommand("r_decalstaticprops ","1")
calling_ply:ConCommand("r_drawmodeldecals ","1")
calling_ply:ConCommand("r_drawbatchdecals ","1")
calling_ply:ConCommand("mp_decals ","200")
calling_ply:ConCommand("cl_playerspraydisable ","0")
calling_ply:PrintMessage( HUD_PRINTTALK, "You should now be able to see sprays, if not, try and rejoin the server!" )
end
local fixspray = ulx.command( "Menus", "ulx fixspray", ulx.fixspray, "!fixspray" )
fixspray:defaultAccess( ULib.ACCESS_ALL )
fixspray:help( "For if your spray does not work, or you can't see any sprays." )
It fixed it for me, but you need to run some local console command, is there a way to do this, as I keep getting this error when I run my !fixspray command:
FCVAR_SERVER_CAN_EXECUTE prevented server running command: r_decal_cullsize
FCVAR_SERVER_CAN_EXECUTE prevented server running command: r_decals
FCVAR_SERVER_CAN_EXECUTE prevented server running command: r_decalstaticprops
FCVAR_SERVER_CAN_EXECUTE prevented server running command: r_drawmodeldecals
FCVAR_SERVER_CAN_EXECUTE prevented server running command: r_drawbatchdecals
FCVAR_SERVER_CAN_EXECUTE prevented server running command: mp_decals
FCVAR_SERVER_CAN_EXECUTE prevented server running command: cl_playerspraydisableCan I have some help on how to make player make it run locally only on their client, and not the server itself?
Wouldn't say Lua is the easiest language to learn. It all depends on the developer though.
Have you read this article about the Lua fundamentals on the Gmod wiki? If you're more of a visual learner, see if you can find some video tutorials on basic Lua.
You can learn a lot about a language just by experimenting with it. There's a bunch of code examples on the Gmod wiki you can play with.
Since you said you already know the basics, I encourage you to write some simple addons using the things you've learned so far. Use the Garry's Mod Wiki as a reference.
Here are some ideas:
- Console command that prints the nicknames of all players
- Kill every player that uses the words "kill", "dead" or "death" in a sentence
- Ulx command that tells you if any of your friends are also playing on that server
- ... (follow your curiosity)
Edit: Looking at your posts, I can see that's what you're already doing. Learning a programming language takes time. Experiment and play with them.
The kill one keeps crashing me and others out of the server, and advantually gmod itself.
Here's the code:
function ulx.killme( ply, calling_ply )
ply:Kill()
ULib.tsayColor( nil, false, white, "", blue, ply:Nick(), white, " Just really wanted to die!" )
end
local killme = ulx.command( "Fun", "ulx killme", ulx.killme, "kill me" )
killme:defaultAccess( ULib.ACCESS_SUPERADMIN )
I think it's the
ULib.tsayColor( nil, false, white, "", blue, ply:Nick(), white, " Just really wanted to die!" ) part that crashes you as I wanted a chat message which everyone can see but instead makes everyone crash. (Did I just make a crash command? Yay xD)
I've also tryed to mess with this, it's supposed to be a coloring text changing it's color all the time.
ulx_tsay_color_table = { "hue", "black", "white", "red", "blue", "green", "orange", "purple", "pink", "gray", "yellow" }
function ulx.tsaycolor( calling_ply, message, color )
local hue = math.abs(math.sin(CurTime() *0.9) *335)
calling_ply = Color( hue, 1, 1 )
if color == "hue" then
ULib.tsayColor( nil, false, hue, message )
if util.tobool( GetConVarNumber( "ulx_logChat" ) ) then
ulx.logString( string.format( "(tsay from %s) %s", calling_ply:IsValid() and calling_ply:Nick() or "Console", message ) )
end
end
It is supposed to be something like
Chewgum's atlaschat, where you have <hsv>text</hsv>.