hello guys I have problem
I can't get this var, I don't know how to do :/ I have all tried (sorry for my aproximatif english I am french ;) )
--is a sv_init in autorun and server folder
hook.Add("KeyPress", "openMafMenu",function(ply, key)
if key ~= IN_USE then return end
chef = ply:GetEyeTrace().Entity --this var
ply:SetNWEntity("chef", chef )
if IsValid(chef) and chef:IsPlayer() and chef:Team() == Team_Chef and ply:GetPos():Distance(chef:GetPos()) < DrawDist_view_text then
net.Start("Menu_E_On_chef")
net.Send(ply)
end
end)
net.Receive("Menu_For_chef_Confirm",function(length,ply)
net.Start("Menu_For_chef_Confirm")
net.Send(GET HERE) --here
end)
Why are you sending a net, then sending another in a net receive?
Anyway, you need to change that net.Send to a net.SendToServer.
--is a sv_init in autorun and server folder
hook.Add("KeyPress", "openMafMenu",function(ply, key)
if key ~= IN_USE then return end
chef = ply:GetEyeTrace().Entity --this var
ply:SetNWEntity("chef", chef )
if IsValid(chef) and chef:IsPlayer() and chef:Team() == Team_Chef and ply:GetPos():Distance(chef:GetPos()) < DrawDist_view_text then
net.Start("Menu_E_On_chef")
net.Send(ply) -- its for open derma menu for use activator
end
end)
net.Receive("Menu_For_chef_Confirm",function(length,ply) --when you click on button in derma
--blue
net.Start("Menu_For_chef_Confirm")
net.Send(GET HERE) --here its for open derma for guys on front of use activator
end
I want use this var everywhere but I dont get this and I cant get "chef = ply:GetEyeTrace().Entity" at (blue) because the player in front of use activator can move and another player can move in front of use activator
The file shouldn’t be named sv_init, it should just be init and only in the server folder. But if you’re just putting the files with those names into the auto run, I guarantee there’s some conflicts. Name them something more personal.
You can’t receive a net on the server if you haven’t sent anything from the client, which it doesn’t seem like you’ve done.
Speaking of, what are you trying to do by sending the same net you’re receiving?
I don’t think “GET HERE” is in your actual code, but if it is, it’s not going to work.
There’s a lot of issues right now, and I’m probably missing some. Take a look at this (Net Library Usage) again, and the example, and remember that blue = server and orange = client.
Sorry, you need to Log In to post a reply to this thread.