how to make a count from 1sec to 10sec with array
array <- [];
I <- 0;
while( array.len() < 10 )
{
array.push( I )
}
There might be some more better functions, that was just an example
That wont work, squirrel is on 1 thread
This is from LU and I'm to busy but rwwpl's code should help you from another script help
Quote from: rwwpl on Dec 21, 2015, 06:53 PMLOOOOL
Example:
Count <- array(GetMaxPlayers(),0);
function onServerStart()
{
NewTimer("CountDown",1000,0);
return 1;
}
function CountDown()
{
for (local i = 0; i <= GetMaxPlayers(); i++)
{
local p = FindPlayer(i);
if (p)
{
if (p.Vehicle) Count[p.ID] ++;
else Count[p.ID] --;
MessagePlayer("Count: "+Count[p.ID],p);
}
}
}
Do not thank me thank rwwpl
@rww
No i mean counting from 1 to 10 without using a timer
Why not timer? Do you have personal enmity with timer? Timer is most efficient friend for this task. Timer was made with the sole purpose to be able to call functions after a specified time.
Timers lag the script :P
Quote from: Finch Real on Jul 27, 2016, 11:20 AMTimers lag the script :P
ahh!! I think you should read the topic posted by
@Stormeus at Vice Underdogs forum.
http://viceunderdogs.com/index.php?topic=4452.0
Quote from: Finch Real on Jul 27, 2016, 11:20 AMTimers lag the script :P
No it doesn't. I had 700+ timers in a testing script, even players with 250+ ping didn't lag.
Read what
@Anik has posted, click on that link and read that topic.
The snippet from rwwpl is perfect with common sense it could be re scripted for whatever.
My suggestion, I only have one timer in my script typically and that timer is for a function that has many and I mean many player loop methods etc, or depending on what your doing with arrays etc, to an Announced
timed message telling you to re enter a car within 60 secs or mission failed, or whatever you want,.
Timers are not bad unless used poorly/shity. There is no other way to do this, If you do not want to do this I suggest skip whatever your working on as it will never work out and you will waste your time/life.
You could use the game clock but thats even more retarded.
Just use the simple method and get it over with. You do not need to have many timers just one and many array values and decrease increase that value with ++ etc then check the array value, I really do not feel like going into detail as this is pre explanatory..