I took a look at the client.command hook, but it seems it dosen't supports arguments.
It returns a plain text of what you wrote in the console.
I took a look at the client.command hook, but it seems it dosen't supports arguments.
It returns a plain text of what you wrote in the console.
Changed the hook to provide the arguments table and the raw string.
Ninjerr
Anywho:
Added !(not), !=, <<, >>, |, ||, &, and &&.
More glua like!
![]()
so whats the deal with console commands serverside, did you guys change how they work?
No
Just a question, is there anyway to detect whenever you are aiming at the specified block/entity/mob ?
Please update the wiki guys, Can't wait to use the new input. hooks
I was thinking of networking the console commands like how its done in source, so on the server there would be a player argument. Would it be worth it?
I cant find anything on the wiki and its starting to get annoying. How do I print text? I found that out by opening the ESP addon. How do I change the font though?
You would have to make your own font PNG if you wanted to have a different looking font and create it via surface.CreateFont( "/path/to.png" )
I did some in-code documentation so hopefully we will be able to reorganize and update the wiki soon.
Anyway, while playing with some friends on a server I made a pretty bad xray and figured it would help if I added some threading capabilities and this is what I came up with..
And the code behind it..
concommand.Add( "scan", function( cmd, args ) local size = args[1] or 64 local thread = Thread( function() local block local pos = LocalPlayer():GetPos() local startTime = SysTime() Info( "Scanning.." ) local scanningVecs = Vectors( pos + Vector( 1, 1, 0.25 ) * size, pos + Vector( -1, -1, -1 ) * size ) Warning( string.format( "Looping through %i blocks!", #scanningVecs ) ) for i = 1, #scanningVecs do currentScanPos = scanningVecs[ i ] block = Block( currentScanPos, LocalPlayer():GetWorld() ) if block:GetID() == 56 then table.insert( foundBlocks, { vec = currentScanPos, col = Color( 0, 162, 232, 150 ) } ) end end Info( string.format( "Scan complete.. (%f seconds)", SysTime() - startTime ) ) Warning( string.format( "Found %i blocks of diamond!", #foundBlocks ) ) end ) thread:Start() end )
Best part is, since we are using a simulated Lua in java, we don't have to worry about fucking up a stack because there is none.
I like this, but im requesting more information (and tutorials) on the wiki. I'm currently experimenting with this, and sometimes i don't even i know what i do wrong.
3D font rendering, woo :D
![]()
Are you going to add the ability to register new block and item types? If there was some kind of gmod-sent-like API for adding new block and item types (both client & serverside, the lua script would need to be shared - this reminds me, do you have gmod-style server -> client script downloading yet?), I would start using this right away.
I am hoping to get custom Items/Blocks ready soon. There are quite a few things to take care of (custom rendering, etc) so it's not too easy for us.
Server->client net functions are done already, but we still have to add something like AddResource (that will work for any files, .lua will get exectued on the client)
Not wishing to be a one-track record here, but any chance of having multiworld support soonish?
I looked into it before and it looks like it would be pretty easy. It would require doing a lot of small edits to a lot of different things. I'll look into again tomorrow, since it is something I would like to see myself.
Edited:
Hahaha, I take that back. I could probably add multi-world support in a matter of minutes.
The code has really gotten a lot cleaner and organized since notch stopped working on it.
how do timers even work, can i get a sample at least because im stuck.
Hint: wikipage about timers has an phperror.
I don't see a PHP error http://wiki.luacraft.com/LuaClient/timer.lua
-- use once timer.Simple(2, function() print("2 seconds elapsed!") end) -- use 5 times timer.Create("5 times", 1, 5, function() print("5 times timer..") end)
Thanks, but i meant this page: http://wiki.luacraft.com/Timer
And a infinite timer loop?
I can see this becoming grealty famous, and the lot of Addons created in Lua Scripting by Awesome Modders here in Facepunch.. This is awesome..
timer.Create("abc", 2, 0, function() print("Endless..") end)
Just replace the repetitions with 0
Thanks, last question of today: is there a function to check around a radius of an entity/block/player? if not take it as an request.
What to check? Entities? I'd guess you could use ents.GetClosestToEntity(ent, radius)
Also, I asked before but didn't get an answer. Would it be possible to make blocks/entities react as if they had just been pushed by a piston?
To create invisible pistons etc.
I think i ment for blocks, not entities.
Never saw that question, will look into it (something like block:Push(dir) .. seems ok)
I am not quite sure what you want :x sorry.
Ok, look i ment radius, something like GetClosestToBlock(block, radius).
ents.GetClosestToVector(vec, radius)
€dit: @Lexi
_R.Block.Push = function(self, vec, len) if (vec.x ~= 0 and (vec.y ~= 0 or vec.z ~= 0)) then return false end if (vec.y ~= 0 and (vec.x ~= 0 or vec.z ~= 0)) then return false end if (vec.z ~= 0 and (vec.x ~= 0 or vec.y ~= 0)) then return false end len = len or 12 local dir = Vector(math.Clamp(vec.x, -1, 1), math.Clamp(vec.y, -1, 1), math.Clamp(vec.z, -1, 1)) local id, meta = self:GetID(), self:GetMeta() local prev_id, prev_meta = id, meta self:SetID(0) for i = 1, len do local pos = self:GetPos() + dir * i local block = Block(pos) id, meta = block:GetID(), block:GetMeta() block:SetID(prev_id) block:SetMeta(prev_meta) if (id == 0) then break end if (pos.z <= 0 or pos.z >= 256) then break end prev_id, prev_meta = id, meta end end
I think he wants the animation of the block moving along the floor, just like a piston pushed it.
Welp, multi-world support is taking a lot longer than I thought it would. So far I can create the world and get it to run, but I can't actually get the player into it yet.
This is how you would create a world though.
local world = world.Create( { name = "test_world", -- The name of the folder in which the world will reside in gamemode = CREATIVE, -- The default gamemode provider = WORLD, -- The type of world this is (WORLD,END,NETHER) type = WORLD_TYPE_DEFAULT, -- The type of world to be generated (WORLD_TYPE_DEFAULT,WORLD_TYPE_FLAT) viewdist = 10, -- Maximum view distance difficulty = 1, -- Difficulty level seed = "This be a test seed", -- The worlds seed animals = false, -- Spawn animals monsters = false, -- Spawn monsters structures = false, -- Spawn structures } )
Eek!
I've tried this:
got:-- Experminal scripty #2 Msg("start experminal regrowscript") -- Vars n shit regrow_id = 0 hook.Add("player.breakblock", "regrow_breakblock", function(ply, block) if block:GetID() == 16 then -- coal print(block) --debug block:SetID(7) timer.Simple( 15, regrow_func, block, 16 ) Msg("digcode ... OK") regrow_id = regrow_id + 1 return false end end) local function regrow_func(block, blockid) if block:GetID(7) then block:SetID(blockid) Msg("digtimer ... OK") end end
Move the local function to above where you add the hook...
i am currently making a (amateur) HUD, but i have some issues with the experience bar, as in this example:
all it returns is: 0print(LocalPlayer():GetExperience())
for now i had to do with other solutions, as well as just not adding it for now
i tested the function in both single- and multiplayer
am i doing something wrong, won't it work clientside, or does this still have to be fixed?
what i want, i as the wiki mentions:
GetExperience()
Return value: Number:exp
Information: Returns a players experience for their current level
Could PropertyManager be added to the client? I use it in a server addon that would work just as well for the client, but I manage my data with PropertyManager.
May as well cross post on the forums.
Committed PropertyManager to the client.
I think I can fix this.
Awesome thanks
A little late, but it's fixed and ready for the update.
This update also includes some more precise errors.
![]()
great, still is don't understand how GetExperience() would return 0.3333345, as in your example
I'd assume that it would be the progress from one level to the next. That would be a third of the way through, 33%.