hello! i am trying to make a cmd for the editor mode in race si that when you type /sw it saves your pos and then if yo type /lw it will warp you to the same pos and the same speed but it doesn't work please help me
function saveWarp (playerSource)
if(playerSource) then
vehicle = getPedOccupiedVehicle(playerSource)
local curposx, curposy, curposz = getElementPosition(vehicle)
local currotx, curroty, currotz = getElementRotation(vehicle)
local speedx, speedy, speedz = getElementVelocity(vehicle)
outputChatBox("The Warp has been saved!", playerSource)
end
end
addCommandHandler("sw", saveWarp)
function loadWarp (playerSource)
if(playerSource) then
vehicle = getPedOccupiedVehicle(playerSource)
setVehicleFrozen(vehicle, true)
setElementPosition(vehicle, curposx, curposy, curposz)
setElementRotation(vehicle, currotx, curroty, currotz)
setTimer(setFreeze, 3000, 1)
outputChatBox("The Warp has been loaded!", playerSource)
end
end
addCommandHandler("lw", loadWarp)
function setFreeze (playerSource)
if(playerSource) then
vehicle = getPedOccupiedVehicle(playerSource)
setVehicleFrozen(vehicle, false)
setElementVelocity(vehicle, speedx, speedy, speedz)
end
end