Jump to content

Show panel problem


Artisz

Recommended Posts

Posted

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) 

Posted

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

Posted

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.

Posted

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.

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...