Home   Help Search Login Register  

Author Topic: Thes damn server/client problems  (Read 986 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Thes damn server/client problems
« on: 08 Apr 2004, 02:19:17 »
well, i know i'm not the smartest but this thing is killing me...i try to make a well working taxi system which let's you call a taxi. In editor preview it works perfectly, as server it works perfectly, but if a client tries to use it...taxi's wont move.

Here's the script that gives me so much headache...maybe someone of you knows what i did wrong or how i could fix it.

;calltaxi.sqs

_name = name player
_posp = player
_pos1 = taxi1
_pos2 = taxi2
_nearer1 = 0
_nearer2 = 0
_dist1 = _posp distance _pos1
_dist2 = _posp distance _pos2
?(_dist1 <= _dist2): _nearer1 = 1
?(_dist2 <= _dist1): _nearer2 = 1

?(taxi1busy == 0) AND (_nearer1 == 1): goto "taxi1"
?(taxi2busy == 0) AND (_nearer2 == 1): goto "taxi2"
?(taxi1busy == 0): goto "taxi1"
?(taxi2busy == 0): goto "taxi2"

_msg = format ["Sorry %1,\nthere's no free Taxi.\nTry again later.", _name]
goto "end"

#taxi1
_cab = taxidriver1
_msg = format ["%1, Taxi #1 is on the Way.\nPlease be patient", _name]
taxi1target setpos getpos player
taxi1busy = 1; publicvariable "taxi1busy"
_target = taxi1target
[] exec "taxi1release.sqs"
goto "move"

#taxi2
_cab = taxidriver2
_msg = format ["%1, Taxi #2 is on the Way.\nPlease be patient", _name]
taxi2target setpos getpos player
taxi2busy = 1; publicvariable "taxi2busy"
_target = taxi2target
[] exec "taxi2release.sqs"
goto "move"

#move
_cab move getpos _target

#end
hint _msg
exit


Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Thes d**n server/client problems
« Reply #1 on: 08 Apr 2004, 03:10:57 »
There are problems with cammanding units to move when you are doing MP games.  I'm not sure if anyone has solved this.  But one thing you should do is make sure you have a game logic on your map and call it server.  Then at the begining of your script put this line:

?!(local server):exit

This makes sure the script will only run on the server (in MP) so there will not be a conflict where each terminal is commanding the same units to move to different places at the same time.  This command also is needed when doing spawning to prevent duplicated units (only the server runs the script).  I hope this helps, but I do remember reading a thread on this forum where someone was having problems with the domove command in MP.  It was in the editing/scripting multiplayer forum if you want to search for it.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Thes d**n server/client problems
« Reply #2 on: 08 Apr 2004, 03:18:06 »
thx for your input Raptorsaurus but i'm affraid it doesn't help.

I already tried it with the local server option as you suggested but this didn't solved the problem.

About the doMove thread...at first i had the same prob...the unit wouldn't move at all, then i replaced the doMove with the move command, then it worked.

I'm sorry, should have posted this in the starting post...i'm sorry. I hope i didn't wasted your time.

anyway...thx for your try

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Thes d**n server/client problems
« Reply #3 on: 08 Apr 2004, 05:20:09 »
How does the taxi know which player called him? In the editor it's simple because the player is just one player, but in mp the player is actually all of the players.

Are you calling the script with radio of with an action?
Radio makes the script run on all clients and the server. So if you're using radio I'm not suprised it doesn't work.
Action how ever always runs the executed script locally for the one who did the action. This could be your solution.
Not all is lost.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Thes d**n server/client problems
« Reply #4 on: 08 Apr 2004, 05:25:50 »
yep thx artak...i called the script with action menu and i could get it halfway to work...but only halfway...i used publicvariables to get around some problems.

But i think, with all my trying i @#$&% these scripts completely up, so i decided to clear them and start from bottom, using all what i learned till now.

F***, this thing is giving me headache of the finest sort.

anyway, i close this thread, maybe i'll be back with another one when i still get the problem but then it would be on some completely different script.

Thx for your time lads.