Artisz Posted August 25, 2016 Share Posted August 25, 2016 Hi! What is the problem with this line? When I clicked on the vehicle, show all players the panel. I want to show just one player, who clicked. triggerServerEvent("vehPanel",root,localPlayer,clickedElement) Link to comment
xyz Posted August 25, 2016 Share Posted August 25, 2016 Change root to localPlayer and remove root completely Link to comment
Artisz Posted August 25, 2016 Author Share Posted August 25, 2016 I changed like this: triggerServerEvent("vehPanel",localPlayer,clickedElement) Now it's trigger to server side, but now there is a problem. The clickedElement isn't good. Server side: addEvent("vehPanel",true) addEventHandler("vehPanel",root,function(playerSource, clickedElement) local posX, posY, posZ = getElementPosition( clickedElement ) local vehSphere = createColSphere( posX, posY, posZ, 5) if(isElementWithinColShape ( playerSource, vehSphere )) then triggerClientEvent("panelRender",playerSource, clickedElement) end end) For the position I got nil For the ColSphere and for the if i got boolean Link to comment
Mr.Loki Posted August 25, 2016 Share Posted August 25, 2016 Remove playerSource from the function and just use source because in your code the playerSource arg is actually the clickedElement. You can just use addEvent("vehPanel",true) addEventHandler("vehPanel",root,function(clickedElement) local posX, posY, posZ = getElementPosition( clickedElement ) local vehSphere = createColSphere( posX, posY, posZ, 5) if(isElementWithinColShape ( source, vehSphere )) then triggerClientEvent("panelRender",source, clickedElement) end end) because the source is the element that triggered the event. Link to comment
Artisz Posted August 25, 2016 Author Share Posted August 25, 2016 It's still bad. There is an addEventHandler too, I think there is the problem. addEventHandler("onClientRender",root, PanelRenderClient) I think it's add all players, who online. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now