LightWalker 0 Posted January 18, 2005 I searched the forum but coulnd find a proper anwer to my question: Building an AddOn in which I want a script to run on the Server only (Multiplayer) and not on any client. Some how I am lost here (or spent too much time on the AddOn) but I could use some help on this. How do I determine if the script is running on the server only? Share this post Link to post Share on other sites
Hawkins 8 Posted January 18, 2005 Hmm... Well you need to have a gamelogic named server to have the following work: At the start of the script you want to run for the server ONLY, put ?!(local Server): exit Simple. What most addon makers do (at least from what I've seen) they put a note in the readme to put in a gamelogic named Server in the mission editor. I'm not aware of any other way of doing it. EDIT: And to get more in detail (goddamn I love mission editing :P ) you can have a certain part of the script to run for the server only, for example if you want a unit to join a group and do it like you do in SP: [man] join group sam The leader of the group will "report" the join as many times as there's players on the server. At least that's what happens on non-dedicated servers, which we almost every time play on. TO get him report it once: ?(local Server): [man] join group sam I wont guarantee that this will work on dedicated servers, never really played any of my missions on dedi servers... Share this post Link to post Share on other sites
LightWalker 0 Posted January 18, 2005 Thanks HawkinsDaFin - that's what I use for editing too. But for this I want the AddOn scripts independantly check if they are running locally on a server (dedi), and if not : exit. But again, thanks for your reply! Share this post Link to post Share on other sites
Hawkins 8 Posted January 18, 2005 No problem. I haven't come accross to this kind of problem in my addon editing days yet. Though, one way which might work, would be to somehow detect something... Like FDF does in it's UAV Ranger for example. It checks if the UAV is on the players "hands" so to speak. Haven't looked into it though. Not sure but it might be helpful if I/we knew what it is exactly you want to do in the script? What executes it and such. Maybe if you execute it on a unit, check if it's local with the same command? Not sure if that will work though. Share this post Link to post Share on other sites
RED 0 Posted January 18, 2005 Thanks HawkinsDaFin - that's what I use for editing too. But for this I want the AddOn scripts independantly check if they are running locally on a server (dedi), and if not : exit. But again, thanks for your reply! Check the ECP scripts, we have a workaround that you might like to look at. RED Share this post Link to post Share on other sites
LightWalker 0 Posted January 18, 2005 The point is that i am scripting serveral crash situations in the addon itself where the vehicle is replaced by a crashed version. You can imagine I dont want all clients (players) do this. Quote[/b] ]Check the ECP scripts, we have a workaround that you might like to look at. Is there a more easy way to find that workaround. That would be helpfull Share this post Link to post Share on other sites
Oxide-ORCS- 0 Posted January 22, 2005 Well, the simpliest way to check if it dedi or not: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?isNull player: code that should be runned only on dedicated serv. This principle is based on that on dedi we doesn' have a human player, so... you understand that I want to say Share this post Link to post Share on other sites
feersum.endjinn 6 Posted January 22, 2005 Wouldn't it cause problems then when running hosted game where there is player on server... There usually isn't too much difference whether scripts runs at server or where addon vehicle is local... Vehicle local method is what OFP likes anyway in most cases, as most script functions do not work on non-local stuff. Share this post Link to post Share on other sites
bn880 5 Posted January 22, 2005 Yes it would, unless he does mean "dedicated" only... Share this post Link to post Share on other sites
LightWalker 0 Posted January 26, 2005 Solved it! Thanks for your support! Share this post Link to post Share on other sites