• Lua error in my addon
    1 replies, posted
Hi, I need help with my script, I can spawn an npc(in the entity menu) the npc can open menu with the use key. I use net function like this in server side function ENT:Use(act, ply, use, val)     if IsValid(ply) and ply:IsPlayer() then         net.Start("HitmanUse")         net.Send(ply)     end end and this in client side net.Receive("HitmanUse", OpenHitmanUse()) the OpenHitmanUse function is declared like this local function OpenHitmanUse() ....... end this code work but if I change this code to function ENT:Use(act, ply, use, val)     if IsValid(ply) and ply:IsPlayer() then         net.Start("HitmanUse")         net.WriteEntity(ply)         net.Send(ply)     end end net.Receive("HitmanUse", function(len, pl)     OpenHitmanUse(pl) end) local function OpenHitmanUse(pl) THE SAME CODE HERE..... end the code not work, no error in console and the addon menu named "hitman" in the entity menu is not showed and the npc dispawn in game. Sorry for my english i'm french, Thanks.
for net.Receive("HitmanUse", OpenHitmanUse()) you don't need the parenthesis after the function name net.Receive("HitmanUse", OpenHitmanUse) would work net.Send is serverside only, on the client you need to use net.SendToServer()
Sorry, you need to Log In to post a reply to this thread.