marty000123 Posted February 23, 2017 Share Posted February 23, 2017 Hello Now when I'm standing infront of my toll, it requires a command to open it. I did /paytoll. Now it doesn't work, because I don't know how to do it. The script is server sided. This is my structure: function checkvehicle if car then if heavyveh then triggerEvent(heavy) end end addEventHandler(onMarkerHit) So when it's a heavy vehicle, it redirects to the Event called heavy. Now my problem is, how do I redirect this to another event/function while having the enter the command? I mean, it should be something like this: addEvent(heavy) function() bla blah end addCommandHandler("paytoll") Right now, I can do /paytoll everywhere because i dont know how to connect it from the checkvehicle function. Help would be appreciated! Link to comment
nikitafloy Posted February 23, 2017 Share Posted February 23, 2017 (edited) checkvehicle(car) use trigger if u want to call this on client side Edited February 23, 2017 by nikitafloy Link to comment
pa3ck Posted February 23, 2017 Share Posted February 23, 2017 There's no need for triggers. When the user enters /paytoll check the distance between their position and the marker. If they're close enough, open the barrier. Link to comment
pro-mos Posted February 23, 2017 Share Posted February 23, 2017 addCommandHandler('paytoll', function(player) local x,y,z = getElementPosition(player) -- x2, y2, z2 = toll position local d = getDistanceBetweenPoints3D(x,y,z,x2,y2,z2) if d <= 50 then -- open toll end end) Something like this, sorry i wrote it on my phone 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