SetTimer
Jump to navigation
Jump to search
Temporary Timer Explanation
[17:33] <Ransom> yes.. explain how ur damn settimers can work [17:33] <Talidan> ransom wants to destroy a vehicle after a certain time of inactivity [17:33] <ChrML_Laptop> setTimer ( "function", time in ms, arg1, arg2, argn... ) [17:34] <ChrML_Laptop> first argument is the name of the function to run in the given number of milliseconds [17:34] <slush> heh [17:34] <Ransom> okay.. so it makes a function or it can be used as... a command [17:34] <slush> i wonder how it would be to play gta with my xbox 360 control [17:34] <slush> since it does work with windows and all [17:34] <Talidan> it doesnt make any functions [17:35] <Talidan> it launches a function [17:35] <ChrML_Laptop> what's in the quote is simply the name of the function [17:35] <ChrML_Laptop> then there's a time argument [17:35] <ChrML_Laptop> then there are N arguments that you'd normally put in the () [17:35] <ChrML_Laptop> setTimer ( "serverChat", 5000, "hi girls" ) [17:35] <Talidan> chrml he understands that, its something else he isnt getting and i dont get what he means [17:36] <Ransom> onExitVehicle ( player, vehicle, int seat, jackingplayer ) [17:36] <Ransom> destroyvehicle = 1 [17:36] <Ransom> SetTimer ( check, 10000 ) [17:36] <Ransom> end [17:36] <Ransom> then [17:36] <Ransom> function check () [17:36] <Ransom> if destroyvehicle = 1 [17:36] <Ransom> SetTimer ( setVehicleHealth, 10000, vehicle, 0 ) [17:36] <Ransom> end [17:36] <Talidan> 'then' isnt part of the code [17:36] <Ransom> he just created a function through a timer... then said onthatfunction, then used another timer inside it as a countdown [17:36] <Talidan> and its all == [17:36] <ChrML_Laptop> that code looks syntax error [17:36] <ChrML_Laptop> function onExitVehicle ( blablabl ) [17:37] <Talidan> i c/p chrml [17:37] <Talidan> trying to work out the logic though chrml [17:37] <ChrML_Laptop> always == for comparison [17:37] <Talidan> how would you destroy a vehicle after inactivity [17:37] <ChrML_Laptop> if ( test = 5 ) then [17:37] <Ransom> so you can set timers to check made up function names right... [17:37] <ChrML_Laptop> will assign 5 to test, then check if it's >0 [17:37] <Ransom> thats what you are saying [17:37] <ChrML_Laptop> atleast it will in C+ [17:37] <ChrML_Laptop> ++ [17:37] <Talidan> yeah ransom [17:37] <Talidan> functions you make up dont go in "" [17:37] <Talidan> functions that are on the wiki do go in "" [17:37] <Ransom> okay but yet they can also be used to perform functions at given countdowns [17:37] <Ransom> ? [17:37] <Talidan> wait no [17:37] <Talidan> iim wrong [17:38] <Talidan> they all go in "" [17:38] <ChrML_Laptop> yes [17:38] <Ransom> and all those arg1, arg2 just depend on if you put a bigass function in there with lots arguments? [17:38] <Talidan> yeah [17:38] <Talidan> well ask chrml to write up the code anyway ransom [17:38] <Talidan> he'd have better logic [17:39] <Ransom> well ill just paste this in the wiki for temporary reference :P