• ENT:USe one player at a time
    4 replies, posted
Is there anyway to make it so if another player has pressed E on an entity it will send a command to the player who also wants to press the entity saying something like " Entity currently in use. " not sure if that makes sense but all im wanting to do is make it do Something if another players already pressed e on it. is there anyway at all to do this?
Should work [code] function ENT:Use(activator, caller) if self.inUseBy and self.inUseBy != caller then caller:ChatPrint('This entity is currently in use by ' .. self.inUseBy:Nick()) return end self.inUseBy = caller timer.Simple(2, function() self.inUseBy = nil end) end [/code]
I have do what you said and its working but it still continues to do the rest of my code, for example some of my code would be [CODE]function ENT:Use( activator, caller ) if self.inUseBy and self.inUseBy != caller then caller:ChatPrint('This entity is currently in use by ' .. self.inUseBy:Nick()) return end self.inUseBy = caller timer.Simple(2, function() self.inUseBy = nil end) net.Start("DrawTheREaaalDerma") net.Send(caller) caller:Freeze(true) timer.Simple(1, function() self:EmitSound( Sound( "physics/concrete/concrete_break2.wav" ), self:GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100 ) end)[/CODE] after it has printed This entity is currently in use by ' .. self.inUseBy:Nick()) it will continue to start that net message and emit those sounds, anyway to stop that?
Try remove [code] timer.Simple(2, function() self.inUseBy = nil end) [/code] And you must send something to server when player close the menu, i think, to unfreeze and remove tag from an entity
works thanks, legend
Sorry, you need to Log In to post a reply to this thread.