Some answers please?
#2

Having a timer running every .5 seconds is obviously going to reduce performance as appose to using other methods, especially if it's cluttered. What specific types of things are you doing in it?

Using a lot of variables is also something that should generally be avoided, use data enums and arrays (or utilize MySQL tricks so you don't store locally where able). Things such as g_God where it's either a 0 or 1 value could also be used as a boolean, which has two values: true and false. Simply prefix your variable with bool: (bool: g_God) in the definition and use the true/false values instead of numerics. You could also use things such as the ternary operator instead of clogging your script with if statements. For example, this becomes:

pawn Код:
format(string, sizeof string, "%s: %s", PlayerData[playerid][pPlayerName], (PlayerData[playerid][pAvailable] == true) ? ("Available") : ("False"));
This isn't the best example, things such as format and other slow functions could be replaced with more efficient functions. There's a TON of different optimization tricks in ******'s old Code Optimizations thread.

Plenty of other things could also slow down the server, including an increasing amount of players, things such as client (and also server sided) ELM and similar modifications also share resources to sync data.
Reply


Messages In This Thread
Some answers please? - by Dragonic - 03.06.2017, 02:17
Re: Some answers please? - by Abagail - 03.06.2017, 02:37
Re: Some answers please? - by Dragonic - 03.06.2017, 02:43
Re: Some answers please? - by Abagail - 03.06.2017, 02:50
Re: Some answers please? - by Dragonic - 03.06.2017, 03:04
Re: Some answers please? - by Abagail - 03.06.2017, 03:30

Forum Jump:


Users browsing this thread: 1 Guest(s)