• How can I use Player: GetEyeTrace () to open exactly the printer which I want?
    14 replies, posted
How can I use Player: GetEyeTrace () to open exactly the printer that I'm looking for?!
Please, don't create new topics. You asked this in your previous (and it's not fisrt) post.
Хорошо. Просто, я почти плачу, когда я хочу открыть один принтер, другой откроется ((
hook.Add("PlayerButtonDown", "CheckForPrinterUse", function(ply, button)      if(button == "KEY_E") then           local ent = ply:GetEyeTrace().Entity           if(ent:GetClass() == "printer_class_thingie") then                ent:OpenThePrinter()           end      end end)
Just overwrite ENT:Use() instead? ENTITY/Use
So does not work either
What about reading the code before pasting it?
I was about to give that answer too, but I guessed that he didn't make the printers so I didn't want to introduce him to a whole new realm of "Ok but how do I do this?"
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") local owner local ownernik local callernik local interval = 0.1 local intervalb = 1 function ENT:Initialize() self:SetModel("models/props_c17/consolebox01a.mdl") self:SetMoveType(MOVETYPE_VPHYSICS) self:PhysicsInit(SOLID_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self.timer = CurTime() self:SetMoney(1000) owner = self:Getowning_ent() ownernik = owner:Nick() callernik = caller:Nick() self:SetProgress(0) local phys = self:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() end end function ENT:Think() if self:GetCatrig() > 0 then if CurTime() > self.timer + interval then self.timer = CurTime() self:SetProgress(self:GetProgress() + 1) end else return end if self:GetProgress() == 100 then  self:SetProgress(0) local MoneyPos = self:GetPos() self:SetCatrig(self:GetCatrig() - 1) DarkRP.createMoneyBag(Vector(MoneyPos.x + 25, MoneyPos.y, MoneyPos.z + 15), 3000) end end function ENT:StartTouch(ent) if (ent:GetClass() == "catrige" and self:GetCatrig() < 10) then self:SetCatrig(self:GetCatrig() + 1) ent:Remove() end end function ENT:OpenThePrinter( ply, caller ) util.AddNetworkString( "myMessage" ) net.Start( "myMessage" ) net.Send(ply) end hook.Add("PlayerButtonDown", "CheckForPrinterUse", function(ply, button)      if(button == "KEY_E") then           local ent = ply:GetEyeTrace().Entity           if(ent:GetClass() == "moneyprinter") then                ent:OpenThePrinter()           end      end end) ?
Oh ok nevermind he actually made the printer
4 Posts. At least you put a bounty this time smh https://gmod.facepunch.com/f/gmoddev/rtom/How-to-make-use-only-when-the-sight-is-looking-at-an-object/1/#unseen https://gmod.facepunch.com/f/gmoddev/rtog/How-to-open-the-Derma-menu-when-clicking-on-the-object/1/#unseen How to make a button on 2D3D?
AddNetworkString should be called once, outside of any function. Don't forget to check for IsValid(ent) in your PlayerButtonDown hook. I don't see a net.Receive("myMessage", someFunction) anywhere in your code. Therefore it's impossible to debug any further.
Don't use util.AddNetworkString( "myMessage" ) every use. You only need to do it once.
they are all on different topics
hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha
Sorry, you need to Log In to post a reply to this thread.