https://wiki.multitheftauto.com/wiki/Debugging
example:
function onResourceStart ( name, root )
vehBar = getElementByID ( "vehbar" )
origX, origY, origZ = getElementPosition ( vehBar )
end
function closeVehicleBar ( playerSource, commandName )
outputDebugString("player "..getPlayerName(playerSource).." wants to close bar")
local preX, preY, preZ = getObjectRotation( vehBar )
outputDebugString("current bar rotation: "..tostring(preY))
if preY == 0.0 then
outputDebugString("moving bar:")
local rotY = 90.0
outputDebugString(tostring(moveObject ( vehBar, 4000, origX, origY, origZ, 0.0, rotY, 0.0 )))
end
end
function openVehicleBar ( playerSource, commandName )
outputDebugString("player "..getPlayerName(playerSource).." wants to open bar")
local preX, preY, preZ = getObjectRotation( vehBar )
outputDebugString("current bar rotation: "..tostring(preY))
if preY == 90.0 then
outputDebugString("moving bar:")
local rotY = -90.0
outputDebugString(tostring(moveObject ( vehBar, 4000, origX, origY, origZ, 0.0, rotY, 0.0 )))
end
end
addEventHandler ( "onResourceStart", getRootElement(), onResourceStart )
addCommandHandler ( "closebar", closeVehicleBar )
addCommandHandler ( "openbar", openVehicleBar )