-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from KillahPotatoes/v2.0.1
V2.0.1
- Loading branch information
Showing
18 changed files
with
301 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
KPR_fnc_addScore | ||
File: fn_addScore.sqf | ||
Author: Wyqer - https://github.com/KillahPotatoes | ||
Date: 2018-07-23 | ||
Last Update: 2018-07-23 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Changes the score of a given player. Returns true on success and false if the player wasn't found. | ||
Parameter(s): | ||
0: STRING - Steam UID of the player | ||
1: NUMBER - Amount of points to add to the player score. Can be negative to substract. (default: 0) | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
if (!isServer) exitWith {false}; | ||
|
||
params ["_uid", ["_change", 0]]; | ||
|
||
private _index = KPR_players findIf {_x select 1 == _uid}; | ||
|
||
// Return false, if uid wasn't found in the players array | ||
if (_index == -1) exitWith {false}; | ||
|
||
// Adjust score and save | ||
KPR_players select _index set [5, (KPR_players select _index select 5) + _change]; | ||
[KPR_players] call KPR_fnc_savePlayers; | ||
|
||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
KPR_fnc_getRank | ||
File: fn_getRank.sqf | ||
Author: Wyqer - https://github.com/KillahPotatoes | ||
Date: 2018-07-23 | ||
Last Update: 2018-07-23 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Gets the current rank of a given player. Identified by the Steam UID. | ||
Returns the current rank as number. If the Steam UID wasn't found it returns -1. | ||
Parameter(s): | ||
0: STRING - Steam UID of the player | ||
Returns: | ||
NUMBER | ||
*/ | ||
|
||
params ["_uid"]; | ||
|
||
private _index = KPR_players findIf {_x select 1 == _uid}; | ||
|
||
// Return -1, if uid wasn't found in the players array | ||
if (_index == -1) exitWith {_index}; | ||
|
||
// Return rank, if player was found | ||
KPR_players select _index select 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
KPR_fnc_getScore | ||
File: fn_getScore.sqf | ||
Author: Wyqer - https://github.com/KillahPotatoes | ||
Date: 2018-07-23 | ||
Last Update: 2018-07-23 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Gets the current score of a given player. Identified by the Steam UID. | ||
Returns the current score as number. If the Steam UID wasn't found it returns -1. | ||
Parameter(s): | ||
0: STRING - Steam UID of the player | ||
Returns: | ||
NUMBER | ||
*/ | ||
|
||
params ["_uid"]; | ||
|
||
private _index = KPR_players findIf {_x select 1 == _uid}; | ||
|
||
// Return -1, if uid wasn't found in the players array | ||
if (_index == -1) exitWith {_index}; | ||
|
||
// Return score, if player was found | ||
KPR_players select _index select 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
KPR_fnc_hasRank | ||
File: fn_hasRank.sqf | ||
Author: Wyqer - https://github.com/KillahPotatoes | ||
Date: 2018-07-23 | ||
Last Update: 2018-07-23 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Checks if the given player has at least the given rank. | ||
Returns true if he has and false if the player hasn't or wasn't found. | ||
Parameter(s): | ||
0: STRING - Steam UID of the player | ||
1: NUMBER - Rank to check (default: 0) | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
params ["_uid", ["_rank", 0]]; | ||
|
||
private _index = KPR_players findIf {_x select 1 == _uid}; | ||
|
||
// Return false, if uid wasn't found in the players array | ||
if (_index == -1) exitWith {false}; | ||
|
||
(KPR_players select _index select 2 >= _rank) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
KPR_fnc_setRank | ||
File: fn_setRank.sqf | ||
Author: Wyqer - https://github.com/KillahPotatoes | ||
Date: 2018-07-23 | ||
Last Update: 2018-07-23 | ||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html | ||
Description: | ||
Sets the rank of a given player to a given rank. Returns true on success and false if the player wasn't found. | ||
Parameter(s): | ||
0: STRING - Steam UID of the player | ||
1: NUMBER - Rank to set (default: 0) | ||
Returns: | ||
BOOL | ||
*/ | ||
|
||
if (!isServer) exitWith {false}; | ||
|
||
params ["_uid", ["_rank", 0]]; | ||
|
||
private _index = KPR_players findIf {_x select 1 == _uid}; | ||
|
||
// Return false, if uid wasn't found in the players array | ||
if (_index == -1) exitWith {false}; | ||
|
||
// Set rank and save | ||
KPR_players select _index set [2, _rank]; | ||
[KPR_players] call KPR_fnc_savePlayers; | ||
|
||
true |
Oops, something went wrong.