Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #include <cstrike>
- #include <sdktools>
- #include <clientprefs>
- #include <smlib>
- #undef REQUIRE_PLUGIN
- public Plugin:myinfo =
- {
- name = "Blind Cow Event",
- author = "idank1NGz",
- description = "Blind Cow Event E",
- version = "1.00",
- url = ""
- }
- /***********************
- * *
- * Global variables *
- * *
- ***********************/
- /** ConVar handles **/
- Handle gH_BlindCow;
- Handle gP_Timer;
- char Seconds;
- public void OnPluginStart()
- {
- /** ConVar handles **/
- CreateConVar("blindcow_enabled", "0", "Enable The Blind-Cow Event");
- gH_BlindCow = FindConVar("bilndcow_enabled");
- /** Command **/
- RegAdminCmd("sm_blindcow", Command_BlindCow, ADMFLAG_BAN, "Vote For Blind-Cow Event");
- RegAdminCmd("sm_bc", Command_BlindCow, ADMFLAG_BAN, "Vote For Blind-Cow Event");
- /** Hook Events **/
- HookEvent("round_start", Event_OnRoundStart);
- HookEvent("round_end", Event_OnRoundEnd);
- HookEvent("player_death", Event_OnPlayerDeath);
- }
- public int MenuHandler1(Menu menu, MenuAction action, int param1, int param2)
- {
- if (action == MenuAction_Select)
- {
- decl String:arg1[64];
- GetMenuItem(menu, param2, arg1, sizeof(arg1));
- if (StrEqual(arg1, "yes"))
- {
- BlindCow();
- }
- else if(StrEqual(arg1, "no"))
- SetConVarInt(FindConVar("sv_alltalk"), 0);
- ServerCommand("sm_cvar bilndcow_enabled 0");
- SetConVarInt(FindConVar("mp_forcecamera"), 1);
- SetConVarInt(FindConVar("mp_restartgame"), 1);
- SetConVarInt(FindConVar("sm_hosties_lr"), 0);
- }
- }
- public Event_OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
- if (GetConVarInt(gH_BlindCow) == 1)
- {
- Seconds = 30;
- PrintHintTextToAll("Normal Vision in : %s", Seconds);
- gP_Timer = CreateTimer(1.0, cowtimer, TIMER_REPEAT);
- for (new i = 1; i <= MaxClients; i++)
- {
- if (IsValidClient(i) && (IsClientInGame(i) && CheckCommandAccess(i, "sm_ban", ADMFLAG_BAN)))
- {
- CS_SwitchTeam(i, CS_TEAM_CT);
- }
- }
- for (new i = 1; i <= MaxClients; i++)
- {
- if (IsValidClient(i) && (IsClientInGame(i) && CheckCommandAccess(i, "sm_ban", ADMFLAG_GENERIC)))
- {
- PrintToChat(i, "pstt teleport them to blind-cow place");
- PrintToChat(i, "pstt teleport them to blind-cow place");
- PrintToChat(i, "pstt teleport them to blind-cow place");
- }
- else if (GetClientTeam(i) == 2)
- {
- Blinded_Vision(i);
- }
- }
- }
- public int MenuHandler2(Menu menu, MenuAction action, int param1,int param2)
- {
- if (action == MenuAction_End)
- {
- delete menu;
- } else if (action == MenuAction_VoteEnd) {
- if (param1 == 0)
- {
- char arg2[64];
- menu.GetItem(param1, arg2, sizeof(arg2));
- ServerCommand("sm_cvar bilndcow_enabled 1");
- SetConVarInt(FindConVar("mp_restartgame"), 1);
- SetConVarInt(FindConVar("sv_alltalk"), 0);
- SetConVarInt(FindConVar("mp_forcecamera"), 1);
- SetConVarInt(FindConVar("sm_hosties_lr"), 0);
- }
- if (param1 == 1)
- {
- return;
- }
- }
- }
- public Action:cowtimer(Handle timer, any:client)
- {
- if (GetConVarInt(gH_BlindCow) == 0)
- {
- return Plugin_Handled;
- }
- else if (GetConVarInt(gH_BlindCow) == 1)
- {
- if (Seconds == 0)
- {
- if (GetClientTeam(client) == 3)
- {
- Normal_Vision(client);
- }
- else if (GetClientTeam(client) == 2)
- {
- Normal_Vision(client);
- }
- for (new i = 1; i <= MaxClients; i++)
- {
- if(IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2)
- {
- GivePlayerItem(i, "weapon_ak47");
- GivePlayerItem(i, "weapon_glock");
- }
- }
- {
- KillTimer(gP_Timer);
- return Plugin_Stop;
- }
- }
- }
- return Action:3;
- }
- public Action Command_BlindCow(int client, int args)
- {
- Menu menu = new Menu(MenuHandler1);
- menu.SetTitle("Start BlindCow Vote?:");
- menu.AddItem("yes", "Yes");
- menu.AddItem("no", "No");
- menu.ExitButton = false;
- menu.Display(client, 20);
- return Plugin_Handled;
- }
- void BlindCow()
- {
- Menu menu = new Menu(MenuHandler2);
- menu.SetTitle("Start Blindcow Event ?");
- menu.AddItem("yes", "Yes");
- menu.AddItem("no", "No");
- menu.ExitButton = false;
- menu.DisplayVoteToAll(20);
- }
- stock Blinded_Vision(const any:client)
- {
- if(IsValidClient(client))
- {
- new Handle:message = StartMessageOne("Fade", client, 1);
- BfWriteShort(message, 1536);
- BfWriteShort(message, 1536);
- BfWriteShort(message, (0x0002 | 0x0008));
- BfWriteByte(message, 0); //fade red
- BfWriteByte(message, 0); //fade green
- BfWriteByte(message, 0); //fade blue
- BfWriteByte(message, 255); //fade alpha
- EndMessage();
- }
- }
- stock Normal_Vision(const any:client)
- {
- if(IsValidClient(client))
- {
- new Handle:message = StartMessageOne("Fade", client, 1);
- BfWriteShort(message, 1536);
- BfWriteShort(message, 1536);
- BfWriteShort(message, (0x0001 | 0x0010));
- BfWriteByte(message, 0); //fade red
- BfWriteByte(message, 0); //fade green
- BfWriteByte(message, 0); //fade blue
- BfWriteByte(message, 0); //fade alpha
- EndMessage();
- }
- }
- public IsValidClient( client )
- {
- if ( !( 1 <= client <= MaxClients ) || !IsClientInGame(client) )
- return false;
- return true;
- }
- public Action Event_OnRoundEnd(Handle event, const String:name[], bool dontBroadcast)
- {
- if (GetConVarInt(gH_BlindCow) == 1)
- {
- if(gP_Timer != INVALID_HANDLE)
- {
- KillTimer(gP_Timer);
- gP_Timer = INVALID_HANDLE;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement