13.02.2014, 16:35
There are lots of things you can do to optimize your script.
Use switch instead of if...else
And here
and lots of other places where you have RHS constants.
Use >> and << for division and multiplication of numbers by powers of 2.
number & (divisor - 1) for powers of 2 will give the remainder - this is faster!
Use static and avoid useless initializations of variables in functions.
Some places where you have used format can be done using strcat easily which is faster.
Use proper arrays with proper size.You are wasting so many cells.Why do you need to make a string 256 cells big when the max input/output limit of client message is 128?
Refer these links:
https://sampforum.blast.hk/showthread.php?tid=216730
https://sampforum.blast.hk/showthread.php?tid=57018
Use switch instead of if...else
Quote:
if(reason == 0) { raison = "Coup de Poing."; } else if(reason == 1) { raison = "Poing Amйricain"; } else if(reason == 2) { raison = "Club de Golf"; } else if(reason == 3) |
Quote:
if(hittype==BULLET_HIT_PETROL_TANK)// Quand on tire sur le reservoir d'essence { |
Use >> and << for division and multiplication of numbers by powers of 2.
number & (divisor - 1) for powers of 2 will give the remainder - this is faster!
Use static and avoid useless initializations of variables in functions.
Some places where you have used format can be done using strcat easily which is faster.
Use proper arrays with proper size.You are wasting so many cells.Why do you need to make a string 256 cells big when the max input/output limit of client message is 128?
Refer these links:
https://sampforum.blast.hk/showthread.php?tid=216730
https://sampforum.blast.hk/showthread.php?tid=57018