Rommel 2 Posted March 31, 2008 I have an action, the player pushes it, it launches a script. (player addaction ["action","script.sqf"] Simple enough so far. Now I want to get the server to execute something from that script. script.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[server] execVM "script2.sqf" And to make a variable/code global from that script I would just: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">publicVariable "It"; $10 says that the server doesn't execute it because its local to the client or...??? I bet the experts get sick of these questions, but I guess it just can't be said enough. Share this post Link to post Share on other sites
loyalguard 15 Posted March 31, 2008 You are correct in that scripts executed by an addAction are local to the client it was run on. Â To achieve what you are looking for me I would recommend something like this (requires 1.09 or higher although there is a way to do it with 1.08). In your init.sqf or somewhere else at mission start put the following code: init.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (isServer) then { Â Â "clientAction" addPublicVariableEventHandler {/*Insert code you want executed when client runs addAction*/}; }; This sets up a public variable event handler on the server only that waits for the for pertinent public variable to be changed and then executes whatever code you want every time it does. Then in your script.sqf add the following code: script.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">clientAction = true; publicVariable "clientAction"; This broadcasts the public variable that the server event handler is waiting for so that the server can run the code you want. I made the variable boolean but you can you any type of variable. There is more to the addPublicVariableEventHandler command that is available so check it in the Biki. Â I hope this help! Share this post Link to post Share on other sites
baddo 0 Posted March 31, 2008 There seems to be a "OFPEC: Multi Player Tutorial" at http://www.ofpec.com/ could be worth a read. Share this post Link to post Share on other sites