oaaron99

Untitled

Feb 3rd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 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. CreateTimer(0.1, Timer, _, TIMER_REPEAT);
  10. }
  11.  
  12. public OnPushed(char[] output, int caller, int activator, float delay)
  13. {
  14. if (activator > MaxClients && activator <= 0)
  15. return;
  16.  
  17. char sName[64], curMap[64];
  18. GetCurrentMap(curMap, sizeof(curMap));
  19.  
  20. if (StrEqual(curMap, "jb_clouds_beta01"))
  21. {
  22. GetEntPropString(caller, Prop_Data, "m_iName", sName, sizeof(sName));
  23. PrintToChatAll("Correct button (%i - %s - %s)", caller, sName, output);
  24. }
  25. }
  26.  
  27. public Action Timer(Handle timer)
  28. {
  29. for(new i = 1; i <= MaxClients; i++)
  30. {
  31. if(IsClientInGame(i) && IsClientAuthorized(i) && IsPlayerAlive(i))
  32. {
  33. int target = GetClientAimTarget(i, false);
  34.  
  35. char clsname[64], sName[64];
  36.  
  37. GetEntityClassname(target, clsname, sizeof(clsname));
  38. GetEntPropString(target, Prop_Data, "m_iName", sName, sizeof(sName));
  39.  
  40. PrintHintText(i, "%i %s - %s", target, clsname, sName);
  41. }
  42. }
  43. }
  44.  
  45. public Action CMD_Button(int client, int args)
  46. {
  47. char curMap[64];
  48. GetCurrentMap(curMap, sizeof(curMap));
  49.  
  50. if (!StrEqual(curMap, "jb_clouds_beta01"))
  51. return Plugin_Handled;
  52.  
  53. int iEnt = -1;
  54. char sName[64];
  55.  
  56. while((iEnt = FindEntityByClassname(iEnt, "func_button")) > 0)
  57. {
  58. GetEntPropString(iEnt, Prop_Data, "m_iName", sName, sizeof(sName));
  59.  
  60. if (StrEqual(sName, "secret_master_button_final"))
  61. {
  62. AcceptEntityInput(iEnt, "Press");
  63. }
  64. }
  65.  
  66. return Plugin_Handled;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment