Rat32 Posted August 1, 2015 Share Posted August 1, 2015 Hi. I want to set the timer setElementData , but debugscript think it is impossible. "Expected element at point 1 - got lua - timer" . It is very necessary to me , because without it I am not able to do the script. Dam code can invent something . Hi. function takegangzone(hitElement) tim = getPlayerTeam(hitElement) if getRadarAreaColor(getElementData(source, "area")) ~= getTeamColor(tim) then setRadarAreaFlashing(getElementData(source, "area"), true) tt = setTimer(function(source) local r,g,b = getTeamColor(getPlayerTeam(hitElement)) setRadarAreaColor(getElementData(source, "area"), r,g,b,150) setRadarAreaFlashing(getElementData(source, "area"), false) end, 5000, 1, source, tim) setElementData(tt, "przejmujacy", getPlayerName(hitElement)) end end addEventHandler("onColShapeHit", gz1col, takegangzone) Link to comment
iMr.Dawix~# Posted August 1, 2015 Share Posted August 1, 2015 try : function takegangzone(hitElement) tim = getPlayerTeam(hitElement) if getRadarAreaColor(getElementData(source, "area")) ~= getTeamColor(tim) then setRadarAreaFlashing(getElementData(source, "area"), true) tt = setTimer(function(source) local r,g,b = getTeamColor(getPlayerTeam(hitElement)) setRadarAreaColor(getElementData(source, "area"), r,g,b,150) setRadarAreaFlashing(getElementData(source, "area"), false) end,5000,1) setElementData(tt, "przejmujacy", getPlayerName(hitElement)) end end addEventHandler("onColShapeHit", gz1col, takegangzone) Link to comment
Rat32 Posted August 1, 2015 Author Share Posted August 1, 2015 First, read about it, then answer ; d . I have no problem with the timer . Doradźcie me just how to set a date for the timer ? Link to comment
iMr.Dawix~# Posted August 1, 2015 Share Posted August 1, 2015 First, read about it, then answer ; d . I have no problem with the timer . Doradźcie me just how to set a date for the timer ? Sorry you can't .. the timer is not element https://wiki.multitheftauto.com/wiki/Element but you can add it to a table Link to comment
GTX Posted August 2, 2015 Share Posted August 2, 2015 You can't set element data for timer. It's very necessary for you, but at least if you'd tell us why do you want to do that. Link to comment
Rat32 Posted August 3, 2015 Author Share Posted August 3, 2015 In order to KillTimer then he acted only on this one timer. If it is running 40 timers with variable tt and I want to keep only one timer is no problem arises : / . And so it would add "if" and getElementData (tt, " gangzone " zone) is stopowaloby only one timer which is equal to , for example, getElementData " gangzone1 " . How can I do this? If this array would ask for example in the code, because not too understand how to do it. I know how to do the kind of arrays in Lua , but I can not see how to replace the setElementData . Greetings. Link to comment
GTX Posted August 3, 2015 Share Posted August 3, 2015 I don't understand you. The point is, you can't setElementData to timer. Put it in table. It's same as element data. -- Example of what you can do. local timers = {} timer = setTimer(function() end, 500, 1) timers[timer] = true -- Add another timer timers[setTimer(function() end, 500, 1)] = true for i, v in pairs(timers) do if isTimer(i) and v == true then killTimer(i) end end Link to comment
Rat32 Posted August 7, 2015 Author Share Posted August 7, 2015 It's WORK! VERY THANKS! 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