Lag prevention
#1

What are some ways you know of to prevent a laggy script?



I'm making a stunt server and want it to be as clean as possible in terms of lag.
Reply
#2

Overused string size, Godfather edits, many timers or anything else that could be taking some server resources...
Reply
#3

Take a good look at the post ****** made about code optimizations. It has everything you need to know (and then some) about having a very efficient script.
Reply
#4

Quote:
Originally Posted by Baked-Banana
Take a good look at the post ****** made about code optimizations. It has everything you need to know (and then some) about having a very efficient script.
Oh ok, I will take a look at that.


Quote:
Originally Posted by Al Fathead
Overused string size, Godfather edits, many timers or anything else that could be taking some server resources...
Can you explain to me about overused string size? Like give me an example.
Reply
#5

like: new String[256]; when max string in Sa-mp is 128. It's unnecessary storage.
And sometimes like when you want to store the players name in a string you just need 24 as 24 is the maximum of SA-MP players name(new pName[24].
Reply
#6

Quote:
Originally Posted by Al Fathead
like: new String[256]; when max string in Sa-mp is 128. It's unnecessary storage.
And sometimes like when you want to store the players name in a string you just need 24 as 24 is the maximum of SA-MP players name(new pName[24].
44 = name 256 = whole chat line
Reply
#7

for name; just use MAX_PLAYER_NAME.
Edit: also if you use a loop trough all players always check for connected players; otherwise it will do more then it's not needed.
Reply
#8

Quote:
Originally Posted by IamNotKoolllll
Quote:
Originally Posted by Al Fathead
like: new String[256]; when max string in Sa-mp is 128. It's unnecessary storage.
And sometimes like when you want to store the players name in a string you just need 24 as 24 is the maximum of SA-MP players name(new pName[24].
44 = name 256 = whole chat line
No.
Reply
#9

Quote:
Originally Posted by Al Fathead
when max string in Sa-mp is 128
Actually, no. For example a dialog/textdraw string can be much larger than 128.
Reply
#10

For my Anti jet pack ban, I have

Код:
new pname[30];
new string[250];
Is that bad? what should it be changed too, and how do you know how you should set the string?


Thanks guys for the great answers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)