oaaron99

Untitled

Feb 3rd, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. public OnPluginStart()
  5. {
  6. RegConsoleCmd("sm_button", CMD_Button);
  7. HookEntityOutput("func_button", "OnPressed", OnPushed);
  8. }
  9.  
  10. public OnPushed(char[] output, int caller, int activator, float delay)
  11. {
  12. if (activator > MaxClients && activator <= 0)
  13. return;
  14.  
  15. char sName[64], curMap[64];
  16. GetCurrentMap(curMap, sizeof(curMap));
  17.  
  18. if (StrEqual(curMap, "jb_clouds_beta01"))
  19. {
  20. GetEntPropString(caller, Prop_Data, "m_iName", sName, sizeof(sName));
  21. PrintToChatAll("Correct button (%i - %s - %s)", caller, sName, output);
  22. }
  23. }
  24.  
  25. public Action CMD_Button(int client, int args)
  26. {
  27. char curMap[64];
  28. GetCurrentMap(curMap, sizeof(curMap));
  29.  
  30. if (!StrEqual(curMap, "jb_clouds_beta01"))
  31. return Plugin_Handled;
  32.  
  33. int iEnt = -1;
  34. char sName[64];
  35.  
  36. while((iEnt = FindEntityByClassname(iEnt, "func_button")) > 0)
  37. {
  38. GetEntPropString(iEnt, Prop_Data, "m_iName", sName, sizeof(sName));
  39.  
  40. if (StrEqual(sName, "secret_master_button_final"))
  41. {
  42. AcceptEntityInput(iEnt, "Press");
  43. }
  44. }
  45.  
  46. return Plugin_Handled;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment