fn_givePoints.sqf 734 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. File: fn_givePoints.sqf
  3. Author: Rarek [AW]
  4. Description
  5. | Gives score to the specified player, showing a
  6. | notification if a reason is given.
  7. |____________________
  8. Parameters
  9. | 0 - OBJECT: Unit that will receive the score
  10. | 1 - INTEGER: Score to give
  11. | 2 - STRING: Reason to show in notification
  12. |____________________
  13. */
  14. _unit = [_this,0,objNull,[objNull]] call BIS_fnc_param;
  15. _score = [_this,1,2,[0]] call BIS_fnc_param;
  16. _reason = [_this,2,"",[""]] call BIS_fnc_param;
  17. //Give points
  18. _unit addScore _score;
  19. //Show notification?
  20. if (_reason != "") then
  21. {
  22. _params =
  23. [
  24. ["type", "ScoreBonus"],
  25. ["message", _reason],
  26. ["detail", _score]
  27. ];
  28. [_params, "AW_fnc_showNotification", _unit] spawn BIS_fnc_MP;
  29. };