Jump to content

help with commands


marty000123

Recommended Posts

Posted

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!

Posted

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.

Posted
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

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