mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Generate SSN of unit from their name
Similar to how we're handling blood types, uses the unit's name to generate a valid three/two/four format SSN. For names less than 9 characters long this will currently generate a unique SSN only up to the length of the name and append valid digits as necessary.
This commit is contained in:
parent
7f39748ff0
commit
ebcf1687a7
@ -9,4 +9,5 @@ PREP(getDogtagData);
|
|||||||
PREP(getDogtagItem);
|
PREP(getDogtagItem);
|
||||||
PREP(sendDogtagData);
|
PREP(sendDogtagData);
|
||||||
PREP(showDogtag);
|
PREP(showDogtag);
|
||||||
|
PREP(ssn);
|
||||||
PREP(takeDogtag);
|
PREP(takeDogtag);
|
||||||
|
@ -23,9 +23,7 @@ private _targetName = [_target, false, true] call EFUNC(common,getName);
|
|||||||
|
|
||||||
private _dogTagData = [
|
private _dogTagData = [
|
||||||
_targetName,
|
_targetName,
|
||||||
str(floor random 10) + str(floor random 10) + str(floor random 10) + "-" +
|
_targetName call FUNC(ssn),
|
||||||
str(floor random 10) + str(floor random 10) + "-" +
|
|
||||||
str(floor random 10) + str(floor random 10) + str(floor random 10),
|
|
||||||
_targetName call FUNC(bloodType)
|
_targetName call FUNC(bloodType)
|
||||||
];
|
];
|
||||||
// Store it
|
// Store it
|
||||||
|
23
addons/dogtags/functions/fnc_ssn.sqf
Normal file
23
addons/dogtags/functions/fnc_ssn.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Author: SilentSpike
|
||||||
|
* Reports a social security number generated from the units name.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Name of a unit <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* A random social security number <STRING>
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_name"];
|
||||||
|
|
||||||
|
private _nums = ((toArray _name) select [0,9]) apply { _x % 10 };
|
||||||
|
|
||||||
|
while {count _nums < 9} do {
|
||||||
|
_nums pushBack (floor random 10);
|
||||||
|
};
|
||||||
|
|
||||||
|
([_nums select [0,3],_nums select [3,2], _nums select [5,4]] apply { _x joinString "" }) joinString "-"
|
Loading…
Reference in New Issue
Block a user