kinismo 0 Posted August 2, 2007 Yes i would like to know how can i get this script to execute only on server? Now it seems to execute on every client so artillery strikes multiplies as many times as there is players. I call this script from cannon's init field: [this] exec "art.sqs" Quote[/b] ]#loop _arty = _this select 0 _posX = getMarkerPos "tgt" select 0 _posY = getMarkerPos "tgt" select 1 _arty doWatch [_posx, _posy, 6000] ~((random 2.5) + 3) _arty fire "M119" ~8 _posX = _posX + ((random 1000) - 500) _posY = _posy + ((random 1000) - 500) "SH_105_HE" createVehicle [_posx, _posy, 0] IMPACT = true; if (local server) then {publicVariable "IMPACT"} arty1 setVehicleAmmo 1; arty2 setVehicleAmmo 1;arty3 setVehicleAmmo 1; if (alive arty1 and alive arty2 and alive arty3) then {goto "Loop"}; exit Share this post Link to post Share on other sites
[frl]myke 14 Posted August 2, 2007 just add this add the beginning of your script: ?! (isServer): exit Share this post Link to post Share on other sites
kinismo 0 Posted August 2, 2007 Ok, thanks. Btw what does that ?! mean? Share this post Link to post Share on other sites
snkman 351 Posted August 2, 2007 ? = if, ! = not, isServer = is Server, : = then exit So ?! (isServer): exit = If this is not the server then exit the script Share this post Link to post Share on other sites
[frl]myke 14 Posted August 2, 2007 Most operators can be written in 2 ways: text or symbol ? if ! not : then && and it doesn't matter what you prefer, just for better readings i suggest you choose one way and keep this up Share this post Link to post Share on other sites
weedomatic 0 Posted August 3, 2007 Quote[/b] ]? = if, ! = not, isServer = is Server, : = then exit isServer returns a value of type boolean, which is either true or false. You probably implied that, SNK, just wanted to make the implication explicit for the untrained programmer. Moreover, the whole construct ( ?: ) is just an abbreviated way for simple if-control structures (if-then). Edit: Markup, spelling Share this post Link to post Share on other sites
kinismo 0 Posted August 7, 2007 One more question. What if difference between: ?! (isServer): exit and ?!(local server) : goto exit ? Share this post Link to post Share on other sites
HitmanFF 6 Posted August 7, 2007 Before the isServer command was available, you could check by creating a game logic (in your question called server) on the map and check for its availability by <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(local server) So if the logic is available, it means it's the server. The isServer command has made this construction redundant basically. Share this post Link to post Share on other sites
Praxtor 0 Posted August 7, 2007 Quote[/b] ]?! (isServer): exit Is one command directly. Quote[/b] ]?!(local server) : goto exit Here only Local is the command server is one logical in the game that you need create and put the name server or one soldier is indiferent, here you ask to the game if the object named server is running in the local machine, because the local machine is the first in load the object. Share this post Link to post Share on other sites
snkman 351 Posted August 7, 2007 Well the Biki say: Quote[/b] ]; OFP example: all game logic objects are local to the server at all times, ; so by placing a reference game logic we get the equivalent of isServer ; this code is deprecated in ArmA ?(!local someGameLogic): exit this code is deprecated in ArmA Share this post Link to post Share on other sites
misinformed 0 Posted August 8, 2007 Well the Biki say:Quote[/b] ]; OFP example: all game logic objects are local to the server at all times, ; so by placing a reference game logic we get the equivalent of isServer ; this code is deprecated in ArmA ?(!local someGameLogic): exit this code is deprecated in ArmA So, its what, less efficient/uses up more resources than the newer examples given? Because this still works : ?!(local server) : whatever Or are you referring to this not working at all ?(!local server) Share this post Link to post Share on other sites