First of all you have to know that 2 types of entities exit:
global entities:
+ created with enet_ent_create()
+ are automatically created on all clients and on the server
+ they have a global pointer, so they can be identified in the whole game everywhere
+ functions like enet_send_pos(),enet_send_skills()... only work with glob. ents
+ their function is started on all clients + server
local entities:
+ created with ent_create()
+ are only locally available (for client side effects etc.)
+ also the function is only started on the host that created the ent
+ enet_send_pos() etc. can't be used
You can split the function that is used in enet_ent_create() into several parts:
if(enet_ent_creator(enet_ent_globpointer(my)) == enet_get_clientid())
{//runs on the host that created an entity
}
if(enet_get_connection() == SERVER || enet_get_connection() == SERVER_CLIENT)
{//runs on the server and on the server+client
}
if(enet_get_connection() == CLIENT)
{//runs on the client only
}
If you want a normal function to run only server side, then do the following:
if(enet_get_connection() != SERVER)
{return();}
On my side (
www.anet-plugin.com) is a tutorial "Simple 3D Chat Tutorial" that should explain everything.
Are you using the latest Beta of ANet? If not you have to use 1 instead of SERVER and 2 instead of CLIENT and 3 instead of SERVER_CLIENT.