Jump to content

[Help] Marker/Object script


Crook4Money

Recommended Posts

I'm trying to create a toll booth like script, but the marker isn't working with the object and I'm not getting any visible errors. I also don't know how to create a visible marker to check if it's even there.

local gate1 = createObject(968, 1544.6999511719, -1623.9000244141, 13, 0, 89.1, 270)
local marker1 = createMarker(1540.8000488281, -1627.4000244141, 12.303552627563, "corona",5,225,225,255,0)
local marker2 = createMarker(1546.8000488281, -1627.1999511719, 12.303552627563, "corona",5,225,225,255,0)

function moveToll(player)
	if player == localPlayer then return end
	if source == marker1 then
		moveObject(gate1, 2000, 968, 1544.6999511719, -1623.9000244141, 13, 0, 270)
	elseif source==marker2 then	
		moveObject(gate1, 2000, 968, 1544.6999511719, -1623.9000244141, 13, 0, 270)
	end
end
addEventHandler("onClientMarkerHit", root, moveToll)

 

Link to comment
1 minute ago, Crook4Money said:
  1. local gate1 = createObject(968, 1544.6999511719, -1623.9000244141, 13, 0, 89.1, 270)
  2. local marker1 = createMarker(1540.8000488281, -1627.4000244141, 12.303552627563, "cylinder",5,225,225,255,0)
  3. local marker2 = createMarker(1546.8000488281, -1627.1999511719, 12.303552627563, "cylinder",5,225,225,255,0)
  4. -- Now the markers are visible
  5.  
  6. function moveToll(player)
  7. -- The check that you made here... localPlayer is a client sided thing. I don't know if this script is clientsided. Also you said that if the player is the player then do not do a thing
  8. if source == marker1 then
  9. moveObject(gate1, 2000, 968, 1544.6999511719, -1623.9000244141, 13, 0, 270)
  10. elseif source==marker2 then
  11. moveObject(gate1, 2000, 968, 1544.6999511719, -1623.9000244141, 13, 0, 270)
  12. end
  13. end
  14. addEventHandler("onClientMarkerHit", root, moveToll)

 

  • Thanks 1
Link to comment

Yeah, it was client sided. I realized that I had the object value in the "x" value by mistake. I added the local player and fixed the values, but the markers are still invisible. I got it to work anyways. I had a few values that were incorrect. Thanks for the help. 

 

Edited by Crook4Money
Link to comment
1 minute ago, Crook4Money said:

Yeah, it was client sided. I realized that I had the object value in the "x" value by mistake. I added the local player and fixed the values, but the markers are still invisible. I got it to work anyways. I had a few values that were incorrect. Thanks for the help. 

 

The markers are invisible because when you define the color of them you have to use RGBA, which you did. you made your markers white, but defined their alpha 0. So they are completly transparent. Set the forth number to 255 and you'll see them.

createMarker()

 

  • Thanks 1
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...