Updating every second?
#1

How to make it update every second?

PHP код:
public Data(name[], value[])
{
    new 
INI:File INI_Open(SERVER_FILE);
    
INI_SetTag(File"server");
    
INI_WriteInt(File,"Account Ids",ServerInfo[Accountid]);
    
INI_WriteInt(File,"Announce",ServerInfo[Announce]);
    
INI_WriteInt(File,"Auto_Login",ServerInfo[AutoLog]);
    
INI_WriteInt(File,"Locked",ServerInfo[sLocked]);
    
INI_WriteInt(File,"Read_PersonalMessages",ServerInfo[ReadPms]);
    
INI_WriteInt(File,"Max_Ping",ServerInfo[MaxPing]);
    
INI_WriteInt(File,"Read_Commands",ServerInfo[ReadCmds]);
    
INI_WriteInt(File,"Chat",ServerInfo[Chat]);
    
INI_WriteInt(File,"Hours",ServerInfo[H]);
    
INI_WriteInt(File,"Minuites",ServerInfo[M]);
    
INI_WriteInt(File,"Seconds",ServerInfo[S]);
    
INI_Close(File);

Reply
#2

make a timer on Onplayerupdate
Reply
#3

First of all, that's a very bad idea. Opening and writing to a file every second, it's just unnecessary. If someone wants to know how long the server has been up, refer to your variables "ServerInfo[H], [M] and [S]". The only time you should update anything in a file is probably when a value is actually changed. Anything that needs to be updated every second should be avoided if possible.

What are you trying to update per second?
Reply
#4

Quote:
Originally Posted by Humza
Посмотреть сообщение
make a timer on Onplayerupdate
LOL! NO!

Make a global timer outside OnPlayerUpdate and update those things there

Edit: Read Threshold's advice.
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
First of all, that's a very bad idea. Opening and writing to a file every second, it's just unnecessary. If someone wants to know how long the server has been up, refer to your variables "ServerInfo[H], [M] and [S]". The only time you should update anything in a file is probably when a value is actually changed. Anything that needs to be updated every second should be avoided if possible.

What are you trying to update per second?
I used it for account ids because if server crashed so the account ids will not be saved because i put the account id updating under "OnGameModeExit" and it will effect the whole database
Reply
#6

You should save it whenever the account IDs are actually changed. So lets say someone registers, you add 1 to the account IDs. Save the account IDs then, not in a timer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)