Jump to content

[help] canceling event dayz


Recommended Posts

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

Link to comment
  • Moderators
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 by IIYAMA
Link to comment
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

Link to comment
  • Moderators
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");

 

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...