Question about lag
#1

Hello, I need advices.
My script is huge and when many players gather in one place the server starts lagging - I mean the things start to slow down, the commands and messages are delaying for few seconds and also sometimes the players are bugged, because of the lag and they need to relog. Мy script is bursting with a lot of things and I need tips on how to lighten to no lag.

I'm also using a lot ot permanent timers in OnGameModeInit. I'm using foreach in stead of for(new i = 0; i < MAX_PLAYERS; i++)
I tried to split the script into several includes, but did not help.

If you have a good advices for making a huge script without a lag, please tell me.
Sorry for my bad English.
Reply
#2

it may be your host problem.
Reply
#3

use static, strins, defines, eos...
reduce the number of cells.
Use variables for messages only once.
Streamer updated.
host good.
Reply
#4

Quote:
Originally Posted by JonathanFeitosa
Посмотреть сообщение
use static, strins, defines, eos...
reduce the number of cells.
Use variables for messages only once.
Streamer updated.
host good.
Can you explain me about eos?

Use variables for messages only once. - I can't understand that.
Reply
#5

Yes:
pawn Код:
// Topo
new string[30]; //  increase
new Nome[24];

public OnPlayerConnect(playerid)
{
     GetPlayerName(playerid,  Nome, sizeof(Nome));
     format(string, sizeof(string), "Nome: %s");
     SendClientMessage(playerid, -1, string);
     return 0x01;
}
public OnPlayerSpawn(playerid)
{
     GetPlayerName(playerid,  Nome, sizeof(Nome));
     format(string, sizeof(string), "Nome: %s", Nome);
     SendClientMessage(playerid, -1, string);
     return 0x01;
}
no:
pawn Код:
public OnPlayerConnect(playerid)
{
     new string[30];
     new Nome[24];
     GetPlayerName(playerid,  Nome, sizeof(Nome));
     format(string, sizeof(sintrg), "Nome: %s");
     SendClientMessage(playerid, -1, string);
     return 0x01;
}
public OnPlayerSpawn(playerid)
{
     new string[30];
     new Nome[24];
     GetPlayerName(playerid,  Nome, sizeof(Nome));
     format(string, sizeof(string), "Nome: %s", Nome);
     SendClientMessage(playerid, -1, string);
     return 0x01;
}
Reply
#6

Alright, I get it!

I thought of another idea - A lot of my arrays contains MAX_PLAYERS, if I re-define MAX_PLAYERS with 500 slots would that help for the lag?
Reply
#7

You probably bought a $10 a month server or something I would think or have some really shitty coding or a combination of both.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)