[Include] LTimers (Making Timers Easy!)
#1

This Is my first Include and is still in development so please go easy on me xD

IM AWARE ITS NOT THE BEST OF THINGS AT THIS CURRENT MOMENT AS STATED ABOVE ^^^ ITS STILL IN DEVELOPMENT SO PLEASE DONT REMIND ME THAT THE FACT ITS NOT MUCH!


now what im trying to create is an include that ofc makes timers better one thing im currently working on is making a function that allows one timer for multiple functions therefor reducing the amount of timers used in your script also reducing usage of resources.
now i havnt worked it out yet and i know im not the best of scripters but im trying none the least.
with this include currently its not the best but i have had a few people say its useful already now that i had explained what im trying to make

LScripting Productions Presents LTimers
Version [0.1]



Well Its Here [FINALLY] An include that can benefit scripters of all levels, shapes and sizes!
LTimers is a very simple yet effective way to SetTimers without the hassle of working out milliseconds or goggling
Код:
"how many milliseconds is 1 second"
How Does It Work?

Simple rather than use your usual
Код:
SetTimer("iwantonesecond", 1000, true);
Your using a simpler method for example
Код:
SetLTimer("iwantonesecond", LTimer1s, true);
See the easiness yet? if not take note of the
Код:
LTimer1s
1s = 1 second now im pretty sure i would rather remember 1s, 1m, 1h rather than 1000, 60000, 3600000 any day!

How To Install?

First You need to do the Obvious And download .::Link--> LTimers.inc <--link::.
And Place It In You /pawno/include Folder
Then
At the top of your script make sure you have
Код:
#include <a_samp>
#include <LTimers>
And Use As You Would A normal timer But using SetLTimer rather than SetTimer
And instead of milliseconds Use LTimer[number][timeformat][repeat]
Again for example
Код:
SetLTimer("iwantonesecond", LTimer1s, true); //true being repeat false being the opposite
What Times are Currently Compatible?
Код:
.::Legend::.
s = seconds
m = minutes
h = hours
Код:
LTimer1s 
LTimer2s
LTimer3s
LTimer4s
LTimer5s
LTimer10s
LTimer15s
LTimer20s
LTimer30s
LTimer1m
LTimer2m
LTimer3m
LTimer4m
LTimer5m
LTimer10m
LTimer15m
LTimer20m
LTimer30m
LTimer1h
LTimer2h
LTimer3h
LTimer4h
LTimer5h
LTimer10h
LTimer12h	
LTimer24h
.::Credits::.
Lookin (me) - Creating LTimers
Copyright © 2010 - 2011 LScripting Productions

Also

[L3th4l] aka [U]214 - helping me out with a problem and for being a legend
U-Clan.Com

.::Please Do Not Remove The Credits::.


Reply
#2

nice
i will use it... thanks!
Reply
#3

hmm Not bad...
Reply
#4

Thanks =D
and no problem ill be updating it very soon over the next couple of weeks as i have an idea to make it even simpler and also be updating more times also am going to try so you can use one timer for multiple functions

EDIT:
Thanks serman
Reply
#5

I find this barely any helpful. If you want a amount of seconds / minutes / hours which is not defined you would have to define it yourself, and then use milliseconds. You should have somehow done it that it gets multiplicated, like

Код:
Amount of Seconds * 1000
Reply
#6

well it may not be useful to you but it will be useful to a lot of people a common rule in scripter or programing is not all scripts/programs are for everyone and not everyone is able to work out milliseconds to seconds, minutes, hours, days etc
Reply
#7

This is not useful at all! It's better to ****** "ms to min" and convert the milliseconds to seconds...
Reply
#8

wow erm love you 2? me personally think it is useful and im sure other people will think so 2
BUT i thank you for your input even though it may not be as nice as i would have liked it to be it still helps me out in terms on how i can make it better

EDIT:

it still is in early stages as stated on the top and i do plan on working it so its shorter for example SLT("timer", 1S, true); and working something out so that one timer can be used on more than one function at a time
Reply
#9

rave
Reply
#10

Quote:
Originally Posted by Jon_De
Посмотреть сообщение
rave
erm ok?
Reply
#11

You're from Aotearoa, you should be scripting better things than this. I could've been the first to comment but decided not to. Have nothing else to say as the previous posters have said it already lol
Reply
#12

This is pretty useless... and why the devil did you rename SetTimer/KillTimer when you did not change the function? This is pointless.
Reply
#13

Code:
#define LTimer1s                                (1000)
#define LTimer2s                                (2000)
#define LTimer3s                                (3000)
#define LTimer4s                                (4000)
#define LTimer5s                                (5000)
#define LTimer10s`                              (10000)
#define LTimer15s								(15000)
#define LTimer20s                               (20000)
#define LTimer30s                               (30000)
#define LTimer1m								(60000)
#define LTimer2m								(120000)
#define LTimer3m								(180000)
#define LTimer4m								(240000)
#define LTimer5m								(300000)
#define LTimer10m								(600000)
#define LTimer15m								(900000)
#define LTimer20m								(1200000)
#define LTimer30m								(1800000)
#define LTimer1h								(3600000)
#define LTimer2h								(7200000)
#define LTimer3h								(10800000)
#define LTimer4h								(14400000)
#define LTimer5h								(18000000)
#define LTimer10h								(36000000)
#define LTimer12h								(43200000)
#define LTimer24h								(86400000)
Why so hard?
Code:
#define sTOms(%0) (%0*1000) 
// seconds
#define mTOms(%0) (%0*60000) 
// minutes
#define hTOms(%0) (%0*3600000) 
// hours
#define dTOms(%0) (%0*24*3600000) 
// days
Use:
Code:
SetTimer("Function", sTOms(5), false); // 5 seconds
AND THE BEST PART IS:
Google for:
1 minute = ? milliseconds
1 day = ? miliseconds
Reply
#14

When were timers hard?
Reply
#15

I'm also interested to know why you renamed "SetTimer" to "SetLTimer" when I can see no difference in the functions. Also, something along the lines of conversion functions would have been much more helpful, with your code people are restricted to the random times you choose. What if they want a 6 or 7 second timer, or a half second timer?

Code:
#define MILLISECOND
#define MILLISECONDS
#define SECOND *1000
#define SECONDS SECOND
#define MINUTE *60000
#define MINUTES MINUTE
#define HOUR *3600000
#define HOURS HOUR


SetTimer("bla", 6 HOURS + 1 MINUTE + 5 SECONDS + 27 MILLISECONDS, false);
Reply
#16

Look guys im aware it looks stupid right now but as stated on the thread its still in development at the moment i feel like a parrot





Quote:
Originally Posted by Y_Less
View Post
I'm also interested to know why you renamed "SetTimer" to "SetLTimer" when I can see no difference in the functions. Also, something along the lines of conversion functions would have been much more helpful, with your code people are restricted to the random times you choose. What if they want a 6 or 7 second timer, or a half second timer?

Code:
#define MILLISECOND
#define MILLISECONDS
#define SECOND *1000
#define SECONDS SECOND
#define MINUTE *60000
#define MINUTES MINUTE
#define HOUR *3600000
#define HOURS HOUR


SetTimer("bla", 6 HOURS + 1 MINUTE + 5 SECONDS + 27 MILLISECONDS, false);
Ok ^this i like doesn't scream at me about it its a proper discussion
aight well ofc im going to mention the developing stage but im going to explain what im trying to do

now what im trying to create is an include that ofc makes timers better one thing im currently working on is making a function that allows one timer for multiple functions therefor reducing the amount of timers used in your script also reducing usage of resources.
now i havnt worked it out yet and i know im not the best of scripters but im trying none the least.
with this include currently its not the best but i have had a few people say its useful already now that i had explained what im trying to make

as for the time restrictions yes atm there restricted but i am working on fixing that and adding as much times i can.

hate me love me its fine but at the end of the day im trying and i know this will soon become a great script but until then may ya'll please stop imitating parrots and repeating what everyone else has said ill only answer to comments like y_Less's one as its formal not useless or unneeded posting

also if you wish to give me a hand (which will most likly b a no from all of ya) then by all meas pm me please
Reply
#17

lol!
Reply
#18

Lol I like your sig
"Thats Right Lookins back and badder than ever before watch out samp im coming through"

The irony is so much win.

.. And good luck making timers better.
Reply
#19

I can make it with one code!

Code:
#define SetFixedTimer(%0,%1,%2) SetTimer(%0,%1 * 1000,%2)
^ You just need to multiply the seconds by 1000 to get the exact milliseconds you want.

I might as well call this useless since google can provide more clear and exact answers to conversions from seconds to milliseconds.

I only came here and thought "ahh! Maybe this can be a efficient timer creating method
Reply
#20

This include made it even harder I think :P - I won't explain anything because it's happened enough already.
Code:
#define seconds(%0) (1000 * %0)
#define minutes(%0) (1000 * 60 * %0)
#define hours(%0) (1000 * 60 * 60 * %0)

SetTimer("AnyFunction", 500, false); //Half second
SetTimer("AnyFunction", seconds(5), false); //5 seconds
SetTimer("AnyFunction", minutes(5), false); //5 minutes
SetTimer("AnyFunction", hours(1), false); //1 hour
By the way, I prefer Y_Less' one.

Code:
SetTimer("AnyFunction", 500 MILLISECONDS, false); //Half second
SetTimer("AnyFunction", 5 SECONDS), false); //5 seconds
SetTimer("AnyFunction", 5 MINUTES, false); //5 minutes
SetTimer("AnyFunction", 1 HOUR, false); //1 hour
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)