5150 Posted October 3, 2016 Share Posted October 3, 2016 (edited) hey, so i have some truck job ive been editing. the mod was originally for LS but i edited the coords for SF, but now sometimes the red blip showing your destination wont show on the maps. heres the original script, then the one i edited my edited one Spoiler --new one --//Tables and other stuff tableLocationsX = {} tableLocationsY = {} tableLocationsZ = {} tableMoney = {} locationCount = 5 --//Location 1 tableLocationsX[1] = -2444.19556 tableLocationsY[1] = 731.77002 tableLocationsZ[1] = 35.0156 tableMoney[1] = 500 --//Location 2 tableLocationsX[2] = -2630.39526 tableLocationsY[2] = 1371.92773 tableLocationsZ[2] = 7.10329 tableMoney[2] = 500 --//Location3 tableLocationsX[3] = -1641.61780 tableLocationsY[3] = 49.63347 tableLocationsZ[3] = 3.5546 tableMoney[3] = 300 --//Location4 tableLocationsX[3] = -2112.10962 tableLocationsY[3] = 210.48143 tableLocationsZ[3] = 35.22631 tableMoney[4] = 300 --//Location5 tableLocationsX[3] = -1971.51318 tableLocationsY[3] = 723.73877 tableLocationsZ[3] = 45.44531 tableMoney[5] = 500 function startScript () --Marker marker = createMarker (-2145.91235, -234.78612, 36, "cylinder", 1.1, 0, 255, 0) addEventHandler ("onMarkerHit", marker, startMission) --Objects and Ped ped = createPed (302, -2145.84570, -237.63202, 36.51563) addEventHandler ("onPedWasted", getRootElement(), respawnPed) --Blip startBlip = createBlip (-2144.32568, -237.48190, 36.51563, 51) end function startMission (hitElement) if getElementType (hitElement) == "player" then --Check team -- local team = getPlayerTeam (hitElement) -- if getTeamName (team) ~= "Workers" then -- local teamName = getTeamName (team) -- outputChatBox ("#ffaa00// #ffffffOnly workers can drive trucks! Press F2 to change the team.", hitElement, 255, 255, 255, true) -- return false -- else --createThings rekka = createVehicle (515, -2136.15771, -181.99234, 36.0864, 0, 0, 0) vaunu = createVehicle (450, -2136.15771, -191, 36.08, 0, 0, 0) randomLoc = math.random (1, locationCount) finish = createMarker (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], "cylinder", 3, 0, 200, 55, 255, hitElement) blip = createBlip (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], 0, 2, 255, 0, 0, 255, 0, 10000, hitElement) --addEventHandlers addEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) addEventHandler ("onVehicleExit", getRootElement(), vehicleExit) addEventHandler ("onMarkerHit", finish, reward) addEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other setVehicleLocked (rekka, true) destroyElement (startBlip) pelaaja = hitElement outputChatBox ("#ffaa00// #ffffffDrive to the red blip on the map #ffaa00", pelaaja, 255, 255, 255, true) setElementPosition (marker, -406, -64, 2.4) setVehicleVariant (vaunu, 0, 0) warpPedIntoVehicle (hitElement, rekka) -- end else return false end end function trailerDetach () if source == vaunu then --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (-2144.32568, -237.48190, 36.51563, 51) setElementPosition (marker, -2145.91235, -234.78612, 36) else return false end end function vehicleExit (leaver) if source == rekka and leaver == pelaaja then setVehicleLocked (rekka, false) outputChatBox ("#ffaa00// #ffffffYou have 10 seconds to return to your truck", leaver, 255, 255, 255, true) destroyTimer = setTimer (destroyVehicle, 10000, 1) addEventHandler ("onVehicleEnter", getRootElement(), destrTimer) else return false end end function destrTimer (thePlayer) if source == rekka and thePlayer == pelaaja then local team = getPlayerTeam (thePlayer) if getTeamName (team) == "Freeroam" or getTeamName (team) == "The Police" then return false else killTimer (destroyTimer) removeEventHandler ("onVehicleEnter", getRootElement(), destrTimer) setVehicleLocked (rekka, true) end else return false end end function destroyVehicle () if destroyTimer then --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onVehicleEnter", getRootElement(), destrTimer) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (-2144.32568, -237.48190, 36.51563, 51) setElementPosition (marker, -2145.91235, -234.78612, 36) else return false end end function onQuit () if source == pelaaja then --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (-2144.32568, -237.48190, 36.51563, 51) setElementPosition (marker, -2145.91235, -234.78612, 36) end end function reward (hitElement) if hitElement == rekka then --other startBlip = createBlip (-2144.32568, -237.48190, 36.51563, 51) outputChatBox ("#ffaa00// #ffffffThanks for the delivery, We paid you $" .. tableMoney[randomLoc] .. "", pelaaja, 255, 255, 255, true) outputChatBox ("#ffaa00// #ffffffDrive back to the truck depot for more supplies ", pelaaja, 255, 255, 255, true) setElementPosition (marker, -2145.91235, -234.78612, 36) palkittava = getVehicleOccupant (rekka, 0) givePlayerMoney (palkittava, tableMoney[randomLoc]) --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) else return false end end function respawnPed () if source == ped then timer = setTimer (pedRespawn, 5000, 1) else return false end end function pedRespawn () killTimer (timer) destroyElement (ped) ped = createPed (302, -2145.84570, -237.63202, 36.51563) end addEventHandler ("onResourceStart", getResourceRootElement(getThisResource()), startScript) the original Spoiler --// Made by: MoPoMaN --//Tables and other stuff tableLocationsX = {} tableLocationsY = {} tableLocationsZ = {} tableMoney = {} locationCount = 3 --//Location 1 tableLocationsX[1] = 2253.7 tableLocationsY[1] = -84.0 tableLocationsZ[1] = 25.3 tableMoney[1] = 500 --//Location 2 tableLocationsX[2] = 1093.7 tableLocationsY[2] = -931.6 tableLocationsZ[2] = 41.9 tableMoney[2] = 550 --//Location3 tableLocationsX[3] = -47.3 tableLocationsY[3] = -1137.5 tableLocationsZ[3] = 0.07 tableMoney[3] = 500 function startScript () --Marker marker = createMarker (2776.6, -2425.5, 12.6, "cylinder", 1.1, 0, 255, 0) addEventHandler ("onMarkerHit", marker, startMission) --Objects and Ped ped = createPed (302, 2776.7, -2428.1, 13.6) tableObj = createObject (2205, 2775.9, -2426.8, 12.6) chairObj = createObject (2309, 2776.7, -2427.4, 12.6) addEventHandler ("onPedWasted", getRootElement(), respawnPed) --Blip startBlip = createBlip (2776.9, -2423.9, 12.7, 51) end function startMission (hitElement) if getElementType (hitElement) == "player" then --Check team -- local team = getPlayerTeam (hitElement) -- if getTeamName (team) ~= "Workers" then -- local teamName = getTeamName (team) -- outputChatBox ("#ffaa00// #ffffffOnly workers can drive trucks! Press F2 to change the team.", hitElement, 255, 255, 255, true) -- return false -- else --createThings rekka = createVehicle (515, 2779.6, -2437.2, 14.7, 0, 0, 90) vaunu = createVehicle (450, 2789.2, -2437.1, 14.2, 0, 0, 90) randomLoc = math.random (1, locationCount) finish = createMarker (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], "cylinder", 3, 0, 200, 55, 255, hitElement) blip = createBlip (tableLocationsX[randomLoc], tableLocationsY[randomLoc], tableLocationsZ[randomLoc], 0, 2, 255, 0, 0, 255, 0, 10000, hitElement) --addEventHandlers addEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) addEventHandler ("onVehicleExit", getRootElement(), vehicleExit) addEventHandler ("onMarkerHit", finish, reward) addEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other setVehicleLocked (rekka, true) destroyElement (startBlip) pelaaja = hitElement outputChatBox ("#ffaa00// #ffffffDrive to the red blip on the map #ffaa00", pelaaja, 255, 255, 255, true) setElementPosition (marker, -406, -64, 2.4) setVehicleVariant (vaunu, 0, 0) warpPedIntoVehicle (hitElement, rekka) -- end else return false end end function trailerDetach () if source == vaunu then --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) else return false end end function vehicleExit (leaver) if source == rekka and leaver == pelaaja then setVehicleLocked (rekka, false) outputChatBox ("#ffaa00// #ffffffGo back to the truck in 10 seconds!", leaver, 255, 255, 255, true) destroyTimer = setTimer (destroyVehicle, 10000, 1) addEventHandler ("onVehicleEnter", getRootElement(), destrTimer) else return false end end function destrTimer (thePlayer) if source == rekka and thePlayer == pelaaja then local team = getPlayerTeam (thePlayer) if getTeamName (team) == "Freeroam" or getTeamName (team) == "The Police" then return false else killTimer (destroyTimer) removeEventHandler ("onVehicleEnter", getRootElement(), destrTimer) setVehicleLocked (rekka, true) end else return false end end function destroyVehicle () if destroyTimer then --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onVehicleEnter", getRootElement(), destrTimer) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) else return false end end function onQuit () if source == pelaaja then --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) setElementPosition (marker, 2776.6, -2425.5, 12.6) end end function reward (hitElement) if hitElement == rekka then --other startBlip = createBlip (2776.9, -2423.9, 12.7, 51) outputChatBox ("#ffaa00// #ffffffGood job! You've been rewarded " .. tableMoney[randomLoc] .. "$", pelaaja, 255, 255, 255, true) setElementPosition (marker, 2776.6, -2425.5, 12.6) palkittava = getVehicleOccupant (rekka, 0) givePlayerMoney (palkittava, tableMoney[randomLoc]) --destroyThings destroyElement (rekka) destroyElement (vaunu) destroyElement (finish) destroyElement (blip) --removeEventHandlers removeEventHandler ("onTrailerDetach", getRootElement(), trailerDetach) removeEventHandler ("onVehicleExit", getRootElement(), vehicleExit) removeEventHandler ("onPlayerQuit", getRootElement(), onQuit) else return false end end function respawnPed () if source == ped then timer = setTimer (pedRespawn, 5000, 1) else return false end end function pedRespawn () killTimer (timer) destroyElement (ped) ped = createPed (302, 2776.7, -2428.1, 13.6) end addEventHandler ("onResourceStart", getResourceRootElement(getThisResource()), startScript) i think its because i didnt edit the setElementPosition (marker, -406, -64, 2.4) on line 70 (original is 70, my edited is line 84), but im not sure what that does so i cant edit it Edited October 3, 2016 by Mandalore5150 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