sentan Posted February 10, 2015 Report Share Posted February 10, 2015 Hello, i have a problem with global variables, works so far, but after reconnect the variables are empty. Someone know what the problem is? init.sqf if(isServer) then { [] execVM "myServerScript.sqf"; }; [] execVM "myClientScript.sqf"; myServerScript.sqf my_var1 = true; publicVariable "my_var1"; my_var2 = floor(time); publicVariable "my_var2"; my_var3 = [ [8096.875, 7824.2896,0], [8241.0039, 7612.2881,0], [8935.9805, 7398.7944,0] ] call BIS_fnc_selectRandom; publicVariable "my_var3"; myClientScript.sqf while {true} do { sleep 10; systemchat format["%1 || %2 || %3", my_var1, my_var3, my_var3]; }; Output looks like: true || 145256352 || 8096.875, 7824.2896,0 but after a player die and he reconnect, then it looks so: any || any || any Can someone help? I need these variables after reconnect. thanks Link to comment Share on other sites More sharing options...
0 0verHeaT Posted February 10, 2015 Report Share Posted February 10, 2015 JIP clients will need a few seconds until they receive the publicVariables. I recommend to set a 'waitUntil' timer to check whether the variable is already defined or not. while {true} do { waitUntil {(!isNil "my_var1") && (!isNil "my_var2") && (!isNil "my_var3")}; systemChat format["%1 || %2 || %3", my_var1, my_var3, my_var3]; uiSleep 10; }; sentan 1 Link to comment Share on other sites More sharing options...
0 sentan Posted February 11, 2015 Author Report Share Posted February 11, 2015 Thanx for the help 0verHeaT! Made a little mistake by overwriting the variables :D Problem solved! Link to comment Share on other sites More sharing options...
Question
sentan
Hello,
i have a problem with global variables, works so far, but after reconnect the variables are empty. Someone know what the problem is?
init.sqf
myServerScript.sqf
myClientScript.sqf
Output looks like: true || 145256352 || 8096.875, 7824.2896,0
but after a player die and he reconnect, then it looks so: any || any || any
Can someone help?
I need these variables after reconnect.
thanks
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now