View Single Post
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-02-2006 , 16:47  
Reply With Quote #3

Code:
for (new i = 1; i <= get_maxplayers(); i++)
Replace get_maxplayers() with a global variable like so:
Code:
new g_MaxPlayers; public plugin_init() {   g_MaxPlayers = get_maxplayers(); }
And then put that into the loop instead.

For more info go to: http://wiki.amxmodx.org/index.php/Optimizing_Plugins

Also, you might want to check if the user is connected:
Code:
if(!is_user_connected(i)) continue;
That will skip the current iteration in the loop. Alternatively you can use get_players, as it's more efficient.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline