Jump to content

Ajuda com spawn de veiculos


Recommended Posts

local Veiculos = {494} -- IDs dos Veículos.
Tulio = {}

function CreateVehicle (source)
if getElementData (source, "Pegou", true) then outputChatBox ('#c1c1c1Aguarde #ffffff20 #ffffffsegundos para pegar novamente.',source,255,255,255,true) return end
if isElement(Tulio[source]) then destroyElement (Tulio[source]) 
Tulio[source] = nil
end
local x,y,z = getElementPosition (source)
local Cars = Veiculos[math.random(#Veiculos)]
Tulio[source] = createVehicle (Cars,x,y,z)
setElementData (source, "Pegou",true)
setTimer (setElementData, 20000, 1, source, "Pegou", false)
end
addCommandHandler ("494", CreateVehicle)

function DestroyVeiculo ()
destroyElement (Tulio[source])
end
addEventHandler ("onPlayerLogout", root, DestroyVeiculo)
addEventHandler ("onPlayerQuit", root, DestroyVeiculo)
addEventHandler ("onPlayerWasted", root, DestroyVeiculo)

Como eu faço com que esse script faça o veiculo do player sair do lado e não encima dele?

Link to comment
  • Other Languages Moderators

Vc pode simplesmente somar a posição X de onde o veículo vai nascer + 2.

local x, y, z = getElementPosition (source)
x = x+2
...
...

 

Edited by Lord Henry
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...