Post Your: First Lua Project

http://puu.sh/bam6q/810b186051.png

Everyone has to start somewhere, some people (including me) start with hacks, other people start with derma while others start with simple gamemodes…
Regardless of how you started, this it a thread where you can post your ridiculously crappy first attempts at lua scripting for our enjoyment.

I’ll go first, my first hack ever made, man… I was so happy I learned how :ToScreen() works.
[img_thumb]http://puu.sh/bamCP/8672a6fe8c.png[/img_thumb]

This was the first thing ever I released for GMod.

Funny part is, I didn’t even create it, I edited this:

Let’s see if anyone can beat crappiness of my first ever release. :v:

You said Lua not Glua.

This, I suppose.

My first attempt at Lua ended with the code:

[lua]
function GM:PlayerNoClip(ply)
return ply:IsAdmin()
end
[/lua]

I didn’t touch Lua again until a few months later, so I suppose this counts.

My first project was adding energy to gemstone printers.

http://forum.facepunch.com/showthread.php?t=1011100

(not so) sadly, I don’t think there are any pictures left over

Omg people’s first project…
This should be good.
Anyways, I belive I made this crappy piece of shit before anything else


hook.Add( "PlayerSay", "Help", function( ply, text, team )
	if ( string.sub( text, 1, 5 ) == "/help" ) then--if ( the first 5 letters are /help continue
	Panel:OpenURL( http://techsource.dk/forum/general-52/how-to-play )
	return
	end
end )

Oh god…Almost 3 years and 1 month ago…

My first project (That lead to at least 5 server-crashes) was a steamgroup scanner that should promote people in my steamgroup and demote if they leave.
I didn’t knew back then how to store the steam64IDs in a table … so I had a 1800+string in a text-file and used string.find to detect people.
Massive lagspikes.

Most of the stuff here.

If TTT weapons count, then that. If not, I made some shitty TTT scripts that didn’t work and posted the code here on my brother’s account like a year back. I’ll try to find it.

EDIT: Found the scripts, they look absolutely lovely:
[lua]
–Disconnect:
function notifyDisconnect( ply )
PrintMessage( HUD_PRINTTALK, ply:GetName() … " ( SteamID: " …ply:SteamID() … " ) has left the game. /n "
end

hook.Add( “PlayerDisconnected”, “notifyDisconnect”, notifyDisconnect );

–DeathNotifier:
roles={}
roles[1]=“ROLE_INNOCENT”
roles[2]=“ROLE_TRAITOR”
roles[3]=“ROLE_DETECTIVE”

function informDead( victim, weapon, killer )
if victim:GetRole == killer:GetRole or victim:GetRole == roles[1] and killer:GetRole == roles[1] or victim:GetRole == roles[1] and killer:GetRole == roles[3] or victim:GetRole == roles[3] and killer:GetRole == roles[1] then
local deathState = “teamkilled”
else local deathState = “killed” end

victim:PrintMessage( HUD_PRINTTALK, "You were " ..deathState.. " by" ..killer.. " [ " ..killer:GetRole().. " ] using " ..weapon.. ". /n"
killer:PrintMessage( HUD_PRINTTALK, "You " ..deathState.. " " ..victim.. " [ " ..victim:GetRole().. " ]"

if deathState == "teamkilled" then
	victim:PrintMessage( HUD_PRINTTALK, "Were you RDMed? If so, type !report in chat to report the RDMer /n"
else end

end

hook.Add( “PlayerDeath”, “getKiller”, informDead );

–!report:

function reportRDM( ply, text, public )
if (string.sub(text, 1, 7) == "!report ") then
return "@ "…string.sub( text, 8 );
end
end

hook.Add( “PlayerSay”, “reportRDM”, reportRDM );
[/lua]

my first lua project ever
[lua]
print"(hello world)"
[/lua]

So I found out that admins on darkrp were pretty dumb and couldn’t trace you down if you did /rpname something random after you rdmed/propkilled.
After a while I got annoyed by having to come up with new names in seconds and then manually typing them out, so I started looking into lua and made a script for it

You can see it evolve from being preset names (still love what I came up with) to generating them from a list of first and last names.
The most recent verison in the new repo generates them from parts of names that other players on the server have. (Has the “nice” side effect of getting legit players banned :v)

I know of admins who are still thay dumb :v: anyways I just edited a bunch of addons to do what I wanted lol

this was one of my first “projects”



function sex( ply, text )
	if( string.sub( text, 1, 4 ) == "!sex" ) then
		ply:PrintMessage( HUD_PRINTCENTER, "You got aids, and died :( " )
		ply:Kill()
		return ""
	end
end
hook.Add( "PlayerSay", "getaidsyo", sex)


:v: :v:

Oh, god… I found something even older…
[img_thumb]http://puu.sh/bawZP/5e2005a540.png[/img_thumb]

This was the first thing I ever made:

http://i.gyazo.com/f41bb9c6c060b4a141482f41cb781092.png

I was so proud of this HUD when I made it by copy pasting functions from a free HUD… Even though it only worked at 1080p…

first lua project was on a harddrive that I don’t have anymore, but it was a shitty team 1 v team 2 type gamemode, before I could do any amount of derma, SWEP/ENT creation, or anything considered “intermediate”. Needless to say it sucked ass.

I should redo it.