Advertisement
Guest User

BlindCow

a guest
Sep 29th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.39 KB | None | 0 0
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3. #include <cstrike>
  4. #include <sdktools>
  5. #include <clientprefs>
  6. #include <smlib>
  7.  
  8. #undef REQUIRE_PLUGIN
  9.  
  10. public Plugin:myinfo =
  11. {
  12. name = "Blind Cow Event",
  13. author = "idank1NGz",
  14. description = "Blind Cow Event E",
  15. version = "1.00",
  16. url = ""
  17. }
  18.  
  19. /***********************
  20. * *
  21. * Global variables *
  22. * *
  23. ***********************/
  24.  
  25. /** ConVar handles **/
  26. Handle gH_BlindCow;
  27. Handle gP_Timer;
  28. char Seconds;
  29.  
  30. public void OnPluginStart()
  31. {
  32. /** ConVar handles **/
  33. CreateConVar("blindcow_enabled", "0", "Enable The Blind-Cow Event");
  34. gH_BlindCow = FindConVar("bilndcow_enabled");
  35. /** Command **/
  36. RegAdminCmd("sm_blindcow", Command_BlindCow, ADMFLAG_BAN, "Vote For Blind-Cow Event");
  37. RegAdminCmd("sm_bc", Command_BlindCow, ADMFLAG_BAN, "Vote For Blind-Cow Event");
  38. /** Hook Events **/
  39. HookEvent("round_start", Event_OnRoundStart);
  40. HookEvent("round_end", Event_OnRoundEnd);
  41. HookEvent("player_death", Event_OnPlayerDeath);
  42. }
  43.  
  44.  
  45. public int MenuHandler1(Menu menu, MenuAction action, int param1, int param2)
  46. {
  47. if (action == MenuAction_Select)
  48. {
  49. decl String:arg1[64];
  50. GetMenuItem(menu, param2, arg1, sizeof(arg1));
  51. if (StrEqual(arg1, "yes"))
  52. {
  53. BlindCow();
  54. }
  55. else if(StrEqual(arg1, "no"))
  56. SetConVarInt(FindConVar("sv_alltalk"), 0);
  57. ServerCommand("sm_cvar bilndcow_enabled 0");
  58. SetConVarInt(FindConVar("mp_forcecamera"), 1);
  59. SetConVarInt(FindConVar("mp_restartgame"), 1);
  60. SetConVarInt(FindConVar("sm_hosties_lr"), 0);
  61. }
  62. }
  63.  
  64. public Event_OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
  65. if (GetConVarInt(gH_BlindCow) == 1)
  66. {
  67. Seconds = 30;
  68. PrintHintTextToAll("Normal Vision in : %s", Seconds);
  69. gP_Timer = CreateTimer(1.0, cowtimer, TIMER_REPEAT);
  70. for (new i = 1; i <= MaxClients; i++)
  71. {
  72. if (IsValidClient(i) && (IsClientInGame(i) && CheckCommandAccess(i, "sm_ban", ADMFLAG_BAN)))
  73. {
  74. CS_SwitchTeam(i, CS_TEAM_CT);
  75. }
  76. }
  77. for (new i = 1; i <= MaxClients; i++)
  78. {
  79. if (IsValidClient(i) && (IsClientInGame(i) && CheckCommandAccess(i, "sm_ban", ADMFLAG_GENERIC)))
  80. {
  81. PrintToChat(i, "pstt teleport them to blind-cow place");
  82. PrintToChat(i, "pstt teleport them to blind-cow place");
  83. PrintToChat(i, "pstt teleport them to blind-cow place");
  84. }
  85. else if (GetClientTeam(i) == 2)
  86. {
  87. Blinded_Vision(i);
  88. }
  89. }
  90. }
  91.  
  92. public int MenuHandler2(Menu menu, MenuAction action, int param1,int param2)
  93. {
  94. if (action == MenuAction_End)
  95. {
  96. delete menu;
  97. } else if (action == MenuAction_VoteEnd) {
  98. if (param1 == 0)
  99. {
  100. char arg2[64];
  101. menu.GetItem(param1, arg2, sizeof(arg2));
  102. ServerCommand("sm_cvar bilndcow_enabled 1");
  103. SetConVarInt(FindConVar("mp_restartgame"), 1);
  104. SetConVarInt(FindConVar("sv_alltalk"), 0);
  105. SetConVarInt(FindConVar("mp_forcecamera"), 1);
  106. SetConVarInt(FindConVar("sm_hosties_lr"), 0);
  107.  
  108. }
  109. if (param1 == 1)
  110. {
  111. return;
  112. }
  113. }
  114. }
  115.  
  116. public Action:cowtimer(Handle timer, any:client)
  117. {
  118. if (GetConVarInt(gH_BlindCow) == 0)
  119. {
  120. return Plugin_Handled;
  121. }
  122. else if (GetConVarInt(gH_BlindCow) == 1)
  123. {
  124. if (Seconds == 0)
  125. {
  126. if (GetClientTeam(client) == 3)
  127. {
  128. Normal_Vision(client);
  129. }
  130. else if (GetClientTeam(client) == 2)
  131. {
  132. Normal_Vision(client);
  133. }
  134. for (new i = 1; i <= MaxClients; i++)
  135. {
  136. if(IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2)
  137. {
  138. GivePlayerItem(i, "weapon_ak47");
  139. GivePlayerItem(i, "weapon_glock");
  140. }
  141. }
  142. {
  143. KillTimer(gP_Timer);
  144. return Plugin_Stop;
  145. }
  146. }
  147. }
  148. return Action:3;
  149. }
  150.  
  151.  
  152.  
  153.  
  154. public Action Command_BlindCow(int client, int args)
  155. {
  156. Menu menu = new Menu(MenuHandler1);
  157. menu.SetTitle("Start BlindCow Vote?:");
  158. menu.AddItem("yes", "Yes");
  159. menu.AddItem("no", "No");
  160. menu.ExitButton = false;
  161. menu.Display(client, 20);
  162.  
  163. return Plugin_Handled;
  164. }
  165.  
  166. void BlindCow()
  167. {
  168. Menu menu = new Menu(MenuHandler2);
  169. menu.SetTitle("Start Blindcow Event ?");
  170. menu.AddItem("yes", "Yes");
  171. menu.AddItem("no", "No");
  172. menu.ExitButton = false;
  173. menu.DisplayVoteToAll(20);
  174. }
  175.  
  176.  
  177. stock Blinded_Vision(const any:client)
  178. {
  179. if(IsValidClient(client))
  180. {
  181. new Handle:message = StartMessageOne("Fade", client, 1);
  182. BfWriteShort(message, 1536);
  183. BfWriteShort(message, 1536);
  184. BfWriteShort(message, (0x0002 | 0x0008));
  185. BfWriteByte(message, 0); //fade red
  186. BfWriteByte(message, 0); //fade green
  187. BfWriteByte(message, 0); //fade blue
  188. BfWriteByte(message, 255); //fade alpha
  189. EndMessage();
  190. }
  191. }
  192.  
  193. stock Normal_Vision(const any:client)
  194. {
  195. if(IsValidClient(client))
  196. {
  197. new Handle:message = StartMessageOne("Fade", client, 1);
  198. BfWriteShort(message, 1536);
  199. BfWriteShort(message, 1536);
  200. BfWriteShort(message, (0x0001 | 0x0010));
  201. BfWriteByte(message, 0); //fade red
  202. BfWriteByte(message, 0); //fade green
  203. BfWriteByte(message, 0); //fade blue
  204. BfWriteByte(message, 0); //fade alpha
  205. EndMessage();
  206. }
  207. }
  208.  
  209.  
  210. public IsValidClient( client )
  211. {
  212. if ( !( 1 <= client <= MaxClients ) || !IsClientInGame(client) )
  213. return false;
  214.  
  215. return true;
  216. }
  217.  
  218. public Action Event_OnRoundEnd(Handle event, const String:name[], bool dontBroadcast)
  219. {
  220. if (GetConVarInt(gH_BlindCow) == 1)
  221. {
  222. if(gP_Timer != INVALID_HANDLE)
  223. {
  224. KillTimer(gP_Timer);
  225. gP_Timer = INVALID_HANDLE;
  226. }
  227. }
  228. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement