Guest User

Untitled

a guest
Apr 26th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. #include <sourcemod>
  2.  
  3. #pragma semicolon 1
  4.  
  5. #define WEAPON_LENGTH 32
  6.  
  7. new bool:EnableSapperDestroy = true;
  8.  
  9. public Plugin:myinfo =
  10. {
  11. name = "Stealth Sapper",
  12. author = "Rorschach",
  13. description = "prevents buildings destroyed by sappers from being reported.",
  14. version = "1.0",
  15. }
  16.  
  17. public OnPluginStart()
  18. {
  19. RegAdminCmd("spy_ss", Command_ObjectDestroyed, ADMFLAG_SLAY, "Stealth Sapper Initiated");
  20. HookEvent("object_destroyed", Event_ObjectDestroyed, EventHookMode_Pre);
  21. PrintToServer("Stealth Sapper Toggled On (%b)", EnableSapperDestroy);
  22. }
  23.  
  24. public Action:Command_ObjectDestroyed(client, args)
  25. {
  26. EnabledSapperDestroy = !EnableSapperDestroy;
  27. PrintToServer("Stealth Sapper Toggled Off (%b)", EnableSapperDestroy);
  28. return Plugin_Handled;
  29. }
  30.  
  31. public Action:Event_ObjectDestroyed(Handle:event, const String:name[], bool:dontBroadcast)
  32. {
  33. if (!DisableSapperDestroy) return Plugin_Continue;
  34.  
  35. decl String:weapon[WEAPON_LENGTH];
  36. GetEventString(event, "weapon", weapon, sizeof(weapon));
  37.  
  38. if (StrEqual(weapon, "obj_attachment_sapper"))
  39. {
  40. return Plugin_Stop;
  41. }
  42.  
  43. GetEventInt(event, "attacker")
  44.  
  45. new attackerUserID = GetEventInt(event, "attacker");
  46. new attackerClient = GetClientOfUserId(attackerUserID);
  47.  
  48. decl String:attacker[MAX_NAME_LENGTH];
  49. GetClientName(attackerClient, attacker, sizeof(attacker);
  50.  
  51. new amount - GetAmount();
  52.  
  53. if (amount <5)
  54. {
  55. PrintToServer("%s stealth sapped %s's %s" , attacker , victim, building);
  56. PrintToChat(attacker, "You stealth sapped %s's %s", victim, building);
  57. PrintToChat(victim, "%s stealth sapped your %s", attacker, building);
  58. }
  59.  
  60. return Plugin_Continue;
  61. }
Add Comment
Please, Sign In to add comment