MarkerBike = createMarker(1086.3326416016,-1802.1416015625,12.60143661499, "cylinder", 1.5, 255,255,255,50)
--local Veiculos = {510} -- IDs dos Veículos.
Rumpo = {}
AparecerBike = Rumpo[source]
function spawn (source)
if isElementWithinMarker(source, MarkerBike) then
if getPlayerMoney(source) >= 500 then
takePlayerMoney (source, 500)
if AparecerBike and isElement(AparecerBike) then
destroyElement(AparecerBike)
end
AparecerBike = createVehicle (510, 1091.2088623047,-1796.9704589844,13.606305122375)
setElementData(source, "kart.race", true)
setElementData(AparecerBike, "owner", source)
setElementRotation(AparecerBike,0,0,0)
fadeCamera ( source, false, 0, 0, 0, 0 )
setTimer ( fadeCamera, 500, 1, source , true, 0.5 )
setTimer ( setCameraTarget, 500, 1, source )
outputChatBox ("#FF0000✘ #ffffffINFO #FF0000✘➺ #FF0000Bicicleta Alugada com sucesso, faça bom uso!", source, 255, 255, 255, true)
warpPedIntoVehicle (source, AparecerBike)
else
outputChatBox("#FF0000✘ #ffffffINFO #FF0000✘➺ #FF0000Você não tem dinheiro suficiente para alugar uma bike!", player, 255,255,255,true)
end
end
end
addCommandHandler("alugar", spawn)
function SemRoubo (player, seat)
if getElementData(source, "kart.race") == true and seat == 0 then
local owner = getElementData(source, "owner")
if owner ~= player then
cancelEvent()
outputChatBox("Você não é dono desta bicicleta, alugue sua bike para poder usá-la.", player, 255, 0, 0)
end
end
end
addEventHandler("onVehicleStartEnter", root, SemRoubo)
function DestroyVeiculo ()
if getElementData(source, "kart.race") then
setElementData(source, "kart.race", false)
destroyElement (AparecerBike)
end
end
addEventHandler ("onPlayerLogout", root, DestroyVeiculo)
addEventHandler ("onPlayerQuit", root, DestroyVeiculo)
addEventHandler ("onPlayerWasted", root, DestroyVeiculo)
addEventHandler ("onPlayerBan", root, DestroyVeiculo)
addEventHandler ("onResourceStop", root, DestroyVeiculo)
local minutos = 1
-- New
function destroyVehicle(vehicle)
local check=false
for i,player in ipairs(getElementsByType("player")) do
if getPlayerOccupiedVehicle(player)==vehicle then
check=true
end
end
if check==false then
destroyElement(AparecerBike)
end
end
function exitVehicle(AparecerBike)
setTimer(destroyVehicle,60000*minutos,0,AparecerBike)
end
addEventHandler("onPlayerVehicleExit",getRootElement(),exitVehicle)
eu testei isso e funcionou
tenta ai ;d