gangolf 10 Posted September 19, 2015 Hi Guys, i've some problems by setting a global variable. Background: I try to write a small script to prevent that our mission ll be stolen. The Problem is, my init dont find my publicvariable // Description.ext - Define End6 class CfgDebriefing { class End6 { title = "Mission stolen"; subtitle = ""; description = "this mission is stolen"; pictureBackground = ""; picture = "b_inf"; pictureColor[] = {0.0,0.3,0.6,1}; }; }; // init.sqf - Check if Server is mine execvm "verification.sqf"; wait 2; if (correctserver) then [ { hint"Starting Server" }, { failmission"END6" } ]; // verification.sqf- Set correctserver true correctserver= true; publicVariableServer "correctserver"; Share this post Link to post Share on other sites
jshock 513 Posted September 19, 2015 "wait" does not exist in sqf, try sleep in its place, and if that makes any difference. Share this post Link to post Share on other sites
gangolf 10 Posted September 19, 2015 yeah my bad... same result ^^ Share this post Link to post Share on other sites
jshock 513 Posted September 19, 2015 Sorry, on my phone and didn't see your "if" statement syntax is also bad, "if"s follow: if (_variable) then { do something } else { do something else }; Share this post Link to post Share on other sites
killzone_kid 1330 Posted September 19, 2015 Sorry, on my phone and didn't see your "if" statement syntax is also bad, "if"s follow: if (_variable) then { do something } else { do something else }; Sadly, there is nothing wrong with OP's "if" statement https://community.bistudio.com/wiki/if Share this post Link to post Share on other sites
davidoss 552 Posted September 19, 2015 publicVariableServer You trying public variable from server to server. You don't need public server global variable to check variable on server machine. Nonsense. // init.sqf - Check if Server is mine if (isServer)then { [] execVM "verification.sqf"; sleep 2; if (correctserver) then { systemChat "Starting Mission"; } else {failmission"END6"}; }; Anyway such security lock is nothing. Look for how to binarize your mission.sqm Share this post Link to post Share on other sites
jshock 513 Posted September 19, 2015 Sadly, there is nothing wrong with OP's "if" statement https://community.bistudio.com/wiki/if Hm, just never saw it I guess :P. Share this post Link to post Share on other sites
ussrlongbow 116 Posted September 24, 2015 No need to put that data in debriefing, just store server-side code apart from mission, and it will just not launch on other hosts who do not have server-side scripts. Share this post Link to post Share on other sites
KernelPanicAkr 13 Posted September 25, 2015 Another way to aproach it: init.sqf (clientside): #define WAIT_TIME 10 waitUntil {time > 0}; _tCheck = time; waitUntil {!isNil "correctserver" || (_tCheck + WAIT_TIME < time)}; if(isNil "correctserver") exitWith { failMission "END6"; }; hint "Starting server."; You can use waitUntil and sleep in "init.sqf" as it's run in scheduled environment. Anyway, this kind of protection is useless, someone with averege skill knowledge would override that. I'd recomend looking into a "code transfer", meaning: All the important code of the mission, even the placement of some objects could be stored server side (creating an addon, just like AltisLifeRPG), and when the player joins in, this server addon would be called and would upload the data to the client throught a BIS_fnc_MP function. I could give you an example code if you need it really bad. Share this post Link to post Share on other sites
ussrlongbow 116 Posted September 25, 2015 Another way to aproach it: init.sqf (clientside): #define WAIT_TIME 10 waitUntil {time > 0}; _tCheck = time; waitUntil {!isNil "correctserver" || (_tCheck + WAIT_TIME < time)}; if(isNil "correctserver") exitWith { failMission "END6"; }; hint "Starting server."; You can use waitUntil and sleep in "init.sqf" as it's run in scheduled environment. Anyway, this kind of protection is useless, someone with averege skill knowledge would override that. I'd recomend looking into a "code transfer", meaning: All the important code of the mission, even the placement of some objects could be stored server side (creating an addon, just like AltisLifeRPG), and when the player joins in, this server addon would be called and would upload the data to the client throught a BIS_fnc_MP function. I could give you an example code if you need it really bad. BIS_fnc_MP may be considered outdated since engine-native remoteewxeccall had been introduced. also, transfering functions is also could be done via PublicVariable. Share this post Link to post Share on other sites
KernelPanicAkr 13 Posted September 25, 2015 BIS_fnc_MP may be considered outdated since engine-native remoteewxeccall had been introduced. also, transfering functions is also could be done via PublicVariable. The thing of publicVariable is... That costs much bandwidth. I have pretty bad experience using it. Didn't know about the new function, will look into it. Share this post Link to post Share on other sites
gangolf 10 Posted September 28, 2015 THX All for the help.. i just forgot to launch the mod :lol: My Bad Greetings Gangolf Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted September 28, 2015 Just because I'm interested, what is the deeper purpose of this "mission stolen" ending? What hinders a thief from simply avoiding the respective if statement and using the mission as it is? Share this post Link to post Share on other sites
gangolf 10 Posted January 13, 2016 Hey sorry didnt saw your answer. other Clans stole our Mission.. they have absolut no experience in scripting.. so this should stop them :D Greetings Gangolf Share this post Link to post Share on other sites
Tankbuster 1744 Posted January 13, 2016 User asks the community to fix script with the express intention of not giving the mission or indeed, the fix, to the community. 3 Share this post Link to post Share on other sites
shuko 59 Posted January 13, 2016 I can't think anything worse than someone else playing a mission I've created. 3 Share this post Link to post Share on other sites
Tankbuster 1744 Posted January 14, 2016 other Clans stole our Mission.. they have absolut no experience in scripting.. so this should stop them :D "wait" does not exist in sqf, try sleep in its place, and if that makes any difference. Uses 'wait' command then derides another clan for having no scripting experience. Share this post Link to post Share on other sites