Jump to content

[HELP] Job Script


Firespider

Recommended Posts

Hello! Need some help. I'm writing a work script and it doesn't work because if you go into the delivery spot, the car freezes. Because now the car just goes through the marker
 
 
 
--Client side
local Storage = {false, false}
local deliveryspot = {false, false}
local FinishJob = {false, false}

local DPoint = {
[1] =  {1648, -2249, 13},---airport -> Repülőtér
[2] =  {2190, -2266, 13},---docks -> Dokkok 
[3] =  {1369, -1889, 13},---Verdant Bluffs LS
[4] =  {1043, -1872, 13},
[5] =  {857, -1365, 13},
} 

local Anyagok = {
[1] = {"Fém"},
[2] = {"Deszka"},
[3] = {"Vas rúd"},
[4] = {"Nikecell"},
}

function WorkStart()
Storage[1] = createMarker(2784, -2455, 13, "cylinder", 10, 10, 160, 0)
Storage[2] = createBlip(2784, -2455, 13, 51, 40, 160, 0, 0)

outputChatBox("#1db8b5[Munka]#549c6bMenj el a raktárba és vedd fel rendelést", 0, 0, 0, true)
end
addEventHandler("onClientVehicleEnter", root,
function (thePlayer, seat)
if (source == getElementData(localPlayer, "Jobveh")) then
    if (seat == 0) then 
	   if not (Storage[1]) then 
	        WorkStart()
			end
			if not (FinishJob[1]) then
			FinishJob[1] = createMarker(2745, -2431, 13, "cylinder", 10, 20, 160, 10)
			FinishJob[2] = createBlip(2745, -2431, 13, 11, 2, 51, 10, 0, 0, 0, 255)
			end
		end
    end		
end
)

    addEventHandler("onClientMarkerHit", resourceRoot,
        function(hitPlayer, mDim) 
                if (mDim) then
                    if (source == Storage[1]) then
	                    if (hitPlayer == localPlayer) then
                        local vehicle = getPedOccupiedVehicle(hitPlayer)
		                    if (vehicle) then 
		                        if (vehicle == getElementData(hitPlayer, "Jobveh")) then 
			                    setElementFrozen(localPlayer,true)
			                    setElementFrozen(vehicle, true)
			  
			                    setTimer(function()
			                        setElementFrozen(vehicle, false)
			                        setElementFrozen(localPlayer, false)
			                        destroyElement(Storage[1])
			  destroyElement(Storage[2])
			  
			  local index = math.random(1, #DPoint)
			  
			  deliveryspot[1] = createMarker(DPoint[index][1], DPoint[index][2], DPoint[index][3], "cylinder", 15, 20, 160, 0)
			  deliveryspot[2] = createBlip(DPoint[index][1], DPoint[index][2], DPoint[index][3],  51, 10, 0, 0, 0, 255)
			  outputChatBox("#1db8b5[Munka]#549c6bSikeressen felvetted a rendelést menj és szállítsd ki", 0, 0, 0, true)
			    if (index == 1) then
			    outputChatBox("#1db8b5[Munka]#549c6bHely:Reptér.", 0, 0, 0, true)
				end
				if (index == 2) then
				 outputChatBox("#1db8b5[Munka]#549c6bHely:Dokkok.", 0, 0, 0, true)
                end			   
				if (index == 3) then
				 outputChatBox("#1db8b5[Munka]#549c6bHely:Verdant Bluffs LS.", 0, 0, 0, true)
                end			   
			end, math.random(3000, 5000), 1)
	            end  
                end
                end
    if (source == deliveryspot[1]) then
	                    if (hitPlayer == localPlayer) then
                        local vehicle = getPedOccupiedVehicle(hitPlayer)
		                    if (vehicle) then 
		                        if (vehicle == getElementData(hitPlayer, "Jobveh")) then 
			                    setElementFrozen(localPlayer,true)
			                    setElementFrozen(vehicle, true)
			  
			                    setTimer(function()
			                        setElementFrozen(vehicle, false)
			                        setElementFrozen(localPlayer, false)
			                        destroyElement(deliveryspot[1])
			                        destroyElement(deliveryspot[2])
                                   
                                    WorkStart();

									
                end, math.random(3000, 5000), 1)
            end
        end 
    end
end
end	
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...