Lua newbie questions

Hello thereeee. I’m wanting to start Lua scripting and my friend has asked me to help with Lua coding on his DarkRP server. I have experience with E2 which is somewhat similar…

First off I need to make a leveling system, that gets you xp from printers and such. I think i can code the HUD but im not sure for everything else. So how would i do this?

Second i need to make a deffibulator. When players drop to like 10hp they become a ragdoll and the deffibulator revives them. I tried this with :SetRagdoll but it only creates one, not making them become one.

If anyone could help/guide me with these, that would be cool :slight_smile:

How can you say E2 and lua are similar if you don’t know lua, fyi you actually need to learn the basics otherwise this is a request.

1st question: Use metatables for easier ways of setting data.
2nd question: Use traces and make it so when a player is actually dead they can be revived.

yeah OK its probably a request since I dont know metatables or traces…

Also i need help with my ragdoll problem; when i uses ply:CreateRagdoll but I dont become the ragdoll, it simply spawns an unsolid one of me

What I mean by that is; when a player is dead you can use a trace to check what the thing is then have it respawned and put where the trace ends.

a quick metatable example here:
Create a file called “sh_meta”.
[lua]
–sh_meta.lua
local meta = FindMetaTable(“Player”)

function meta:PlayCSound(sound)
	umsg.Start("lSound",self)
	umsg.String(sound)
	umsg.End()
end

–Cl_init.lua
usermessage.Hook(“lSound”,function(um)
surface.PlaySound(um:ReadString())
end)
[/lua]
:ninja: