01.09.2018, 19:21
serverHang Hangs/pauses your server for what ever reason you would want it to.
param 1 = seconds
param 2 = bool
How it can be used:
Code:
Usage:
Output:
param 1 = seconds
param 2 = bool
How it can be used:
Код:
If a server would like to release at a specific time, then they can convert seconds
to mins by adding *3600 at the end their number (multiply by an hour). This will be good
if a server is having a opening beta release and they want their server to open/start at that
exact time, will the server is already running but not fully loaded. Place the function on
public OnGamemodeInit()
For example:
public OnGameModeInit()
{
printf("Starting hang...");
hang(1*3600, false); // hang the server for 3600 seconds = 1 hour
}
Output:
log.txt
Starting hang...
/* 3600 seconds later */
----------------------------------
Bare Script
----------------------------------
Number of vehicle models: 0
Код:
hang(count, bool:hangDebug)
{
new hangTick[2];
hangTick[0] = GetTickCount();
new hangTime = 0;
for(;;)
{
new hangStamp = tickcount();
while(tickcount() - hangStamp < 1000) {}
if(hangTime > count) break;
hangTick[1] = GetTickCount();
hangTime++;
if(hangDebug) printf("hanged for %ims", hangTick[1]-hangTick[0]);
}
if(hangDebug) printf("hang stopped at %i seconds", hangTime);
}
Код:
hang(4, false);
Код:
hanged for 998ms hanged for 1999ms hanged for 2999ms hanged for 3999ms hang stopped at 4 seconds

