Trust aka Tiffergan Posted May 31, 2020 Posted May 31, 2020 addEventHandler("repairVehicle", root, function(veh) if repairTimer[veh] then triggerClientEvent(source, "displayClientInfo", source, getVehicleName(veh).." is already in repair!", 255, 22, 0) return; end repairTimer[veh] = setTimer(fixDayZVehicle, (1000-(math.floor(getElementHealth(veh))))*120, 1, veh, source); setElementFrozen(veh, true); setElementFrozen(source, true); setPedWeaponSlot(source, 0); setElementData(veh, "repairer", source); setElementData(source, "repairingvehicle", veh); setElementData(source, "repairvehicle", true); setPedAnimation(source, "SCRATCHING", "sclng_r", nil, true, false); triggerClientEvent(source, "displayClientInfo", source, "Started to repair "..getVehicleName(veh), 22, 255, 0); end); This is a code that repairs your vehicle, works well, but I want to add something that I have the option of pressing a button, e.g. "k", and stop repairing the vehicle, but I don't know how I can do it: V R
Moderators IIYAMA Posted May 31, 2020 Moderators Posted May 31, 2020 (edited) 21 minutes ago, LOOah said: and stop repairing the vehicle, but I don't know how I can do it: V bindKey getPedOccupiedVehicle local timer = repairTimer[vehicle] isTimer killTimer repairTimer[vehicle] = nil Edited May 31, 2020 by IIYAMA Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Trust aka Tiffergan Posted May 31, 2020 Author Posted May 31, 2020 2 hours ago, IIYAMA said: bindKey getPedOccupiedVehicle local timer = repairTimer[vehicle] isTimer killTimer repairTimer[vehicle] = nil I not sure why i need getPedOccupiedVehicle look on video repairing car look like that : and i want just to have oportunity to stop it ( SORRY FOR ENGLISH :V ) and the thing i want to do is when i have this animation i want to have text on chat to stop repair press K and when im pressing K my ped is stoping repairing. https://streamable.com/a4eosn R
Moderators IIYAMA Posted May 31, 2020 Moderators Posted May 31, 2020 40 minutes ago, LOOah said: I not sure why i need getPedOccupiedVehicle look on video repairing car look like that : Then you probably need to replace that with: local vehicle = getElementData(player, "repairingvehicle"); Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now