Jump to content

GUI button and getPedOccupiedVehicle.


pa3ck

Recommended Posts

Hi guys, I'm making a GPS system, but I just can't make the script show a variable in the guiCreateButton... Is there any way to do that? I tried with the guiSetText, no success. The thing I want to do is, to show the real time in a GUI button.

Also, I will bind the GPS to a specified button, and if the client is in a vehicle and is driver he will be able to open the GUI, othwerwise the GUI wont show up. But, the problem is that getPedOccupiedVehicle is server function and the GUI is client. Any idea how can I get this done? Any help would be highly appreciated!

Link to comment

getPedOccupiedVehicle is client-side as well.

and you can hide/show your GUI with this...

  
addEventHandler ("onClientVehicleEnter", getRootElement (), 
       function (thePlayer)  
           if thePlayer ~= getLocalPlayer() then return; end;  
           guiSetVisible (gui, true); -- show the gui. 
       end);  
addEventHandler ("onClientVehicleExit", getRootElement (),  
       function (thePlayer) 
           if thePlayer ~= getLocalPlayer () then return; end; 
           guiSetVisible (gui, false); -- hide gui. 
       end);  
  

Link to comment

Thank you very much for your quick help! I'm a noob scripter ( yet ! :D ), so dont judge me :D The last question I will be askin ( today xD ) is, that I want to play a 3D sound whenever the driver hits the marker, I use the playSound3D. I've done that, its working, no problem. But I want to "attach" this sound to the driver, so if he leaves the marker the sound will be "following him", if you know what I mean. How could I do that? First I tought I would do it with onClientRender, so it will update the getElementPosition(), but it would play the sound over and over again...

Link to comment

The last, last question > . < I made a button for showing the distance between the car and marker using getDistanceBetweenPoints3D, but its showing me a long-long number. How can I set it to show me like 12442.2? So 1 decimal?

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