ViRuZGamiing Posted December 29, 2012 Share Posted December 29, 2012 Hello Community, I edited a Bus-Script to my coordinates and added busses more. When I enter the bus the script says "You started the bus job" and when exit I get my money. But what I want to edit but don't know how I want when in the marker (busstop) you can't further for 3 Seconds. (Supposed to let players in the bus during the 3 Seconds) But also when you're in the marker an chatboxOutPut say (only for that jobbing player) Next Stop: Name of the Stop The stops i know have are: Jiggy's, Park, Hospital Also when I leave the bus or the bus explodes the Bus stays there. i want "onVehicleCollapse" and "onVehicleExit" (I think) to be Bus Respawn to the Scripts bus map spawn. The Script Client-Sided local client = getLocalPlayer( ) local rootElement = getRootElement() local marker = nil local blip = nil addEvent("bus_set_location",true) addEventHandler("bus_set_location",rootElement, function (x, y, z) marker = createMarker(tostring(x), tostring(y), tostring(z)-1, "checkpoint", 4.0, 0, 0, 255, 255) blip = createBlipAttachedTo( marker, 41, 3, 0, 0, 255, 255 ) addEventHandler("onClientMarkerHit",marker,onBusStopHit) end) function onBusStopHit(hitPlayer) if not hitPlayer == client then return end triggerServerEvent("bus_finish",client,client) if isElement(blip) then destroyElement(blip) end if isElement(marker) then removeEventHandler("onClientMarkerHit",marker,onBusStopHit) destroyElement(marker) end end addEventHandler("onClientVehicleExit",rootElement, function () if isElement(marker) then removeEventHandler("onClientMarkerHit",marker,onBusStopHit) destroyElement(marker) end if isElement(blip) then destroyElement(blip) end end) Server-Sided local rootElement = getRootElement() local busses = {[431] = true, [437] = true} local busTable = { [1]={-2457.8000488281, 1356.8000488281, 6},[2]={-2719.1999511719, 1205, 53.599998474121},[3]={-2753.3000488281, 570.70001220703, 13.300000190735},[4]={1038.74, -1712.84, 13.4254},[5]={1037.64, -1558.29, 13.3862}, [6]={1061.46, -1443.02, 13.4006},[7]={1051.46, -1396.45, 13.4565},[8]={825.122, -1395.14, 13.3444},[9]={648.371, -1395.33, 13.3444},[10]={635.96, -1252.67, 17.1576}, [11]={554.18, -1122.47, 27.2105},[12]={238.52, -1170.34, 19.5841},[13]={-43.18, -1354.07, 11.2299},[14]={-284.8, -1642.00, 15.5116},[15]={-354.4, -1831.65, 22.2320}, [16]={-348.6, -2125.50, 28.3879},[17]={-174.6, -2413.64, 35.6235},[18]={-36.62, -2711.40, 42.0042},[19]={-315.0, -2800.08, 57.5757},[20]={-757.3, -2764.34, 74.7090}, [21]={-1141, -2850.020, 67.7570},[22]={-1569, -2742.080, 48.5795},[23]={-1966, -2547.510, 38.2349},[24]={-2191, -2370.410, 30.5065},[25]={-2212, -2264.740, 30.5055}, [26]={-2102, -2078.130, 63.1302},[27]={-1820, -1726.650, 29.1070},[28]={-1400, -1648.350, 45.1570},[29]={-1144, -1899.890, 77.5020},[30]={-802.3, -1785.11, 92.2070}, [31]={-758.6, -1454.05, 87.8020},[32]={-652.7, -1420.18, 90.4095},[33]={-572.8, -1070.35, 23.5500},[34]={-372.0, -823.054, 28.4015},[35]={-189.6, -938.291, 35.3530}, [36]={-55.70, -858.507, 13.7823},[37]={-113.0, -402.609, 1.10380},[38]={-221.9, 187.8397, 8.88888},[39]={-63.88, 551.1700, 9.22222},[40]={323.85, 753.2600, 6.15222}, [41]={740.54, 657.1210, 10.7505},[42]={1099.8, 803.8835, 10.7070},[43]={1556.6, 831.4191, 6.80807},[44]={1785.1, 798.4346, 11.2008},[45]={1605.7, 116.6938, 37.2020}, [46]={1701.3, -644.311, 41.8010},[47]={1635.6, -884.206, 52.5121},[48]={1798.2, -1037.61, 39.4545},[49]={2223.8, -1137.70, 25.6588},[50]={2269.0, -1209.68, 23.9119}, [51]={2196.8, -1382.42, 23.8575},[52]={2110.5, -1427.29, 23.8566},[53]={2002.0, -1459.51, 13.4255},[54]={1842.8, -1508.62, 13.3936},[55]={1819.2, -1865.68, 13.4469}, [56]={1779.7, -1917.97, 13.4165},[57]={1811.2, -1890.22, 13.4372},[58]={1798.6, -1830.07, 13.4257},[59]={1680.3, -1859.67, 13.4131},[60]={1468.2, -1869.85, 13.4074}, } createBlip(-2063.5, 1371.0999755859, 7.0999999046326, 52, 2, 0, 0, 0, 255, 0, 50000) function getNewBusLocation(thePlayer, ID) local x, y, z = busTable[ID][1], busTable[ID][2], busTable[ID][3] triggerClientEvent(thePlayer,"bus_set_location",thePlayer,x,y,z) end function busJob(thePlayer) local theVehicle = getPedOccupiedVehicle (thePlayer) local id = getElementModel(theVehicle) if id == 431 or id == 437 then local x, y, z = getNewBusLocation(thePlayer, 1) setElementData(thePlayer,"buszp",0) setElementData(thePlayer,"busData",1) else end end addEventHandler("onVehicleEnter",rootElement,busJob) function busStart(thePlayer) local theVehicle = getPedOccupiedVehicle (thePlayer) local id = getElementModel(theVehicle) if id == 431 or id == 437 then outputChatBox("You start bus job!", thePlayer, 255, 255, 0) end end addEventHandler("onVehicleEnter",rootElement,busStart) addEvent("bus_finish",true) addEventHandler("bus_finish",rootElement, function (client) if not isPedInVehicle(client) then return end if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end local zarp = getElementData(client, "buszp") local money = math.random(10,20) setElementData(client, "buszp", zarp + money) if #busTable == tonumber(getElementData(client,"busData")) then setElementData(client,"busData",1) else setElementData(client,"busData",tonumber(getElementData(client,"busData"))+1) end getNewBusLocation(client, tonumber(getElementData(client,"busData"))) end) function giveMoney(thePlayer) local theVehicle = getPedOccupiedVehicle (thePlayer) local id = getElementModel(theVehicle) if id == 431 or 437 then local gpm = getElementData(thePlayer, "buszp") if ((gpm) > 0 ) then givePlayerMoney(thePlayer, tonumber(gpm)) outputChatBox("You've earned " .. gpm .. "$", thePlayer, 0, 140, 240) setElementData(thePlayer, "buszp", 0) end end end addEventHandler("onVehicleExit", rootElement, giveMoney) addEventHandler("onPlayerQuit", rootElement, giveMoney) Map(buss spawn) "editor_main"> "vehicle (Bus) (1)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2088.8999023438" posY="1379.0999755859" posZ="7.1999998092651" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (2)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2088.6999511719" posY="1385" posZ="7.1999998092651" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (3)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2088.8000488281" posY="1396.9000244141" posZ="7.1999998092651" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (4)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2088.8999023438" posY="1409" posZ="7.4000000953674" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (5)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2088.8999023438" posY="1415" posZ="7.4000000953674" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (6)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2089" posY="1391" posZ="7.1999998092651" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (7)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2088.6999511719" posY="1403" posZ="7.1999998092651" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (8)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2088.8999023438" posY="1421" posZ="7.4000000953674" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (9)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2089" posY="1426.9000244141" posZ="7.4000000953674" rotX="0" rotY="0" rotZ="270"> "vehicle (Bus) (10)" paintjob="3" interior="0" alpha="255" model="431" plate="BELGIUMRL" dimension="0" color="78,104,129,30,46,50,0,0,0,0,0,0" posX="-2089.1000976563" posY="1432.9000244141" posZ="7.4000000953674" rotX="0" rotY="0" rotZ="270"> Already thanks for helping, Billy M. Link to comment
ViRuZGamiing Posted December 29, 2012 Author Share Posted December 29, 2012 In the server sided the Marker (busstops) only the 1,2 and 3 are edit right, the rest are still in Los Santos. 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