IamWooky Posted April 29, 2015 Share Posted April 29, 2015 (edited) Need help .. iam new in scripting and iam using Bus driver role script... markers appear for all Bus drivers same .. and players are stealing from each other this markers and that sucks.. please help me to fix this.. Server: local rootElement = getRootElement() local Bus = createTeam("Bus Driver", 0, 255, 255) local busses = {[431] = true, [437] = true} local busTable = { [1]={-1998.1170654297, 382.66506958008, 35.015625}, [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)[/code] Client: [code=text]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 Edited August 22, 2016 by Guest Link to comment
xXMADEXx Posted April 30, 2015 Share Posted April 30, 2015 Please check your debugscript, and post any errors that are relevant to this script. /debugscript 3 Link to comment
IamWooky Posted April 30, 2015 Author Share Posted April 30, 2015 Don't see any errors Link to comment
IamWooky Posted August 22, 2016 Author Share Posted August 22, 2016 Nerevmind.. i made my own marker system.. with setElementVisibleTo.. and isElementVisibleTo.. 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