Home   Help Search Login Register  

Author Topic: How to run script only in server?  (Read 1160 times)

0 Members and 1 Guest are viewing this topic.

Offline epsilonsun

  • Members
  • *
How to run script only in server?
« on: 03 Oct 2008, 05:34:47 »

I try to edit a mp mission,but something wrong there.

script runs every player,

How to run script only in server?

thanks alot!

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: How to run script only in server?
« Reply #1 on: 03 Oct 2008, 05:46:41 »
Try:

Code: [Select]
(isnull player)
as a condition, because servers do not have players.

luke
Pesky Human!!
Wort Wort Wort.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: How to run script only in server?
« Reply #2 on: 03 Oct 2008, 12:05:44 »
Wrong, servers have players, dedicated servers dont have players.
If you only want to be sure the script is run on the server (with or without player), just put a simple condition at the very first line of your script:

IF it is SQF then:
if (!isServer) exitWith {};

IF it is SQS then:
? !isServer: exit