Jump to content

help!


Recommended Posts

Posted

Hello guys, I have a problem on my script, it's job, when the blip AttachedTo, it stay only few seconds, then it destoryed, I don't know why, help please?

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, 41, 2, 255, 255, 255, 255, 0, 65535, localPlayer )
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 busses = {[431] = true, [437] = true}

local busTable = {
[1]={1812.65198, -1889.86047, 13.41406},
[2]={1825.22791, -1635.03711, 13.38281},
[3]={1855.01685, -1430.47449, 13.39063},
[4]={1732.81580, -1296.87122, 13.44294},
[5]={1473.19226, -1295.77124, 13.48315},
[6]={1443.60376, -1498.26660, 13.37650},
[7]={1426.37280, -1716.12439, 13.38281},
[8]={1315.06909, -1656.43799, 13.38281},
[9]={1359.06250, -1432.39734, 13.38281},
[10]={1169.82983, -1392.34473, 13.41728},
[11]={930.76508, -1392.92627, 13.26561},
[12]={815.24756, -1317.91345, 13.44460},
[13]={585.04199, -1320.53748, 13.40609},
[14]={526.99365, -1624.20361, 16.63225},
}

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
local x, y, z = getNewBusLocation(thePlayer, 1)
setElementData(thePlayer,"busData",1)
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, 75)
outputChatBox("Successfully, you get $75, go get more!", source, 0, 255, 0, true)
setTimer(outputChatBox,5000,1,"It will never stop of job, when you're tired, just quit from vehicle.",source,0,255,0,true)
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)

 

76561198387870432.png

ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003

560x95_FFFFFF_FF9900_000000_000000.png

Posted (edited)
49 minutes ago, Dimos7 said:

the localPlayer not needed on blipattach aslo any error or warning from debugscript?

 

there is no errors on debugscript :/

Edited by TorNix~|nR

76561198387870432.png

ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003

560x95_FFFFFF_FF9900_000000_000000.png

Posted
2 hours ago, Dimos7 said:

what exacly happening when you driving after some meter the blip its dissapear?

yes, I do not know why

76561198387870432.png

ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003

560x95_FFFFFF_FF9900_000000_000000.png

Posted

you have other script with blips maybe its something bugged with that script or be better if you put the blip same with marker but not attach it just a idea

 

 

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...