4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
ent_create on client, no function started
#129999
05/15/07 09:47
05/15/07 09:47
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
I thought this is a simple code, but I spent at least 4 hours of testing and nothing works. The problem is that I create an entity on the client with "ent_create". Now it will be created globally. That works fine. But the function were not started on the server... Code:
dedicated server is running.... client join.... function sv_player { file_cpy("testfile", "player.mdl"); //create a file on harddisk to see if the function were started } starter start_game { if(connection == 2) { level_load("map1.wmb"); wait(-0.5);
player = ent_create("player.mdl", vector(0,0,20), sv_player); // now it should start the sv_player function on the server, but it doesn't } }
if I call the sv_player function manually offline the file will be created. Anyone an idea?
|
|
|
Re: ent_create on client, no function started
[Re: Captain_Kiyaku]
#130003
05/15/07 11:54
05/15/07 11:54
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
Quote:
are you 100% sure it connects to the correct server? (like does it show "session blabla found" in the loading screen?
Yes, I'm 100000% sure. Because I have other functions like showing a message of connected players. This works fine.
|
|
|
Re: ent_create on client, no function started
[Re: oliver2s]
#130004
05/15/07 13:55
05/15/07 13:55
|
Joined: Jan 2003
Posts: 517 Illinois
giorgi3
User
|
User
Joined: Jan 2003
Posts: 517
Illinois
|
This might be some type of timing issue with the startup of the game. I would suggest moving the code to main () and including a wait to make sure the client connection to the server has completed. Something like this: Code:
function sv_player { file_cpy("testfile", "player.mdl"); //create a file on harddisk to see if the function were started }
function main () {
level_load("map1.wmb"); wait(-0.5); // make sure the level is fully loaded
ifdef client; while(connection== 0) {wait(1);} // make sure we have a connection to the server endif; if(connection == 2) { player = ent_create("player.mdl", vector(0,0,20), sv_player); // now it should start the sv_player function on the server, but it doesn't } }
Giorgi3
10,000 parts flying in a close formation does not constitute an airplane. Some assembly is required.
|
|
|
Re: ent_create on client, no function started
[Re: giorgi3]
#130005
05/15/07 19:01
05/15/07 19:01
|
Joined: Jun 2002
Posts: 3,682 Coppell, Texas
Ran Man
Expert
|
Expert
Joined: Jun 2002
Posts: 3,682
Coppell, Texas
|
Hi, Yes, I also had problems creating and running the SERVER player using ent_create, so to make it work, I just made the SERVER to use an ACTION in the level, and just used ent_create for the clients. Hey, it works.
|
|
|
|