Jump to content

Show panel problem


Artisz

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...