
I've been contemplating recording my gameplay for the last couple of years and I've finally decided to go for it.

I'm waiting for your feedback, let me know if you like it and/or have any suggestions! I am planning to add custom animations, these default ones are good for now, and default world ladder positions in the future. Power of creating more interesting maps, possibility and an idea for a new "ladder parkour" gamemode, or just create more interesting roleplay / deathmatch / other scenarios by adding climbable ladders to the environment. Ladder is using collision tuboids for player detection.Ĭontains a "/getladderpos" utility command to get the corrected position and rotation in front of player, copies Vector3 and int rotation to clipboard. You can basically create any length ladder with correct positions, since you can adjust offsets for start and end positions, so shifting leadders in the ground is a possibility to match the height of a building. Features one custom object.Įasy to use functions, ~240 lines of code. Only vertical ladders are supported with Z rotation. Possibility to create functioning ladders, create a ladder without the custom object, for default world ladders, or create a brand new one. If you are having perf issues with your speedometer, make sure you don't call get/set ElementData inside the drawing function. If you had something like this, it is fine too and the perf are so close that the difference can be ignored (but technically it's better to add and remove the event handler like in your original post).

If getPedOccupiedVehicleSeat(player) = 0 or getPedOccupiedVehicleSeat(player) = 1 thenĪddEventHandler("onClientVehicleEnter", root, A1)ĪddEventHandler("onClientVehicleStartExit", root, A2) If player = localPlayer then return end - you forgot this btw or else other players will trigger it too If not isSpeedoVisible then return end - cancel immediatlyĪddEventHandler("onClientRender", root, drawSpeedometer) And you are right, technically it's better because "onClientRender" won't call your lua function for nothing (if the speedometer is hidden).
#Mtasa wiki code#
Also your code won't work, you forgot to flip the boolean inside show and hide code is fine.
#Mtasa wiki update#
You have to update the value of fx,fy,fz with the current x, y, z at the end to calculate the new distance traveled between point B and point C (20 secs later). Must be local and "link it" with your vehicle element: setElementData(source, "fuelTimer", timerF, false) (false because there is no need to sync this value with all connected clients, only the server needs to know and manipulate it). You can't use a global variable on the server side or else if another player enters another vehicle, it will start his vehicle fuel timer and override the value in timerF so you have no way to kill the timer of your vehicle later. (Why the +0.05 to each components ? seems totaly useless) If it's ON, do the newFuel calculation thing. You have to change it so that you create the fuel timer anyway when entering the vehicle at seat 0 but inside the timer function, the 1st thing you do is to check the engine state. Here in your code, this check is only done once, when entering the vehicle. OnVehicleEnter already gives you the seat number, you have to "grab" it too : It already exists thanks to the onVehicleEnter event. You don't need to overwrite the source variable. Local newFuel = tonumber((fuelVeh - (fuelConsumption*(distance+enginePlus))))ĪddEventHandler("onVehicleEnter", root, setFuelCar) Local distance = getDistanceBetweenPoints3D(x,y,z,fx,fy,fz) - (6) Local fuelVeh = getElementData(source, "Fuel") or 0

If getVehicleEngineState(source)=true then -if the engine it's on I start the timer - (3) If getPedOccupiedVehicleSeat(thePlayer)=0 then - (2) Local source = getPedOccupiedVehicle(thePlayer) - (1)
