Jump to content

Bus Job [ HELP ]


Recommended Posts

CLIENT--

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, "cylinder", 3.5, 255, 255, 0, 170) 
blip = createBlipAttachedTo( marker, 0, 2, 255, 255, 0, 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--

local rootElement = getRootElement() 
local Bus = createTeam("Bus Driver", 0, 255, 255) 
local busses = {[431] = true, [437] = true} 
  
local busTable = { 
[1]={1812.65198, -1889.86047, 13.41406}, 
[2]={1825.22791, -1635.03711, 13.38281}, 
} 
  
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 onVehicleEnter(thePlayer) 
if not busses[getElementModel(source)] then return end 
if not getPlayerTeam(thePlayer) then return end 
if getTeamName(getPlayerTeam(thePlayer)) == "Bus Driver" then 
local x, y, z = getNewBusLocation(thePlayer, 1) 
setElementData(thePlayer,"busData",1) 
  end 
end 
addEventHandler("onVehicleEnter",rootElement,onVehicleEnter) 
  
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 
givePlayerMoney(client, 100) 
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) 

Need help with this, when Im done on marker 1 and on my way to marker 2 and I accidentally press ENTER and got out of the car. And when I get back to the bus, the locations is restarted and I have to go to 1st location again. Pls help me with this. Wanna save the last location to be delivered.

Link to comment

Zombies by slothman.

1) Is there a way to spawn zombies only in a Radar Area? But still the streaming is == 1.

2) If I set to streaming == 2, the zombies gets stucked on a spawnpoint. Since I dont want too many spawnpoints. They just spawn in 1point.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...