This repository has been archived by the owner on Jul 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfn_initTicketsystem.sqf
56 lines (49 loc) · 1.63 KB
/
fn_initTicketsystem.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* @author Willard
* @description
* Determines the current round number
* @params none
* @return nothing
*/
if(!isServer) exitWith {
["initTicketsystem not called on the server!", "Error", true] spawn
BIS_fnc_guiMessage;
};
// build the query for the last round number and commit it, default is 1
_lastRoundResult = "extDB3" callExtension format["0:SQL:getLastRound:%1",
tf47_core_ticketsystem_missionId];
_result = (call compile _lastRoundResult) select 1;
_lastRound = 0;
if((typeName _result) == "ARRAY") then {
if((count _result) != 0) then {
_lastRound = (_result select 0) select 0;
if(typeName _lastRound == "STRING") then {
if(_lastRound == "") then {
_lastRound = 0;
};
};
};
};
// increment the round number and "commit" it
tf47_core_ticketsystem_round = _lastRound + 1;
publicVariable "tf47_core_ticketsystem_round";
tf47_core_ticketsystem_endingScript = scriptNull;
publicVariable "tf47_core_ticketsystem_endingScript";
// show current tickets every 300s
_scriptHandle = [] spawn {
while {true} do {
_message = format["Aktuelle Tickets: %1",
tf47_core_ticketsystem_tickets];
["tf47_core_ticketStatus",[_message]] remoteExecCall
["BIS_fnc_showNotification", 0];
sleep 300;
};
};
[10, 0, objNull, tf47_core_ticketsystem_missionName]
call tf47_core_ticketsystem_fnc_insertTicketlog;
addMissionEventHandler ["Ended",{
if((["win", _this] call BIS_fnc_inString)) then {
[11, 0, objNull, "Mission gewonnen"]
call tf47_core_ticketsystem_fnc_insertTicketlog;
};
}];