Optimization
#1

Can anyone explain me optimization of script. What is best way to optimize script?? Sry if this is noobish but i am newbie
Reply
#2

Optimization includes tweaking and changing things to make them faster or take up less memory.
There's lots of small things you can optimize, the 4 i would encourage most are:

Decrease string sizes as much as possible, or atleast make sure when using SCM that they're not beyond 128.

Use includes like zcmd/ycmd (not dcmd) for faster commands, and foreach for faster player loops.

Redefine "MAX_PLAYERS" to the actual max player slots you have set on your server right after #include <a_samp>
An example of how to set it to 100 players:
Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 100
Don't save players when they disconnect, save them instantly when their things are changed that needs to be saved.
Otherwise the server hangs when players disconnect.
Reply
#3

WOW thank you for this Helped me a lot
Reply
#4

Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 100
Better this way:

Код:
#undef MAX_PLAYERS
const MAX_PLAYERS = 100;
Reply
#5

Why? (sry for asking but i dont want to copy paste i want to learn.) Why const? I don't get it..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)