#Bad performance?
1 messages · Page 1 of 1 (latest)
what the-
- Line 8: This is a global variable that is being affected by all players. It does not seem to be used. Delete this line and variable.
- Line 9: Setting a variable to false means the variable is still set, so it takes up storage space. instead of having
true/false; usetrue/not set - Lines 12-13: are useless, that code is already run in the
on join:event
- again, the
cosm_engineSoundvariable is taking up storage space. You can just checki if(the variable) is not setand then play the default sound
- line 16: please please please use
any boat - line 20: delete the variable to save storage space. Or just use a metadata tag
- do not loop all players so often. that is very inefficient. You can just use a while loop under your
on vehicle enter:event.
- all the variables in here should most definitely be local.
- also, line 38 does not use
{_speed}, but all the others do. You'll also have to define this local variable somewhere
A while loop is probably less efficient than periodical if the periodical is used correctly.
the massive IF-chain is probably the main performance issue
the while loop would only
- a) be active while the player is in the boat
- b) only run for the players it needs to
yeah you should use else ifs or continues