Jump to content

Ice Cold

Members
  • Posts

    7
  • Joined

  • Last visited

Details

  • Gang
    LSPD

Ice Cold's Achievements

Newbie

Newbie (4/54)

0

Reputation

  1. Thanks. (I am very very bad at client-side scripting)
  2. Is it possible to call engineImportTXD() and engineReplaceModel() only for few players, so people, who don't want server mods, can use their ones?
  3. Oh my god. It was so simple. Thanks man.
  4. Actually, could be. I've noticed also that, the marker actually exists for everyone, bus is visible only for "right" player. I'll check.
  5. Oh, and i've also tried not to actually destroy the spawned markers, but to move them (e.g. setElementPosition). Happens the same. It actually bugs very wierd. When that glitch happens, you could take the same busstop for infinite times, and next ones just keep spawning. (This glitch can be recreated if 2 persons take the same bus stop, at the same time).
  6. Wow. It's amazing. But if you would make it able to work remotely (over sftp and ssh), it would be 1000% awesomness.
  7. Hi there. I have problem with markers. Actually, they work fine, until there are created 2 markers at same spot. (e.g. 2 persons have to get the same). Basically, the script is for bus-driver mision. Language in outputChatBox() is latvian, but i think, it doesn't matters. Also, i know the bug, you can actually enter bus, start mission, exit bus and take checkpoints with any vehicle. This is my meta.xml "Svens Jansons" type="script" description="Autobusa šofera sistēma." /> This is my route.lua route = { {}, {1823.060546875, -1858.9423828125, 13.160822868347}, {1778.0166015625, -1826.076171875, 13.116574287415}, {1675.029296875, -1864.859375, 13.187935829163}, {1636.2568359375, -1869.9052734375, 13.135141372681}, {1572.708984375, -1844.3955078125, 13.187378883362}, {1552.4169921875, -1729.8955078125, 13.180339813232}, {1369.4384765625, -1730.6044921875, 13.180553436279}, {1314.22265625, -1663.5029296875, 13.180320739746}, {1368.8359375, -1586.23828125, 13.117489814758}, {1439.8564453125, -1595.1044921875, 13.115889549255}, {1613.9755859375, -1594.306640625, 13.294191360474}, {1690.4013671875, -1594.669921875, 13.180178642273}, {1784.16015625, -1611.091796875, 13.097899436951}, {1823.5634765625, -1589.9833984375, 13.093682289124}, {1935.9296875, -1465.8349609375, 13.162134170532}, {1972.9345703125, -1466.7041015625, 13.143642425537}, {2109.703125, -1479.30078125, 23.563709259033}, {2106.904296875, -1692.138671875, 13.181887626648}, {2184.2392578125, -1751.58203125, 13.095428466797}, {2201.3564453125, -1734.3662109375, 13.13761806488}, {2240.7294921875, -1656.26953125, 15.037101745605}, {2282.263671875, -1661.0205078125, 14.801210403442}, {2311.9931640625, -1729.6474609375, 13.120140075684}, {2213.2958984375, -1748.75, 13.125422477722}, {2243.328125, -2043.26171875, 13.194364547729}, {2274.19921875, -2087.794921875, 13.170400619507}, {2082.130859375, -2108.654296875, 13.104212760925}, {1959.7197265625, -2125.484375, 13.124167442322}, {1825.4658203125, -2148.744140625, 13.180575370789}, {1840.712890625, -2053.798828125, 13.116111755371}, {1963.4990234375, -2027.87109375, 13.130055427551}, {1964.0380859375, -1910.7998046875, 13.180257797241}, {1963.7861328125, -1821.369140625, 13.180832862854}, {1950.7646484375, -1750.2509765625, 13.166752815247}, {1852.1943359375, -1749.537109375, 13.181241989136}, {1819.6787109375, -1768.3115234375, 13.179452896118}, {}, {}, {}, } This is my busstops.lua busStops = { --{1819.91796875, -1886.7216796875, 13.138957023621, "Unity Stacija"}, {1714.697265625, -1810.4541015625, 13.094497680664, "Church st."}, {1598.04296875, -1868.9619140625, 13.131368637085, "West Coast Customs Serviss" }, {1481.6865234375, -1730.2021484375, 13.119864463806, "Dome" }, {1315.51171875, -1594.0537109375, 13.11657333374, "St. Lawrence Blvd." }, {1514.8232421875, -1595.4814453125, 13.130033493042, "Policijas iecirknis" }, {1729.3046875, -1599.041015625, 13.108394622803, "Ziņu Dienests" }, {1875.4755859375, -1468.150390625, 13.129601478577, "Skeitparks" }, {2003.5400390625, -1467.025390625, 13.127025604248, "Picērija" }, {2104.9013671875, -1755.8916015625, 13.131708145142, "GYM"}, {2221.2197265625, -1709.2060546875, 13.173715591431, "Grove Street"}, {2338.9013671875, -1693.7939453125, 13.101926803589, "Metālu nodošanas punkts"}, {2211.6015625, -1957.130859375, 13.092323303223, "Auto Pirktuve"}, {2179.5908203125, -2141.6005859375, 13.13565826416, "Nude & XXX Shop"}, {1933.0556640625, -2164.2216796875, 13.123024940491, "Aces St."}, {1944.474609375, -2054.5361328125, 13.118592262268, "HEX Serviss"}, {1964.0087890625, -1869.525390625, 13.178686141968, "Statoil"}, {1923.3291015625, -1750.00390625, 13.180325508118, "MARŠUTA BEIGAS"}, {1818.7216796875, -1806.4326171875, 13.144490242004, "Beigas."}, } And finally, the mission script. --[[ (c) Svens Jansons, 2013 Skripts izstrādāts RP.EXS.LV MTA serverim, Los Santos Central Bus Company frakcijai. ]]-- mysql = exports.mysql function isPlayerInMarker(thePlayer, theMarker) local pid = tonumber(getElementData(thePlayer, "dbid")) local theShape = getElementColShape(theMarker) veh = getPedOccupiedVehicle(thePlayer) if isElementWithinColShape(thePlayer, theShape) or isElementWithinColShape(veh, theShape) then return true else return false end end local startBlip = createBlip(-1549.9873046875, -2762.40625, 48, 51, 2, 0, 0, 0, 0, 0, 999999) --local startMarker = createMarker (-1549.9873046875, -2762.40625, 48, "cylinder", 4.0, 255, 0, 0, 150) function bus_init(thePlayer, commandname) local pid = tonumber(getElementData(thePlayer, "dbid")) if getElementData(thePlayer, "faction") == 83 then setElementData(thePlayer, "bus", 0) setElementData(thePlayer, "routeProgress", 0) setElementData(thePlayer, "busprofit", 0) setElementData(thePlayer, "busMarkerVisible", 0) outputChatBox("Iekāp autobusā, lai parādītos sākumpunkts.", thePlayer) destroyElement(startMarker[pid]) destroyElement(busStop[pid]) destroyElement(busStopBlip[pid]) destroyElement(routeMarker1[pid]) destroyElement(routeMarker2[pid]) destroyElement(routeBlip1[pid]) destroyElement(routeBlip2[pid]) end end addCommandHandler("bus", bus_init, false, false) function showStartMarker(thePlayer) local pid = tonumber(getElementData(thePlayer, "dbid")) --outputChatBox(getElementData(thePlayer, "faction")) if getElementData(thePlayer, "bus") == nil then setElementData(thePlayer, "bus", 0) setElementData(thePlayer, "busprofit", 0) end if (getElementData(thePlayer, "faction") == 83 and getElementData(thePlayer, "bus") == 0 and getElementData(thePlayer, "busMarkerVisible") ~= 1) then startMarker = {}; startMarker[pid] = createMarker (1819.91796875, -1886.7216796875, 13.138957023621, "cylinder", 4.0, 255, 0, 0, 150, thePlayer) setElementData(startMarker[pid], "pid", pid) addEventHandler("onMarkerHit", startMarker[pid], startBus) setElementData(thePlayer, "busMarkerVisible", 1) end end addEventHandler("onVehicleEnter", getRootElement(), showStartMarker) function startBus(thePlayer) local pid = tonumber(getElementData(thePlayer, "dbid")) if (getElementData(thePlayer, "faction") == 83) then theVehicle = getPedOccupiedVehicle (thePlayer) vehicleID = getElementModel(theVehicle) if vehicleID == 437 or vehicleID == 431 then if isPlayerInMarker(thePlayer, startMarker[pid]) then outputChatBox("Sākam darbu...", thePlayer, 0, 255, 0) setElementData(thePlayer, "bus", 1) busJob(thePlayer) else outputChatBox("Kļūda? Hacking around?", thePlayer, 255, 0, 0) end else outputChatBox("Tev ir jāatrodas Coach vai Bus markas autobusā!", thePlayer, 255, 0, 0) end else outputChatBox("Tikai \"Los Santos Central Bus Company\" frakcijas biedriem ir iespēja izmantot šo darbu!", thePlayer, 255, 0, 0) end end function busJob(thePlayer) local pid = tonumber(getElementData(thePlayer, "dbid")) theVehicle = getPedOccupiedVehicle (thePlayer) if getElementData(thePlayer, "faction") == 83 and getElementData(thePlayer, "bus") > 0 then if true then local progress = getElementData(thePlayer, "bus") if progress == 1 then --setElementData(thePlayer, "routeProgress", 2) destroyElement(startMarker[pid]) end rProgress = getElementData(thePlayer, "routeProgress") if getElementData(thePlayer, "routeProgress") == 2 or progress == 1 then busStopMarker = busStops[tonumber(progress)] end if getElementData(thePlayer, "routeProgress") ~= 2 or progress == 1 then d1 = progress * 2 d2 = d1 + 1 drouteMarker1 = route[d1] drouteMarker2 = route[d2] if drouteMarker1 then routeX1 = drouteMarker1[1] routeY1 = drouteMarker1[2] routeZ1 = drouteMarker1[3] else outputChatBox("Kaut kas nav. Sazinies ar administratoru.", thePlayer, 255, 0, 0) end if drouteMarker2 then routeX2 = drouteMarker2[1] routeY2 = drouteMarker2[2] routeZ2 = drouteMarker2[3] else outputChatBox("Kaut kas nav. Sazinies ar administratoru.", thePlayer, 255, 0, 0) end end if busStopMarker then x = busStopMarker[1] y = busStopMarker[2] z = busStopMarker[3] else outputChatBox("Kaut kas nav. Sazinies ar administratoru.", thePlayer, 255, 0, 0) end --outputChatBox(tonumber(rProgress), thePlayer, 255, 0, 0) if progress <= 19 and progress > 0 and rProgress == 2 then busStop = {}; busStopBlip = {}; busStop[pid] = createMarker(x, y, z, "cylinder", 4, 255, 0, 0, 150, thePlayer) busStopBlip[pid] = createBlip(x, y, z, 0, 4, 255, 0, 0, 255, 0, 999999, thePlayer) setElementData(thePlayer, "routeProgress", 0) addEventHandler("onMarkerHit", busStop[pid], timerIncreaseJob) elseif rProgress == 0 or rProgress == 1 or progress == 1 then routeMarker1 = {}; routeMarker2 = {}; routeBlip1 = {}; routeBlip2 = {}; routeMarker1[pid] = createMarker(routeX1, routeY1, routeZ1, "cylinder", 4.0, 255, 102, 51, 150, thePlayer) routeMarker2[pid] = createMarker(routeX2, routeY2, routeZ2, "cylinder", 4.0, 255, 102, 51, 150, thePlayer) routeBlip1[pid] = createBlip(routeX1, routeY1, routeZ1, 0, 3, 255, 102, 51, 255, 0, 999999, thePlayer) routeBlip2[pid] = createBlip(routeX2, routeY2, routeZ2, 0, 3, 255, 102, 51, 255, 0, 999999, thePlayer) if progress == 1 then setElementData(thePlayer, "routeProgress", 0) end addEventHandler("onMarkerHit", routeMarker1[pid], checkRoute) addEventHandler("onMarkerHit", routeMarker2[pid], checkRoute) else destroyElement(busStop) destroyElement(busStopBlip) endJob(thePlayer) return end else --outputChatBox("Tev nav piekabināts treileris!", thePlayer, 255, 0, 0) end else --outputChatBox("Nav pieejams!", thePlayer, 255, 0, 0) end end function checkRoute(thePlayer) local pid = tonumber(getElementData(thePlayer, "dbid")) theVehicle = getPedOccupiedVehicle (thePlayer) if getElementData(thePlayer, "faction") == 83 and getElementData(thePlayer, "bus") > 0 then if getElementData(thePlayer, "routeProgress") == 0 then setElementData(thePlayer, "routeProgress", 1) destroyElement(routeMarker1[pid]) destroyElement(routeBlip1[pid]) elseif getElementData(thePlayer, "routeProgress") == 1 then setElementData(thePlayer, "routeProgress", 2) destroyElement(routeMarker2[pid]) destroyElement(routeBlip2[pid]) busJob(thePlayer) else setElementData(thePlayer, "routeProgress", 0) end end end function timerIncreaseJob(thePlayer) local pid = tonumber(getElementData(thePlayer, "dbid")) if isPlayerInMarker(thePlayer, busStop[pid]) then theVehicle = getPedOccupiedVehicle(thePlayer) if getElementData(thePlayer, "faction") == 83 and getElementData(thePlayer, "bus") > 0 then if true then bus = getPedOccupiedVehicle(thePlayer) setElementFrozen(bus, true) outputChatBox("Uzgaidiet pieturā." , thePlayer, 255, 102, 51) setTimer(increaseJob, 10000, 1, thePlayer) else outputChatBox("Tev nav piekabināts treileris!", thePlayer, 255, 0, 0) end else outputChatBox("Bugs? Kļūda? Hacking around?", thePlayer, 255, 0, 0) end end end function increaseJob(thePlayer) local pid = tonumber(getElementData(thePlayer, "dbid")) if isPlayerInMarker(thePlayer, busStop[pid]) then theVehicle = getPedOccupiedVehicle (thePlayer) if getElementData(thePlayer, "faction") == 83 and getElementData(thePlayer, "bus") > 0 then if true then truck = getPedOccupiedVehicle(thePlayer) setElementFrozen(truck, false) setElementData(thePlayer, "busprofit", getElementData(thePlayer, "busprofit") + 80) --outputChatBox("Jūs veicāt savu "..getElementData(thePlayer, "bus")..". piegādi šajā fūrē.", thePlayer, 255, 255, 255) --outputChatBox("Jūs nopelnijāt $80. [Kopā: $"..getElementData(thePlayer, "busprofit").."]" , thePlayer, 255, 255, 255) --outputChatBox("Frakcija par to saņēma $100." , thePlayer, 255, 255, 255) mysql:query_free("UPDATE `factions` SET `bankbalance` = `bankbalance` + 100 WHERE `id` = 83") setElementData(thePlayer, "bus", getElementData(thePlayer, "bus") + 1) destroyElement(busStop[pid]) destroyElement(busStopBlip[pid]) busJob(thePlayer) else outputChatBox("Tev nav piekabināts treileris!", thePlayer, 255, 0, 0) end else outputChatBox("Bugs? Gļuks? Hacking around?", thePlayer, 255, 0, 0) end else outputChatBox("Bugs? Gļuks? Hacking around?", thePlayer, 255, 0, 0) end end function endJob(thePlayer) local pid = tonumber(getElementData(thePlayer, "dbid")) theVehicle = getPedOccupiedVehicle (thePlayer) if getElementData(thePlayer, "faction") == 83 and getElementData(thePlayer, "bus") > 0 then if true then exports.global:giveMoney(thePlayer, 250) outputChatBox("Darbs pabeigts. Atgriezies bāzē. Frakcija saņēma: $"..getElementData(thePlayer, "bus")*100 ..".", thePlayer, 0, 255, 0) outputChatBox("Lai strādātu atkal, raksti /bus", thePlayer) outputChatBox("Tu saņem $250 prēmiju par pabeigtu darbu!", thePlayer) setElementData(thePlayer, "bus", 0) setElementData(thePlayer, "busprofit", 0) exports['admin-system']:restartSingleResource(false, false, "faction-system") else outputChatBox("Tev nav piekabināts treileris!", thePlayer, 255, 0, 0) end else --outputChatBox("Nav pieejams!", thePlayer, 255, 0,0) end end
×
×
  • Create New...