Amine#TN Posted February 19, 2017 Share Posted February 19, 2017 function carDestroy () if not (isGuestAccount (getPlayerAccount (source))) then if (isPedInVehicle (source)) then if (getElementID(getPedOccupiedVehicle(source)) == getAccountName (getPlayerAccount(source))) then setElementHealth (getElementData (source, "hisCar"), 0) destroyElement (getPedOccupiedVehicle (source)) removeElementData (source, "hisCar") outputChatBox ("Car Destroyed.", source, 255, 0, 0) else outputChatBox ("This not your car!", source, 255, 0, 0) end elseif (not (isPedInVehicle (source))) and (getElementData (source, "hisCar")) and (getElementData (source, "hisCar") ~= nil) then car=getElementData(source, "hisCar") destroyElement(car) outputChatBox ("Car Destroyed.", source, 255, 0, 0) removeElementData (source, "hisCar") end end end addEventHandler ("carDestroy", getRootElement(), carDestroy) ------------ last times no one gives help i hope that time one pro scripter give help i need when player use that fonction he will not use it again only after 10 min i try but i fail to add that timer Link to comment
Amine#TN Posted February 19, 2017 Author Share Posted February 19, 2017 (edited) Edited February 19, 2017 by Amine#TN Link to comment
Bananovy Posted February 19, 2017 Share Posted February 19, 2017 What about this? local timer = false function carDestroy () if timer == false then if not (isGuestAccount (getPlayerAccount (source))) then if (isPedInVehicle (source)) then if (getElementID(getPedOccupiedVehicle(source)) == getAccountName (getPlayerAccount(source))) then setElementHealth (getElementData (source, "hisCar"), 0) destroyElement (getPedOccupiedVehicle (source)) removeElementData (source, "hisCar") outputChatBox ("Car Destroyed.", source, 255, 0, 0) timer = true setTimer(function () timer = false --outputChatBox ("Event available again", source, 255, 0, 0) end, 600000, 1) else outputChatBox ("This not your car!", source, 255, 0, 0) end elseif (not (isPedInVehicle (source))) and (getElementData (source, "hisCar")) and (getElementData (source, "hisCar") ~= nil) then car=getElementData(source, "hisCar") destroyElement(car) outputChatBox ("Car Destroyed.", source, 255, 0, 0) removeElementData (source, "hisCar") timer = true setTimer(function () timer = false --outputChatBox ("Event available again", source, 255, 0, 0) end, 600000, 1) end end else -- outputChatBox ("10 minutes", source, 255, 0, 0) end end addEventHandler ("carDestroy", getRootElement(), carDestroy) Link to comment
Amine#TN Posted February 20, 2017 Author Share Posted February 20, 2017 thanx bro it is working Link to comment
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