berry172 Posted August 30, 2012 Share Posted August 30, 2012 ERROR: Infinite/too long execution (job-system) what is the problem? Link to comment
Dev Posted August 30, 2012 Share Posted August 30, 2012 There is an infinite or never ending for/while/do loop in your script. Link to comment
berry172 Posted August 30, 2012 Author Share Posted August 30, 2012 There is an infinite or never ending for/while/do loop in your script. Please watch: s_farmer_job: local lockTimer = nil local farmruns = { } local farmwage = { } local farmroute = { } local farmerkocsi = { [531] = true } function giveFarmerozasMoney(vehicle) outputChatBox("Kerestél " .. ( farmwage[vehicle] or 0 ) .. "Ft a fuvar(ok) során.", source, 255, 194, 15) exports.global:giveMoney(source, farmwage[vehicle] or 0) farmruns[vehicle] = 0 farmwage[vehicle] = 0 -- respawn the vehicle exports['anticheat-system']:changeProtectedElementDataEx(source, "realinvehicle", 0, false) removePedFromVehicle(source, vehicle) respawnVehicle(vehicle) setVehicleLocked(vehicle, false) setElementVelocity(vehicle,0,0,0) end addEvent("giveFarmerozasMoney", true) addEventHandler("giveFarmerozasMoney", getRootElement(), givFarmerozasMoney) function checkFarmerozasEnterVehicle(thePlayer, seat) if getElementData(source, "owner") == -2 and getElementData(source, "faction") == -1 and seat == 0 and farmerkocsi[getElementModel(source)] and getElementData(source,"job") == 2 and getElementData(thePlayer,"job") == 2 then triggerClientEvent(thePlayer, "startFarmJob", thePlayer, farmroute[source] or -1) if (farmruns[vehicle] ~= nil) and (farmwage[vehicle] > 0) then triggerClientEvent(thePlayer, "spawnFinishMarkerFarmJob", thePlayer) end end end addEventHandler("onVehicleEnter", getRootElement(), checkFarmerozasEnterVehicle) function startEnterFarmer(thePlayer, seat, jacked) if seat == 0 and farmerkocsi[getElementModel(source)] and getElementData(thePlayer,"job") == 1 and jacked then -- if someone try to jack the driver stop him if isTimer(lockTimer) then killTimer(lockTimer) lockTimer = nil end setVehicleLocked(source, true) lockTimer = setTimer(setVehicleLocked, 5000, 1, source, false) end end addEventHandler("onVehicleStartEnter", getRootElement(), startEnterFarmer) function saveDeliveryProgress2(vehicle, earned) if (farmruns[vehicle] == nil) then farmruns[vehicle] = 0 farmwage[vehicle] = 0 end farmruns[vehicle] = farmruns[vehicle] + 1 farmwage[vehicle] = farmwage[vehicle] + earned outputChatBox("#F94DD4Információ:#4821F7 Kiszállítót árúk: #1DCC1A" .. farmruns[vehicle] .. " #1AB2CCKereslet: #1CC21C" .. earned .. "FT.", client, 0, 255, 0, true) if (farmruns[vehicle] == 25) then outputChatBox("#B304D2Üres a járműved. #F70F0BAMenj vissza a Cég állomására és kezd újra a munkálatokat!", client, 0, 0, 0, true) else outputChatBox("#F94DD4Szállítás: #F70F0BJellenlegi árúkkal folytathatod a munkát vagy elmehetsz a fizetésedért!", client, 0, 0, 0, true) outputChatBox("#F70F0B((OOC INFORMÁCIÓ: #F4F828Sárga Jel#F70F0B=#282CF8Következő Hely #F70F0B| #F8282CPiros Jel=#282CF8Munka Befejezése#F70F0B))", client, 0, 0, 0, true) triggerClientEvent( client, "loadNewCheckpointFarmJob", client) triggerEvent("updateGlobalSupplies", client, math.random(10,20)) end end addEvent("saveDeliveryProgress2", true) addEventHandler("saveDeliveryProgress2", getRootElement(), saveDeliveryProgress2) function updateNextCheckpoint2(vehicle, pointid) farmroute[vehicle] = pointid end addEvent("updateNextCheckpoint2", true) addEventHandler("updateNextCheckpoint2", getRootElement(), updateNextCheckpoint2) function restoreFarmerozasJob() if getElementData(source, "job") == 2 then triggerClientEvent(source, "restoreFarmerJob", source) end end addEventHandler("restoreJob", getRootElement(), restoreFarmerozasJob) c_farmer_job: local blip, endblip local jobstate = 0 local route2 = 0 local oldroute2 = -1 local marker, endmarker local deliveryStopTimer = nil local localPlayer = getLocalPlayer() local utvonalak = { { -415.25, -1337.8, 25.7 }, { -402.24, -1347.44, 24.96 }, { -415.25, -1337.8, 25.7 }, { -402.24, -1347.44, 24.96 } } local farmerkocsi = { [531] = true } function resetFarmerJob() jobstate = 0 oldroute2 = -1 if (isElement(marker)) then destroyElement(marker) marker = nil end if (isElement(blip)) then destroyElement(blip) blip = nil end if (isElement(endmarker)) then destroyElement(endmarker) endmarker = nil end if (isElement(endcolshape)) then destroyElement(endcolshape) endcolshape = nil end if (isElement(endblip)) then destroyElement(endblip) endblip = nil end if deliveryStopTimer then killTimer(deliveryStopTimer) deliveryStopTimer = nil end end addEventHandler("onClientChangeChar", getRootElement(), resetFarmerJob) function displayFarmerJob(notext) if (jobstate==0) then jobstate = 1 blip = createBlip(2196.068359375, -2265.8203125, 13.554685592651, 51, 2, 255, 127, 255) if not notext then outputChatBox("#EE1333(( FELHÍVÁS! #6488E2Farmerkodás: #E264BCMenj el a Farmer HQ-hoz a farmerkodás elkezdéséhez. #EE1333))", 255, 194, 15, true) end end end addEvent("restoreFarmerJob", true) addEventHandler("restoreFarmerJob", getRootElement(), function() displayFarmerJob(true) end ) function startFarmerJob(routeid) if (jobstate==1) then local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getVehicleController(vehicle) == localPlayer and farmerkocsi[getElementModel(vehicle)] then outputChatBox("#EE1321((#D8EE13Kövesd a Checkpointokat a munka elvégzéséhez!#EE1321)) ", 255, 194, 15, true) outputChatBox("#FCFCFCFeladat kiadva! Szántsd le az összes gabonát! Jó munkát! ", 255, 194, 15, true) destroyElement(blip) local rand = math.random(1, #utvonalak) if not (routeid == -1) then rand = routeid else end route2 = utvonalak[rand] local x, y, z = route2[1], route2[2], route2[3] blip = createBlip(x, y, z, 0, 2, 255, 200, 0) marker = createMarker(x, y, z, "checkpoint", 4, 252, 254, 252, 150) addEventHandler("onClientMarkerHit", marker, waitAtDelivery2) jobstate = 2 oldroute2 = rand if (routeid == -1) then triggerServerEvent("updateNextCheckpoint2", localPlayer, vehicle, rand) end else outputChatBox("#F70F0BNem vagy árúszállító járműben!", 255, 0, 0) end end end addEvent("startFarmJob", true) addEventHandler("startFarmJob", getRootElement(), startFarmerJob) function waitAtDelivery2(thePlayer) local vehicle = getPedOccupiedVehicle(localPlayer) if thePlayer == localPlayer and vehicle and getVehicleController(vehicle) == localPlayer and farmerkocsi[getElementModel(vehicle)] then if getElementHealth(vehicle) < 350 then outputChatBox("#F70F0BA rakomány megsérült ezért így nem fogadjuk el!#0464D2 Megértését köszönjük!", 255, 0, 0) else deliveryStopTimer = setTimer(nextDeliveryCheckpoint, 100, 1) outputChatBox("#F94DD4Szállítás:#B304D2 Árúk kipakolása és a beltér rendbe tétele folyamatban....", 255, 0, 0, true ) addEventHandler("onClientMarkerLeave", marker, checkWaitAtDelivery2) end end end function checkWaitAtDelivery2(thePlayer) local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and thePlayer == localPlayer and getVehicleController(vehicle) == localPlayer and farmerkocsi[getElementModel(vehicle)] then if getElementHealth(vehicle) >= 350 then outputChatBox("#F94DD4Szállítás:#D23004 Hééééééé, várjál már még nem pakoltunk ki mindent!", 255, 0, 0) if deliveryStopTimer then killTimer(deliveryStopTimer) deliveryStopTimer = nil end removeEventHandler("onClientMarkerLeave", source, checkWaitAtDelivery2) end end end function nextDeliveryCheckpoint() deliveryStopTimer = nil if jobstate == 2 or jobstate == 3 then local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getVehicleController(vehicle) == localPlayer and farmerkocsi[getElementModel(vehicle)] then destroyElement(marker) destroyElement(blip) --vehicleid = tonumber( getElementData(vehicle, "dbid") ) local health = getElementHealth(vehicle) if health >= 85 then pay = 5000 elseif health >= 65 then pay = 4000 elseif health >= 45 then pay = 3000 else pay = 0 end spawnFinishMarkerFarmJob() triggerServerEvent("saveDeliveryProgress2", localPlayer, vehicle, pay) else outputChatBox("#FF9933Mit akarsz leadni?", 255, 0, 0, true ) -- Wrong car type. end end end function spawnFinishMarkerFarmJob() if jobstate == 2 then -- no final checkpoint set yet endblip = createBlip(-410.6806640625, -1426.712890625, 25.585376739502, 0, 2, 255, 0, 0) endmarker = createMarker(2196.068359375, -2265.8203125, 13.554685592651, "checkpoint", 4, 255, 0, 0, 150) setMarkerIcon(endmarker, "finish") addEventHandler("onClientMarkerHit", endmarker, endDelivery) end jobstate = 3 end addEvent("spawnFinishMarkerFarmJob", true) addEventHandler("spawnFinishMarkerFarmJob", getRootElement(), spawnFinishMarkerFarmJob) function loadNewCheckpointFarmJob() local vehicle = getPedOccupiedVehicle(localPlayer) -- next drop off local rand = -1 repeat rand = math.random(1, #utvonalak) until oldroute2 ~= rand and getDistanceBetweenPoints2D(utvonalak[oldroute2][1], utvonalak[oldroute2][2], utvonalak[rand][1], utvonalak[rand][2]) > 250 route2 = utvonalak[rand] oldroute2 = rand local x, y, z = route2[1], route2[2], route2[3] blip = createBlip(x, y, z, 0, 2, 255, 200, 0) marker = createMarker(x, y, z, "checkpoint", 4, 255, 200, 0, 150) addEventHandler("onClientMarkerHit", marker, waitAtDelivery2) triggerServerEvent("updateNextCheckpoint2", localPlayer, vehicle, rand) end addEvent("loadNewCheckpointFarmJob", true) addEventHandler("loadNewCheckpointFarmJob", getRootElement(), loadNewCheckpointFarmJob) function endDelivery(thePlayer) if thePlayer == localPlayer then local vehicle = getPedOccupiedVehicle(localPlayer) local id = getElementModel(vehicle) or 0 if not vehicle or getVehicleController(vehicle) ~= localPlayer or not (farmerkocsi[id]) then outputChatBox("#FF9933Csak a furgonban ülve tudod leadni.", 255, 0, 0, true ) -- Wrong car type. else local health = getElementHealth(vehicle) if health <= 700 then outputChatBox("Főnők:#D21F04 Ezt így nem fogadjuk el , javíttasd meg előszőr! ", 255, 194, 15) else triggerServerEvent("giveFarmerozasMoney", localPlayer, vehicle) resetFarmerJob() displayFarmerJob(true) end end end end Link to comment
Dev Posted August 30, 2012 Share Posted August 30, 2012 There is no loop in that script. Link to comment
Des Posted August 30, 2012 Share Posted August 30, 2012 There is no loop in that script. clientside Link to comment
berry172 Posted August 30, 2012 Author Share Posted August 30, 2012 There is no loop in that script. clientside how to fix bugg? Link to comment
Des Posted August 30, 2012 Share Posted August 30, 2012 repeat rand = math.random(1, #utvonalak) until oldroute2 ~= rand and getDistanceBetweenPoints2D(utvonalak[oldroute2][1], utvonalak[oldroute2][2], utvonalak[rand][1], utvonalak[rand][2]) > 250 I guess this is your problem. nothing serious 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