• Help with Coding Lua!
    2 replies, posted
Hey guys, I just want to point out im new to lua so please bare that in mind if i have made an obvious mistake. ive been trying to add a line of code under chatprint, plyaddmoney this is not working for some reason i have asked on the gmod discord but no luck also would anybody be will to provide a line of code to respawn the entity after a few seconds. My goal is so that when the entity has been touched the chat print will appear and the entity will disappear (which it does) but i want it to give the player touching the entity it will drop money and reappear after a few seconds, any help would be really appreciated! AddCSLuaFile("shared.lua") AddCSLuaFile("cl_init.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/hunter/blocks/cube025x025x025.mdl") self:PhysicsInit (SOLID_VPHYSICS) self:SetMoveType (MOVETYPE_NONE) self:SetSolid (SOLID_VPHYSICS) self:GetPhysicsObject():Wake() self:SetCollisionGroup (COLLISION_GROUP_WEAPON) self:SetTrigger(true) self:DrawShadow(false) end function ENT:StartTouch(eOtherEnt) if eOtherEnt:IsPlayer() then eOtherEnt:ChatPrint ("Found Hidden Package!") self:Remove() end end
Not sure if this helps but you might find your answer here. Lua Programming Examples look at those examples and compare them to your code. perhaps also search a bit for lua functions and lua if else Those might bring you far or at least a bit further. Got some experience with other coding languages but lua is still new to me and I haven't yet tried to set anything up for testing :/
Thanks for thee response mate! I have checked it out!
Sorry, you need to Log In to post a reply to this thread.