ok, it looks like we all need to do a little review on WHAT RUNS WHERE. I believe that this is covered in both Locoweeds tutorial and mine, but since nobody reads mine anymore
Quote:


Rule # 1. By default, entities created with ent_create have their actions or functions run on the Server.

Rule # 2. Everything else by default runs on the same computer as the function that called it is running on.

Rule # 3. There are ways of getting around rules 1 and 2.

...

Any function called from main() will run on both the client(s) and the server. Since main runs on both, all functions called from main also run on the client(s) and the server.






Ways around this?? Try the connection variable.


The connection variable is a predefined variable that is automatically set to 0 when A6 starts up. It changes to the following values depending on how the engine was started.

0 - The engine was not started in any multiplayer mode
1 - The engine was started with –sv (Server Session)
2 - The engine was started with – cl (Client Session)
3 - The engine was started with –sv –cl (Server/Client Session)

SO ....

Code:
  main() {
if (connection == 1) {
server_only_function(); // -sv only
}

if (connection == 2) {
client_only_function(); // -cl only
}

if (connection == 3) {
server_client_function(); // -sv AND -cl
}
}
Or even cooler still:

if (connection & 1) {
any_client_function(); // (-cl) or (-sv AND -cl)
}





Giorgi3

10,000 parts flying in a close formation does not constitute an airplane. Some assembly is required.