Jokeℝ1472771893 Posted July 24, 2012 Share Posted July 24, 2012 ok when i go to destanation the car destroyed and i can' see another blip how to fix it? addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function () missionXML = xmlLoadFile("truckmissions.xml"); end ) TruckMissionMarker = createMarker (-76, -1136, 1, "cylinder", 2, 255, 0, 0, 127, getRootElement()) TruckingMinigameBlip = createBlipAttachedTo ( TruckMissionMarker, 51, 2, 0, 0, 255, 255, 0, 250, getRootElement() ) addEventHandler ("onMarkerHit", getRootElement(), function (hitElement, matchingDim) if (source == TruckMissionMarker) and (getElementType(hitElement) == "player") then if not (isGuestAccount (getPlayerAccount (hitElement))) then local lastTruckMission = getAccountData (getPlayerAccount (hitElement), "lastTruckMission") if (lastTruckMission) then preTruckMission (hitElement, tonumber(lastTruckMission)+1) else preTruckMission (hitElement, 0) end end end if (getElementType (hitElement) == "vehicle") and (getElementID (hitElement) == "missiontruck") and (getElementID (source) == "TruckFinishMarker") and (getVehicleOccupant (hitElement)) then local markerParent = getElementParent (source) local truckParent = getElementParent (hitElement) if (markerParent == truckParent) then local reward = getElementData (markerParent, "reward") local damage = getElementHealth (hitElement) local exactReward = (damage / 1000 * reward ) local actualReward = math.round(tonumber(exactReward)) givePlayerMoney (getVehicleOccupant(hitElement), actualReward) local thePlayer = getVehicleOccupant(hitElement) outputChatBox ("#00aafftruck Mission:#ffffff Mission passed! You've won $" .. tostring(actualReward) .. "!", getVehicleOccupant(hitElement), 255, 255, 255, true) destroyElement (markerParent) triggerClientEvent (thePlayer, "ClientHideTruckMissionGUI", thePlayer) if not isGuestAccount (getPlayerAccount(thePlayer)) then local lastTruckMission = getAccountData (getPlayerAccount (thePlayer), "lastTruckMission") if (lastTruckMission) then setAccountData ( getPlayerAccount (thePlayer), "lastTruckMission", tonumber(lastTruckMission) +1) else setAccountData ( getPlayerAccount (thePlayer), "lastTruckMission", 0) end end end end end ) function preTruckMission (thePlayer, number) local missionroot = xmlFindChild (missionXML, "mission", number) if (missionroot) and (xmlNodeGetAttributes (missionroot)) then local misAtt = xmlNodeGetAttributes (missionroot) local title = misAtt["title"] local time = tostring (tonumber(misAtt["time"])) .. " seconds" local truckname = getVehicleNameFromModel(tonumber(misAtt["truck"])) local reward = tostring (misAtt["reward"]) .. " $" local description = xmlNodeGetValue (missionroot) triggerClientEvent (thePlayer, "ClientStartTruckMission", thePlayer, number, title, time, truckname, description, reward) else outputChatBox ("#00aaffTruck Mission:#ffffff All missions sucessfully done", thePlayer, 255, 255, 255, true) end end addEvent ("ServerStartTruckMission", true) addEventHandler ("ServerStartTruckMission", getRootElement(), function() if not (getElementByID (getPlayerNametagText (source) .. "_mission")) then if not (isGuestAccount (getPlayerAccount (source))) then local lastTruckMission = getAccountData (getPlayerAccount (source), "lastTruckMission") if (lastTruckMission) then number = tonumber(lastTruckMission) +1 else number = 0 end end local missionroot = xmlFindChild (missionXML, "mission", number) local misAtt = xmlNodeGetAttributes (missionroot) local title = misAtt["title"] local time = tonumber(misAtt["time"]) local truckId = tonumber(misAtt["truck"]) local x = tonumber(misAtt["x"]) local y = tonumber(misAtt["y"]) local z = tonumber(misAtt["z"]) local reward = tonumber(misAtt["reward"]) local description = xmlNodeGetValue (missionroot) local truck = createVehicle (truckId, -81, -1127, 2, 0, 0, 65, "MISSION") local trailer = createVehicle (584, 0, 0, 0, 0, 0, 0, "MISSION") attachTrailerToVehicle(truck, trailer) local destinationMarker = createMarker (x, y, z, "cylinder", 5, 0, 255, 255, 128, source) destinationBlip = createBlipAttachedTo (destinationMarker, 53, 2, 255, 255, 255, 255, 0, 9999, source ) local truckJobElement = createElement ("truckMission", getPlayerNametagText(source) .. "_mission") setElementData (truckJobElement, "reward", reward) warpPedIntoVehicle (source, truck) setVehicleLocked (truck, true) setElementData (truck, "TruckMisison", true) setElementID (truck, "missiontruck") setElementID (destinationMarker, "TruckFinishMarker") setElementID (destinationBlip, "TruckDestinationBlip") setElementParent (truck, truckJobElement) setElementParent (destinationMarker, truckJobElement) setElementParent (destinationBlip, truckJobElement) setElementParent (trailer, truckJobElement) setTimer(endTruckMission, time*1000, 1, source) triggerClientEvent (source, "ClientShowTruckMissionGUI", source) else outputChatBox ("#00aaffTruck Mission:#ffffff First finish your current mission!", source, 255, 255, 255, true) end end ) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end Link to comment
Castillo Posted July 24, 2012 Share Posted July 24, 2012 You mean that after reaching first destination, the second destination blip is not created? Link to comment
Jokeℝ1472771893 Posted July 24, 2012 Author Share Posted July 24, 2012 yes and my car destroyed Link to comment
Jokeℝ1472771893 Posted July 25, 2012 Author Share Posted July 25, 2012 please help me 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