• My first real lua script
    114 replies, posted
Wow... only 6 months of practice and you already got great derma, and are a brilliant coder... cant wait to see your future stuff!
[QUOTE=The Kitteh;27333225]Wow... only 6 months of practice and you already got great derma, and are a brilliant coder... cant wait to see your future stuff![/QUOTE] Not trying to insult anybody but Lua is a very simple language. But this is indeed a very exceptional first release.
Thanks! I realy appreciate this. And, I trough the file.Write, I added a new tab reading trough file.Read and adding it as a line: [URL=http://img824.imageshack.us/i/45966433.png/][IMG]http://img824.imageshack.us/img824/2456/45966433.png[/IMG][/URL]
[QUOTE=Nexus435;27333524]Not trying to insult anybody but Lua is a very simple language. But this is indeed a very exceptional first release.[/QUOTE] I agree it is very simple, but coming into it without knowing another language can be confusing.
Well yeah, I've had some problem with Lua. I wish I knew more languages, as I don't have any chance teaching it here in my country.
[QUOTE=Nexus435;27333524]Not trying to insult anybody but Lua is a very simple language. But this is indeed a very exceptional first release.[/QUOTE] Indeed. But learning the hooks is not as easy as learning Lua itself.
[QUOTE=Skuch;27333789]Indeed. But learning the hooks is not as easy as learning Lua itself.[/QUOTE] I had most hooks and functions memorised before I knew Lua very well.
[QUOTE=Persious;27327134]Yeah, I could do the gag. About the SteamID's I could simple save it as file.Write and get it to save it like: [code] Persious | STEAM_0:1:123456 [/code][/QUOTE] [lua]hook.Add("PlayerInitialSpawn", "SaveName", function( ply ) SID = ply:SteamID() name = ply;Nick() filex.Append("NamesandSteamIDS.txt", name.." | "..SID.."\n") end)[/lua] something like that maybe
I already made the save save (:
You really did good, I honestly expect to see this used on a lot of servers.
Thanks.. (:
I'm really liking that derma, so nice and clean!
Thanks for your comment. (: [editline]10th January 2011[/editline] I added a kill log now. But I got a problem here. [b]init.lua[/b] [lua] function playerDies( victim, inflictor, attacker ) if attacker == victim then filex.Append("DPMod/logs/log.txt", attacker:Name() .. " suicided" .. "\n") else filex.Append("DPMod/logs/log.txt", attacker:Name().." killed "..victim:Name().. "\n") end end hook.Add( "PlayerDeath", "playerDeathTest", playerDies ) [/lua] [b]Now I'm running file.Read in a DListView:[/b] [lua] local DPModDListView6 = vgui.Create("DListView") DPModDListView6:SetParent(Kill) DPModDListView6:SetPos(3, 5) DPModDListView6:SetSize(343, 400) DPModDListView6:SetMultiSelect(false) DPModDListView6:AddColumn("Attacker, Victim & Weapon") DPModDListView6:AddLine( file.Read("DPMod/logs/log.txt") ) [/lua] But it end's like this: [URL=http://img228.imageshack.us/i/40128526.png/][IMG]http://img228.imageshack.us/img228/8458/40128526.png[/IMG][/URL]
Probably a bad way to do it but define all the log records as [lua] local logrecs = string.Explode("/n",file.Read("DPMod/logs/log.txt")) [/lua] then loop through logrcs and add each one to the DListView ie [lua] for _, log in ipairs(logrecs) do DPModDListView6:AddLine( log ) end [/lua]
[QUOTE=decyg;27344997]/n[/QUOTE] :raise:
Do what decyg said, although use \n instead of /n. Or you could force set the height of the row to be as tall as it needs, but that seems pointless.
Your log is close to useless without any time nor date. You should split up the logs per day or week, and add a timestamp by every line.
Okay, thanks! And Skuch, I added date and time 30 mins after I made the log. [editline]11th January 2011[/editline] The code worked just as I wanted it!
You are awesome. I tough i could learn it. But when i typed the script: [code] -- defines a factorial function function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("1") a = io.read("*1") -- read a number print(fact(a)) [/code] It didnt work so good. I dont understand that laungage i think its this: [code] -- defines a factorial function function fact (n) -- function to do if n == 0 then -- dont know. return 1 -- no idea else - if dont know doesn't return no idea return n * fact(n-1) -- return i really dont know end -- The end end -- The End print("1") -- put in console or screen a = io.read("*1") -- read a number print(fact(a)) -- ? ? [/code] Lol. Im still learning. Im good in flash. Sooo... In short. AWESOME JOB! I Suck :(
Thanks.. (: Well, someone is good at something while another one is good at another thing. (: [editline]11th January 2011[/editline] [b]New pictures in OP![/b]
This looks pretty damn nice man. Good job :) I was wondering, do you have any plans to release this at some point?
Oh shit. Wrong slash, hurr.
Well Jimbo, maybe at some point. I'm not realy sure yet.
[b] It would be realy nice with some more ideas! I don't know what more to do.[/b]
Well, looking through my old and shitty admin mod, there's lots of commands that you could possibly use. Command = Disable / Enable suicides (Or use convar) Command = Freeze / Unfreeze (Again, you should really use convars though) Command = Ghost / Unghost (Same as cloaking) Command = Clear Decals (convar not needed) Command = changemap Command = NoCollide Players (you get the point, any toggable can be used as convar) Command = Shake players Command = Teleporting Command = Restart Map Command = Explode Command = Set Custom Model Hook = KickAfkPlayers Hook = Physgun players These are just some that I had. You get the point. Also, I'm sure theres at least one thing you don't have in there that you might want to add. Oh, also, npc relationships towards the player. For example, you type dP_Nice 9999999 and any npc spawned will be nicest to you. Good luck with the admin mod, way better than my first script. Mine was trying to make a simple command to say 'Hai' to players in chat.
make it so that when they say something it returns string.reverse'd text
I think this is the first thread where the OP released his first thing and wasn't obliterated. Congratulations.
[QUOTE=uberpwns;27359520]Well, looking through my old and shitty admin mod, there's lots of commands that you could possibly use. Command = Disable / Enable suicides (Or use convar) Command = Freeze / Unfreeze (Again, you should really use convars though) Command = Ghost / Unghost (Same as cloaking) Command = Clear Decals (convar not needed) Command = changemap Command = NoCollide Players (you get the point, any toggable can be used as convar) Command = Shake players Command = Teleporting Command = Restart Map Command = Explode Command = Set Custom Model Hook = KickAfkPlayers Hook = Physgun players These are just some that I had. You get the point. Also, I'm sure theres at least one thing you don't have in there that you might want to add. Oh, also, npc relationships towards the player. For example, you type dP_Nice 9999999 and any npc spawned will be nicest to you. Good luck with the admin mod, way better than my first script. Mine was trying to make a simple command to say 'Hai' to players in chat.[/QUOTE] Thanks! But what's your old 'shitty' admin mod called?
Well I released it on garrysmod.org, but it never made it to the front page. Only 3 downloads. Also, you don't want to know the link, it was terribly coded, and some commands didn't work well, some didn't work at all, and others, you couldn't really do anything. Oh, and it didn't have a derma menu.
Oh, okay. :p
Sorry, you need to Log In to post a reply to this thread.