I made a trigger script running only on server and communicate minutes/seconds values to clients. So the final time given by the server is the same for all clients.
It's work fine on the ArmA editor but only minutes works on a dedicated server
Here, how I proceed:
Init.sqf:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
"1" ObjStatus "ACTIVE";
obj1=1;
win=0;
TM=0;
TS=0;
FAR SetGroupId ["ALPHA BLUE"];
if (true) exitWith {};
[/QUOTE]
Trigger launch Timer Script on the server when player enter a specific zone:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
Condition: if (isserver) then {nul=[] execVM "scripts\timer.sqf"}
[/QUOTE]
timer.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 {
T1=time;
TM=0;
while { (win==0) } do {
T2=time;
T3=T2-T1;
TS=T3;
sleep .1;
if ( T3>=60) then {
TM=TM+1;
publicvariable "TM";
TS=0;
publicvariable "TS";
T1=T2;
sleep .1;
};
};
} else {};
If (true) ExitWith {};
[/QUOTE]
When OBJ is success, a trigger launch:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
win=1; publicvariable "win"; TitleText [ format ["Final Time: %1 min. %2 sec.", TM, TS],"PLAIN DOWN"]
[/QUOTE]
A repeating trigger display time to clients during the mission too:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
if (!(isnull player)) then {nul=[] execVM "scripts\clttimer.sqf"}
[/QUOTE]
clttimer.sqf:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
while { (win==0) } do {
hint format["Time: %1 min. %2 sec.", TM, TS];
sleep .1;
};
If (true) ExitWith {};
[/QUOTE]
Minutes works on dedicated server, but not the seconds displaying 0
Anyone have an idea ?
HOME 

Reply With Quote