Scripting/Squirrel/Functions/NewTimer: Difference between revisions

From Vice City Multiplayer
Jump to navigation Jump to search
Caution icon
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "== Syntax == <pre>NewTimer( "ClientMessageToAll", 1000, 1, "TEST NEW TIMER",28, 255, 11 );</pre> function onPlayerCommand( player, cmd, text ); if ( cmd == "count" ) { Me...")
 
mNo edit summary
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Syntax ==
== Syntax ==


<pre>NewTimer( "ClientMessageToAll", 1000, 1, "TEST NEW TIMER",28, 255, 11 );</pre>
<pre>NewTimer( func, time, repeat, ... );</pre>


function onPlayerCommand( player, cmd, text );
== Arguments ==
if ( cmd == "count" )
 
* ''string'' '''func''' - the function to call when the timer ends (in a string format)
* ''int'' '''time''' - the time before the function call
* ''int'' '''repeat''' - how many times to repeat the process (1 just to execute once), 0 to execute forever
* '''...''' - function (func) parameters
 
== Example ==
 
<source lang="squirrel">
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "count" )
{
{
Message( "[#ffffff]<<<Odliczanie>>>>" );
Message( "[#ffffff]<<<Odliczanie>>>>" );
NewTimer( "ClientMessageToAll", 1000, 1, "-> 3",28, 255, 11 );
NewTimer( "ClientMessageToAll", 1000, 1, "-> 3",28, 255, 11 );
NewTimer( "ClientMessageToAll", 2000, 1, "-> 2",24, 255, 241 );
NewTimer( "ClientMessageToAll", 2000, 1, "-> 2",24, 255, 241 );
NewTimer( "ClientMessageToAll", 3000, 1, "-> 1",249, 57, 56 );
NewTimer( "ClientMessageToAll", 3000, 1, "-> 1",249, 57, 56 );
NewTimer( "ClientMessageToAll", 4000, 1, "-----> START <------",1000, 1500, 300 );
NewTimer( "ClientMessageToAll", 4000, 1, "-----> START <------",1000, 1500, 300 );
}
}
}
</source>


=== Notes ===


</source>
Call [[onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
 
== Related Functions ==
 
{{Scripting/Squirrel/Functions/Timer Functions}}
[[Category:Scripting/Squirrel/Functions/Timer_Functions]]

Latest revision as of 20:14, 18 February 2018

Syntax

NewTimer( func, time, repeat, ... );

Arguments

  • string func - the function to call when the timer ends (in a string format)
  • int time - the time before the function call
  • int repeat - how many times to repeat the process (1 just to execute once), 0 to execute forever
  • ... - function (func) parameters

Example

function onPlayerCommand( player, cmd, text )
{
	if ( cmd == "count" )
	{
		Message( "[#ffffff]<<<Odliczanie>>>>" );
		NewTimer( "ClientMessageToAll", 1000, 1, "-> 3",28, 255, 11 );
		NewTimer( "ClientMessageToAll", 2000, 1, "-> 2",24, 255, 241 );
		NewTimer( "ClientMessageToAll", 3000, 1, "-> 1",249, 57, 56 );
		NewTimer( "ClientMessageToAll", 4000, 1, "-----> START <------",1000, 1500, 300 );
	}
}

Notes

Call onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions