Skip to content

Commit

Permalink
fix set perm player (keep score)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbox1911 committed Jul 19, 2024
1 parent 9f18d3e commit ad9e730
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
1 change: 1 addition & 0 deletions core.liberation/scripts/client/misc/welcome.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Say hello, and set Rank/Insigna
*/
waitUntil {sleep 1; GRLIB_player_spawned};
waitUntil {sleep 1; (player getVariable ["GRLIB_Rank", "init"] != "init")};

private _score = [player] call F_getScore;
private _rank = player getVariable ["GRLIB_Rank", "Private"];
Expand Down
8 changes: 2 additions & 6 deletions core.liberation/scripts/server/game/apply_saved_scores.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ while { true } do {
_nextplayer setVariable ["GREUH_reput_count", 0, true];
};

// set player rank
_score = _nextplayer getVariable ["GREUH_score_count",0];
_rank = [_score] call get_rank;
_nextplayer setVariable ["GRLIB_Rank", _rank, true];
[] remoteExec ["set_rank", owner _nextplayer];

_nextplayer setVariable ["GRLIB_Rank", "init", true];
_nextplayer setVariable ["GREUH_score_last", 0, true];
_nextplayer setVariable ["GRLIB_score_set", 1, true];
};

Expand Down
45 changes: 23 additions & 22 deletions core.liberation/scripts/server/game/manage_score.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -80,34 +80,35 @@ while { true } do {
};
};

if (_x getVariable ["GRLIB_player_last_notif", 0] < time) then {
_msg = format ["Congratulation <t color='#00ff00'>%1</t> !!<br />You have been promoted to : <t color='#ff0000'>%2</t>.<br /><br />%3", name _x, _new_rank, _msg2];
[_msg, 0, 0, 5, 0, 0, 90] remoteExec ["BIS_fnc_dynamicText", owner _x];
["FD_Finish_F"] remoteExec ["playSoundNow", owner _x];
} else {
_msg = format ["You have been promoted to %1.", _new_rank];
[gamelogic, _msg] remoteExec ["globalChat", owner _x];
_firework = false;
if (_rank != "init") then {
if (_x getVariable ["GRLIB_player_last_notif", 0] < time) then {
_msg = format ["Congratulation <t color='#00ff00'>%1</t> !!<br />You have been promoted to : <t color='#ff0000'>%2</t>.<br /><br />%3", name _x, _new_rank, _msg2];
[_msg, 0, 0, 5, 0, 0, 90] remoteExec ["BIS_fnc_dynamicText", owner _x];
["FD_Finish_F"] remoteExec ["playSoundNow", owner _x];
} else {
_msg = format ["You have been promoted to %1.", _new_rank];
[gamelogic, _msg] remoteExec ["globalChat", owner _x];
_firework = false;
};
_x setVariable ["GRLIB_player_last_notif", round (time + 5*60)];
// if rank colonel global greet
if (_new_rank == "Colonel") then {
["FD_Finish_F"] remoteExec ["playSoundNow", 0];
_text = "Good news soldiers...";
[gamelogic, _text] remoteExec ["globalChat", 0];
_text = "We have a new Colonel !!";
[gamelogic, _text] remoteExec ["globalChat", 0];
_text = format ["Congratulation to %1 for his fight !!", name _x];
[gamelogic, _text] remoteExec ["globalChat", 0];
_text = "Over.";
[gamelogic, _text] remoteExec ["globalChat", 0];
};
};
_x setVariable ["GRLIB_player_last_notif", round (time + 5*60)];

// set player rank
[] remoteExec ["set_rank", owner _x];
_x setVariable ["GRLIB_Rank", _new_rank, true];

// if rank colonel global greet
if (_new_rank == "Colonel") then {
["FD_Finish_F"] remoteExec ["playSoundNow", 0];
_text = "Good news soldiers...";
[gamelogic, _text] remoteExec ["globalChat", 0];
_text = "We have a new Colonel !!";
[gamelogic, _text] remoteExec ["globalChat", 0];
_text = format ["Congratulation to %1 for his fight !!", name _x];
[gamelogic, _text] remoteExec ["globalChat", 0];
_text = "Over.";
[gamelogic, _text] remoteExec ["globalChat", 0];
};

// fireworks !!
if (_firework) then {
[getPosATL _x, _rounds] remoteExec ["remote_call_fireworks", 0];
Expand Down

0 comments on commit ad9e730

Please sign in to comment.