You can put them pretty much anywhere. The surface.GetTexureID starts in the .luacraft directory.
If you wanted the default terrain.png as a texture, you can just do surface.GetTexureID( "/terrain.png" )
You can put them pretty much anywhere. The surface.GetTexureID starts in the .luacraft directory.
If you wanted the default terrain.png as a texture, you can just do surface.GetTexureID( "/terrain.png" )
I just updated LuaCraft and when i start a world, ESP works for a second, then stops working and the console saysCode:addons/luastoned.esp.zip/lue/init.lua:27: attempt to call nil Hook 'Game - Render Overlay:NORMAL' failed: addons/luastoned.esp.zip/lua/init.lua:27: attempt to call nil
Please re-download the ESP addon. I fixed a small bug regarding IsAlive() and IsLiving() yesterday!
Also addons always worked, I just made it very unclear if they were enabled or not, sorry for the confusion :D
This is great. Making an addon for finding wolves based on ESP, but why cant you load addons without having to restart?
Go into the addons menu and double click the addon you want to reload. ( It'll disable and then re-enable it. )
Thanks.
Edited:
Got the console hook worked out. strCommand has the entire command in it (a little useless.) and tbl is like this:
0: nil
1: the actual command
2: arguments
3: so on
If i knew how to wiki I probably would add it.
I hopefully stopped the confusion about addons being enabled or not.
Just requested a wiki account, but its so srs business it even asks you for a resume.
Heh, trying to keep them bots out.
A possibility for a function to get the players FPS? I'm making a cleaner HUD.
Finally client has been updated! ESP works! YAY! I love you ;D
Does /lua work clientside as well? Also, why is 'Console' disabled?
It got disabled because it was bugged I suppose. Also, if you want to code in-game press the ` or ~ key, depends on your keyboard.. But press that key, and then type lua "Code Here" No Quotations... Cheers.
Just noticed that the particles that fall from blocks when there is water over it are lava particles :P
Getting some odd apparently non-lua errors. Code:
Without the if check for validentity, the jvm throws a nullpointer exception on fblock:Break, and as it is, lua says that I'm trying to call nil. Any ideas?function makeCrater(size) size = size or 2 if(size<=0) then size = 1 end local me = LocalPlayer() local trace = me:Trace(100) local hitb = trace.HitBlock Chat("HitBlock: ",hitb) local hitpos = hitb:GetPos() Chat("HitPos: ",hitpos) x = size * -1 y = x z = y while(z <= 1) do if(x<size) then x = x + 1 else x = size * -1 if(y<size) then y = y + 1 else y = size * -1 z = z + 1 end end fblock = Block(Vector(x,y,z)+hitpos) if(fblock:IsValid() and fblock:isEntity()) then fblock:Break(100) end end end
Are you doing this clientside or serverside?
client
IsEntity() isn't a function, you don't need it for your script either.
Edited:
Neither is IsValid(), every block should be valid. It's block type is air if it's not a placed block.
Edited:
Edited:
Okay, going to add a IsValid() that basically does: ( Block:GetID() != 0 )
Hey what're the keypressed enums?
Edited:
Night-Vision
And the message thing at the top is a scrolling hint board.
Oh. You should add some sort of checks in there for checking if there is any block there at all. I was on a superflat world, and it was trying to use a block that was in the Void.
How would I go about finding the block that the player is looking at ( serverside )?
player.GetByName("yourname"):Trace(distance).HitPos --or player.GetByName("yourname"):Trace(distance).HitBlock
Thanks, I had the trace in my code, just didn't specify the .HitBlock.
Does this mean that you can send lua files from the server, to the client now?
To Clients using LuaCraft, yes!
Ignore ^'s post. You can't do this yet. :P You can however use Player:SendLua() serverside.
hook.Add("PlayerSpawn", "SendLua", function(ply) ply:SendLua[[ print("Hello there " .. LocalPlayer():Name() .. "! :)") ]] end)
Ahh, well, better than nothing :)
Is a solution similar to GMod's way planned?
Yes it is.
Take my babies.
Wait, the client simply tells the server that it's broken a block?
Couldn't you knock out the entire map with that?
Luckily no. The server has checks to prevent that.![]()
How do i simply get the local player in a client script?
LocalPlayer()
-snip-
Code:local font = surface.GetFont() local name = LocalPlayer() hook.Add("render.gameoverlay", "Game - Render Overlay", function() if doscan == true then for _, ent in pairs(ents.GetByClass("Wolf")) do if (ent ~= LocalPlayer()) then local pos = ent:EyePos() local x, y, vis = pos:ToScreen() local dist = pos:Distance(LocalPlayer():EyePos()) if dist < 62 and vis then local alpha = math.Clamp( 1 - (dist/64), 0, 1 ) * 255 if (ent:IsMob()) then surface.SetDrawColor(255, 0, 0, alpha) elseif (ent:IsAnimal()) then surface.SetDrawColor(0, 255, 0, alpha) else surface.SetDrawColor(0, 0, 255, alpha) end surface.DrawRect(x, y, 1, 1) surface.SetDrawColor(255, 255, 255, alpha) local w, h = font:GetTextSize(ent:GetClass()) font:DrawText(ent:GetClass(), x - w / 2, y - 16) if (ent:IsLiving()) then local healthPerc = ent:GetHealth() / ent:GetMaxHealth() surface.SetDrawColor(0, 0, 0, alpha) surface.DrawRect(x - 8, y - 8, 16, 2) surface.SetDrawColor( (1 - healthPerc) * 255, healthPerc * 255, 0, alpha) surface.DrawRect(x - 8, y - 8, 16 * healthPerc, 2) end end end end end -- 10 y spacing in text font:DrawText("Running Rdebug. Type rhelp in console for more info.",5, 5) if rdebug == true then font:DrawText("Health: " .. name:GetHealth() .. "/20",5, 15) font:DrawText("Armor: " .. name:GetArmor() .. "/20",5, 25) font:DrawText("Air: " .. name:GetAir() .. "/300",5, 35) font:DrawText("X:" .. round(name:GetPos().x) .. " Y:" .. round(name:GetPos().y) .. " Z:" .. round(name:GetPos().z),5, 45) font:DrawText("XP: " .. name:GetExperience() ,5, 55) end end) function round(num) return math.floor(num+.5) end hook.Add("console.command", "LuaCraft - Command", function(tbl, strCommand) print("Console: " .. strCommand) if rpdebug == true then for key,value in pairs(tbl) do print(key,value) end end if tbl[1] == "rpdebug" then if tbl[2] == '1' then rpdebug = true elseif tbl[2] == '0' then rpdebug = false end end if tbl[1] == "rdebug" then if tbl[2] == '1' then rdebug = true elseif tbl[2] == '0' then rdebug = false end end if tbl[1] == rgive then name:Give(ItemStack(tbl[2], tbl[3])) end if tbl[1] == "rhelp" then print("Rdebug script commands:") print("Type name [your username] in console to begin.") print("rpdebug with arg 1/0 for toggle. Enables console command debugging.") print("rdebug with arg 1/0 for toggle. Enables simple GUI debugging helper.") print("rgive with arg id and arg amount. Gives you the item specified.") end end)
None of the functions that use the localplayer name work. No errors come up.
Edited:
Actually, wait I get a single java error when I load the world.
http://i.cubeupload.com/WtAI8q.png
Define name at the start of the hook:
hook.Add("render.gameoverlay", "Game - Render Overlay", function() local font = surface.GetFont() local name = LocalPlayer() if doscan == true then for _, ent in pairs(ents.GetByClass("Wolf")) do if (ent ~= LocalPlayer()) then local pos = ent:EyePos() local x, y, vis = pos:ToScreen() local dist = pos:Distance(LocalPlayer():EyePos()) if dist < 62 and vis then local alpha = math.Clamp( 1 - (dist/64), 0, 1 ) * 255 if (ent:IsMob()) then surface.SetDrawColor(255, 0, 0, alpha) elseif (ent:IsAnimal()) then surface.SetDrawColor(0, 255, 0, alpha) else surface.SetDrawColor(0, 0, 255, alpha) end surface.DrawRect(x, y, 1, 1) surface.SetDrawColor(255, 255, 255, alpha) local w, h = font:GetTextSize(ent:GetClass()) font:DrawText(ent:GetClass(), x - w / 2, y - 16) if (ent:IsLiving()) then local healthPerc = ent:GetHealth() / ent:GetMaxHealth() surface.SetDrawColor(0, 0, 0, alpha) surface.DrawRect(x - 8, y - 8, 16, 2) surface.SetDrawColor( (1 - healthPerc) * 255, healthPerc * 255, 0, alpha) surface.DrawRect(x - 8, y - 8, 16 * healthPerc, 2) end end end end end -- 10 y spacing in text font:DrawText("Running Rdebug. Type rhelp in console for more info.",5, 5) if rdebug == true then font:DrawText("Health: " .. name:GetHealth() .. "/20",5, 15) font:DrawText("Armor: " .. name:GetArmor() .. "/20",5, 25) font:DrawText("Air: " .. name:GetAir() .. "/300",5, 35) font:DrawText("X:" .. round(name:GetPos().x) .. " Y:" .. round(name:GetPos().y) .. " Z:" .. round(name:GetPos().z),5, 45) font:DrawText("XP: " .. name:GetExperience() ,5, 55) end end) function round(num) return math.floor(num+.5) end hook.Add("console.command", "LuaCraft - Command", function(tbl, strCommand) print("Console: " .. strCommand) if rpdebug == true then for key,value in pairs(tbl) do print(key,value) end end if tbl[1] == "rpdebug" then if tbl[2] == '1' then rpdebug = true elseif tbl[2] == '0' then rpdebug = false end end if tbl[1] == "rdebug" then if tbl[2] == '1' then rdebug = true elseif tbl[2] == '0' then rdebug = false end end if tbl[1] == rgive then name:Give(ItemStack(tbl[2], tbl[3])) end if tbl[1] == "rhelp" then print("Rdebug script commands:") print("Type name [your username] in console to begin.") print("rpdebug with arg 1/0 for toggle. Enables console command debugging.") print("rdebug with arg 1/0 for toggle. Enables simple GUI debugging helper.") print("rgive with arg id and arg amount. Gives you the item specified.") end end)
Edited:
You get that error because the player isn't initialized when the script loads. ( Same as in Garry's Mod. )
I suddenly want to write a game mode like thing. Hmm...
When is local player ever a wolf?Code:for _, ent in pairs(ents.GetByClass("Wolf")) do if (ent ~= LocalPlayer()) then
Is there some way to include other lua files? For example, I have a lua file named arena.lua in the same folder as my init.lua. Inside arena.lua I stuck module(..., package.seeall) at the top, but on requiring 'arena', I get a lua error telling me that arena.lua does not exist, even though I can obviously see it right there. Is there some sort of directory structure or include directory that I should use?