Jump to content

Whats wrong here?


killeryoyo

Recommended Posts

Hello guys,

I was trying to fix a script, but there is something weird in the script idk why it doesnt work.

function startHijackTable() 
    random = math.random(#hijackT) 
    model = math.random (#hijackCar) 
    x, y, z, rx, ry, rz = hijackT[random][1], hijackT[random][2], hijackT[random][3], hijackT[random][4], hijackT[random][5], hijackT[random][6] 
    hijackStart = createVehicle ( hijackCar[model][1], x,y,z,rx,ry,rz ) 
    setVehicleDamageProof ( hijackStart, true ) 
    x1, y1, z1 = getElementPosition ( hijackStart ) 
    hijackBlip1 = createBlipAttachedTo (hijackStart, 53) 
    setBlipVisibleDistance ( hijackBlip1, 1500 ) 
    outputChatBox ( "A customer wants the "..getVehicleName( hijackStart ).." at "..getZoneName(x1, y1, z1).."! Go to the race flag before anyone else!", root, 200, 255, 100, true ) 
end 
setTimer(startHijackTable, 50, 1) 
  
function enterHijack(hijacker, seat, jacked) 
    if source == hijackStart then 
        hx, hy, hz = hijackDT[deliverH][1], hijackDT[deliverH][2], hijackDT[deliverH][3] 
        px, py, pz = getElementPosition ( hijacker ) 
        if (getDistanceBetweenPoints2D ( px, py, hx, hy)) <= 550 then enterHijack(hijacker, seat, jacked) return end 
        deliverH = math.random(#hijackDT) 
        hijackDeliver1 = createMarker ( hx, hy, hz, "cylinder", 4.0, 250, 50,0, 150) 
        hijackBlip2 = createBlipAttachedTo ( hijackDeliver1, 51 ) 
        setVehicleDamageProof ( hijackStart, false ) 
        setElementVisibleTo ( hijackBlip, root, false ) 
        setElementVisibleTo ( hijackBlip, hijacker, true ) 
        setElementVisibleTo ( hijackDeliver1, root, false ) 
        setElementVisibleTo ( hijackDeliver1, hijacker, true ) 
        outputChatBox("Deliver the car to the customer in "..getZoneName(hx, hy, hz).."", hijacker, 52, 134, 196, false) 
    end 
end 

When i enter the car. The Marker blip doesnt show in the map. Can someone help me? thank you!

Link to comment

yeh nvm what I put here ---

But here's your code put in lua.

    function startHijackTable() 
        random = math.random(#hijackT) 
        model = math.random (#hijackCar) 
        x, y, z, rx, ry, rz = hijackT[random][1], hijackT[random][2], hijackT[random][3], hijackT[random][4], hijackT[random][5], hijackT[random][6] 
        hijackStart = createVehicle ( hijackCar[model][1], x,y,z,rx,ry,rz ) 
        setVehicleDamageProof ( hijackStart, true ) 
        x1, y1, z1 = getElementPosition ( hijackStart ) 
        hijackBlip1 = createBlipAttachedTo (hijackStart, 53) 
        setBlipVisibleDistance ( hijackBlip1, 1500 ) 
        outputChatBox ( "A customer wants the "..getVehicleName( hijackStart ).." at "..getZoneName(x1, y1, z1).."! Go to the race flag before anyone else!", root, 200, 255, 100, true ) 
    end 
    setTimer(startHijackTable, 50, 1) 
      
    function enterHijack(hijacker, seat, jacked) 
        if source == hijackStart then 
            hx, hy, hz = hijackDT[deliverH][1], hijackDT[deliverH][2], hijackDT[deliverH][3] 
            px, py, pz = getElementPosition ( hijacker ) 
            if (getDistanceBetweenPoints2D ( px, py, hx, hy)) <= 550 then enterHijack(hijacker, seat, jacked) return end 
            deliverH = math.random(#hijackDT) 
            hijackDeliver1 = createMarker ( hx, hy, hz, "cylinder", 4.0, 250, 50,0, 150) 
            hijackBlip2 = createBlipAttachedTo ( hijackDeliver1, 51 ) 
            setVehicleDamageProof ( hijackStart, false ) 
            setElementVisibleTo ( hijackBlip, root, false ) 
            setElementVisibleTo ( hijackBlip, hijacker, true ) 
            setElementVisibleTo ( hijackDeliver1, root, false ) 
            setElementVisibleTo ( hijackDeliver1, hijacker, true ) 
            outputChatBox("Deliver the car to the customer in "..getZoneName(hx, hy, hz).."", hijacker, 52, 134, 196, false) 
        end 
    end 

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