Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. //Must set banHammerClassname = "AMMO_CLASSNAME"; for the ban hammer weapon
  2.  
  3. fnc_banHammer =
  4. {
  5. player addEventHandler ["handledamage",{
  6.  
  7. _source = _this select 3;
  8. _weapon = _this select 4;
  9.  
  10. _adminUID = getPlayerUID _source;
  11. _playerUID = getPlayerUID;
  12. _length = 24;
  13.  
  14. //Might remove the MySQL Check with an setVariable on isAdmin objects
  15. [[_adminUID], "fnc_checkAdmin", false, false] spawn BIS_fnc_MP;
  16.  
  17. }];
  18.  
  19. }
  20.  
  21.  
  22. //Once again, might be removed with an isAdmin variable attached to all player objects
  23. fnc_checkAdmin =
  24. {
  25.  
  26. _adminUID = _this select 0;
  27.  
  28. _result = "Arma2Net.Unmanaged" callExtension format ["Arma2NetMySQLCommand ['life', 'SELECT * FROM usertable WHERE uid = '%1' AND isAdmin = 1']", _adminUID];
  29. _result = call compile _result;
  30. _result = (_result select 0);
  31.  
  32. if(count(_result) == 1) then {
  33. _isAdmin = true;
  34.  
  35. [[_isAdmin], "fnc_finishBanHammer", false, false] spawn BIS_fnc_MP;
  36. } else {
  37. //Fail
  38. };
  39. }
  40.  
  41. fnc_finishBanHammer =
  42. {
  43. _isAdmin = _this select 0;
  44.  
  45. if(_isAdmin = true) then {
  46. if(_weapon == banHammerClassname) then {
  47. //Run the Database Case - Add ban
  48. [[_playerUID, _length, _adminUID], "fnc_banHammerServer", false, false] spawn BIS_fnc_MP;
  49.  
  50. //Lightening Bolt
  51. [player, 0, true] call BIS_fnc_moduleLightning;
  52.  
  53. //TODO: Announce the ban
  54.  
  55. };
  56. } else {
  57. //They're not an admin - KILL THEM NAO!
  58. player setDamage 1;
  59. };
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement