Jump to content

Hijack script help


Wisam

Recommended Posts

Hey

So i made this hijack script with my friend and it works good so far.. but i wanted to make tables for car spawns, delivery locations and car id so everytime a new hijack mission start there will be different locations and different vehicles so can you please help me with that because im not good with tables and stuff.. here's the script:

  
  
local ca3 = { { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 } } 
  
local marker = {   --You can add more locations here 
    { 102.0269241333, 54.090785980225, 0.44342550635338 }, 
    { 11.605502128601, 58.490795135498, 1.6355142593384 } 
} 
  
local vehicle_ = {} 
local blip = {} 
local rand = {} 
local Markers = {} 
  
function CreatCarRandom () 
    rand.random = ca3[math.random(#ca3)] 
    vehicle_.car = createVehicle(411, -0.77234786748886, 0.1968837082386, 3.1171875) 
    blip.blip1Car = createBlipAttachedTo(vehicle_.car, 53) 
    outputChatBox("#B22222 automobile has been requsted and placed on your map , get it first !!", root, 255, 255, 255, true) 
end 
addEventHandler("onResourceStart", root, CreatCarRandom) 
  
addEventHandler("onPlayerVehicleEnter", root, 
    function(vehicle) 
        if(isElement(vehicle_.car))then 
            if (vehicle == vehicle_.car) then   
                local x,y,z = unpack(marker[math.random(#marker)]) 
                Markers.Marker = createMarker(x, y, z, "cylinder", 5, 0, 0, 205, 170) 
                blip.blipCar2 = createBlipAttachedTo(Markers.Marker, 51) 
                setElementVisibleTo(Markers.Marker, root, false) 
                setElementVisibleTo(Markers.Marker, source, true) 
            end 
        end 
    end 
) 
    
addEventHandler( "onMarkerHit", root, 
    function(hitElement) 
        if ( getElementType( hitElement ) == "player" ) then 
            if( isPedInVehicle( hitElement ) )then 
                givePlayerMoney ( hitElement, math.random(50000,70000) ) 
                triggerClientEvent(hitElement, "playSoundC", hitElement) 
                for i,v in pairs(vehicle_) do 
                    destroyElement(v) 
                end 
                for i,v in pairs(Markers) do 
                    destroyElement(v) 
                end 
                for i,v in pairs(blip) do 
                    destroyElement(v) 
                end 
                CreatCarRandom () 
                
            end 
        end 
    end 
) 
  
addEventHandler("onPlayerVehicleExit", root, 
    function(vehicle) 
        if( isElement( vehicle_.car ) )then 
            if( vehicle == vehicle_.car )then 
                for i,v in pairs(vehicle_) do 
                    destroyElement(v) 
                end 
                for i,v in pairs(Markers) do 
                    destroyElement(v) 
                end 
                for i,v in pairs(blip) do 
                    destroyElement(v) 
                end 
            end 
        end 
    end 
) 
  
  

Link to comment
So you can't do tables in a "so claimed" own made script while it's using loops through the tables; Markers, vehicle_, blip, rand and ca3. Okay :/

I said that me and my friend made the script and i just did some little parts like getting locations outPutChatBox..etc

And my friend currently can't help me so thats why im posting here

And i made this post so people help me.. not judge me for the scripts :|

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