Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Copyright (C) 2019 Mesharsky
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /*================ Aktualizacje ================
- ~ Wersja "0.1" >> Pierwsze wydanie pluginu.
- ~ Wersja "0.2" >> Przepisanie pluginy na nowy syntax.
- ~ Wersja "0.3" >> Poprawiono wiÄkszoĹÄ kodu, pieniÄ dze za rozbrojenie oraz podĹoĹźenie bomby juĹź dziaĹajÄ .
- ~ Wersja "0.4" >> Dodano cvary.
- ~ Wersja "0.5" >> Dodano wiÄcej cvarĂłw oraz poprawiono kilka bĹÄdĂłw.
- ~ Wersja "0.6" >> Naprawiono bĹÄ d ktĂłry powodowaĹ Ĺźe menu broni dla vip'a wyĹwietlaĹo siÄ przy starcie rundy jak siÄ zmieniaĹy druĹźyny, dodano wiÄcej cvarĂłw.
- ~ Wersja "0.7" >> Dodano pieniÄ dze za wygranie rundy, poprawiono kod na zakoĹczenie rundy.
- ~ Wersja "0.8" >> Dodano przywitanie/poĹźegnanie dla vip'a na czacie oraz w HINT BOX, dodano wiÄcej cvarĂłw oraz poprawiono kod. // USUNIÄTE
- ~ Wersja "0.9" >> Dodano tag [VIP] w cvarach.
- ~ Wersja "1.0" >> Zmieniono kolor wiadomoĹci na czacie, dodano cvar dotyczÄ cy dziaĹaniu podwĂłjnego skoku.
- ~ Wersja "1.1" >> Dodano nowy cvar oraz poprawiono kod na podwĂłjny skok.
- ~ Wersja "1.2" >> Teraz granaty nie spadajÄ na ziemie przy nowej rundzie.
- ~ Wersja "1.3" >> Dodano darmowego vip'a od do danej godziny.
- ~ Wersja "1.4" >> Poprawki i sporo nowych rzeczy.
- TODO
- ~ ZjeĹÄ coĹ i dupnÄ Ä monsterka.
- ~ Uga buga
- ~ Buga uga
- ==============================================*/
- /* << Includy >> */
- #include <cstrike>
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- /* << Define >> */
- #define NAZWA_PLUGINU "[CSGO] Zaawansowany system VIP na serwery CSGO"
- #define OPIS_PLUGINU "[CSGO] Zaawansowany system VIP na serwery CSGO"
- #define AUTOR_PLUGINU "Mesharsky"
- #define WERSJA_PLUGINU "1.4"
- #define VIP_PREFIX " â \x02[VIP]\x04"
- /* << Pragma >> */
- #pragma newdecls required
- #pragma semicolon 1
- /* << Macro >> */
- #define LoopClients(%1) for(int %1 = 1; %1 <= MaxClients; %1++)\
- if(IsClientInGame(%1))
- /* << ConVary >> */
- ConVar g_cvWiadomosciChat;
- ConVar g_cvVipyOnline;
- ConVar g_cvPrzywitanieVip;
- ConVar g_cvPozegnanieVip;
- ConVar g_cvVipPisanieWHud;
- ConVar g_cvVipHP;
- ConVar g_cvMaxHP;
- ConVar g_cvVipHeadShotHP;
- ConVar g_cvVipKillHP;
- ConVar g_cvPredkoscGracza;
- ConVar g_cvGrawitacja;
- ConVar g_cvVipArmor;
- ConVar g_cvVipHelm;
- ConVar g_cvGranatyRunda;
- ConVar g_cvHEGranat;
- ConVar g_cvFlashGranat;
- ConVar g_cvSmokeGranat;
- ConVar g_cvDecoyGranat;
- ConVar g_cvHealGranat;
- ConVar g_cvIncGranat;
- ConVar g_cvMolotovGranat;
- ConVar g_cvTaGranat;
- ConVar g_cvVipPieniadzeNaStart;
- ConVar g_cvVipPieniadzePodlozenie;
- ConVar g_cvVipPieniadzeRozbrojenie;
- ConVar g_cvVipHeadShotPieniadze;
- ConVar g_cvVipKillPieniadze;
- ConVar g_cvVipKillKnifePieniadze;
- ConVar g_cvVipWygranaPieniadze;
- ConVar g_cvTagTabela;
- ConVar g_cvVipTagTabela;
- ConVar g_cvPodwojnySkok;
- ConVar g_cvMenuBroni;
- ConVar g_cvRundaMenuBroni;
- ConVar g_cvDarmowyVip;
- ConVar g_cvVipOdGodziny;
- ConVar g_cvVipDoGodziny;
- /* << Inty >> */
- int LiczbaRund = 0;
- int DarmowyVip = 0;
- int g_iaGrenadeOffsets[] = { 15, 17, 16, 14, 18, 17 };
- /* << Boole >> */
- bool g_bWiadomoscHud[MAXPLAYERS+1];
- /* << Informacje o pluginie >> */
- public Plugin myinfo =
- {
- name = NAZWA_PLUGINU,
- author = AUTOR_PLUGINU,
- description = OPIS_PLUGINU,
- version = WERSJA_PLUGINU,
- url = "http://steamcommunity.com/id/MesharskyH2K"
- }
- public void OnPluginStart()
- {
- HookEvent("round_start", Event_RoundStart);
- HookEvent("player_spawn", Event_TagTable);
- HookEvent("player_spawn", Event_PlayerSpawn);
- HookEvent("player_death", Event_PlayerDeath);
- HookEvent("bomb_planted", Event_BombPlanted);
- HookEvent("bomb_defused", Event_BombDefused);
- HookEvent("round_end", Event_RoundEnd);
- HookEvent("announce_phase_end", ResetPoZmianie);
- HookEvent("cs_intermission", ResetPoZmianie);
- RegConsoleCmd("sm_vips", PokazVipyOnline);
- RegConsoleCmd("sm_vipy", PokazVipyOnline);
- RegConsoleCmd("sm_vipsay", Komenda_Hud);
- /* << ConVary >> */
- g_cvWiadomosciChat = CreateConVar("vip_wiadomosci_chat", "1", "Czy pokazywaÄ róşne wiadomoĹci na chacie np za zabicie.");
- g_cvVipyOnline = CreateConVar("vip_vipy_online", "1", "Czy wĹÄ czyÄ funkcje Vipy Online?");
- g_cvPrzywitanieVip = CreateConVar("vip_przywitanie", "1", "Czy wĹÄ czyÄ przywitanie Vipa?");
- g_cvPozegnanieVip = CreateConVar("vip_pozegnanie", "1", "Czy wĹÄ czyÄ poĹźegnanie Vipa");
- g_cvVipPisanieWHud = CreateConVar("vip_hud_message", "1", "Czy pozwoliÄ vipowi na pisanie w HUD?");
- g_cvVipHP = CreateConVar("zycie_vip", "105", "Ile zdrowia ma posiadaÄ vip na start rundy?");
- g_cvMaxHP = CreateConVar("zycie_max_vip", "130", "Maksymalna iloĹÄ zdrowia jakÄ gracz moĹźe osiÄ gnÄ Ä?");
- g_cvVipKillHP = CreateConVar("kill_hp_vip", "5", "Ile zdrowia ma dostawaÄ vip za zabicie gracza?");
- g_cvVipHeadShotHP = CreateConVar("hs_hp_vip", "10", "Ile zdrowia ma dostawaÄ vip za zabĂłjstwo z HeadShot'a");
- g_cvPredkoscGracza = CreateConVar("vip_predkosc_ruchu", "1.0", "PrÄdkoĹÄ ruchu vip'a (1.0 - standardowo)");
- g_cvGrawitacja = CreateConVar("vip_grawitacja", "1.0", "Grawitacja dla vip'a (1.0 - standardowo)");
- g_cvVipArmor = CreateConVar("armor_vip", "100", "Punkty kamizelki dla vipa? (od 1 - 100)");
- g_cvVipHelm = CreateConVar("helm_vip", "1", "Czy vip ma posiadaÄ darmowy heĹm? (0/1)");
- g_cvVipPieniadzeNaStart = CreateConVar("vip_dodatkowe_Pieniadze", "0", "IloĹÄ dodatkowego Pieniadzeu na start rundy jaki ma vip dostawaÄ.");
- g_cvVipKillPieniadze = CreateConVar("pieniadze_kill_vip", "200", "Ile vip ma dostawaÄ pieniÄdzy za zabĂłjstwo ?");
- g_cvVipKillKnifePieniadze = CreateConVar("pieniadze_kill_knife_vip", "200", "Ile vip ma dostawaÄ pieniÄdzy za zabĂłjstwo z noĹźa ?");
- g_cvVipHeadShotPieniadze = CreateConVar("pieniadze_hs_vip", "500", "Ile vip ma dostawaÄ pieniÄdzy za zabĂłjstwo w gĹowÄ?");
- g_cvVipPieniadzePodlozenie = CreateConVar("pieniadze_podlozenie_vip", "1000", "Ile Pieniadzeu ma dostawaÄ vip za podĹoĹźenie bomby?");
- g_cvVipPieniadzeRozbrojenie = CreateConVar("pieniadze_rozbrojenie_vip", "1000", "Ile Pieniadzeu ma dostawaÄ vip za rozbrojenie bomby?");
- g_cvVipWygranaPieniadze = CreateConVar("pieniadze_wygranie_rundy", "500", "Ile Pieniadzeu ma dostawaÄ vip za wygranie rundy?");
- g_cvGranatyRunda = CreateConVar("vip_nades_round", "1", "Od ktĂłrej rundy ma przyznawaÄ darmowe granaty vipowi?");
- g_cvHEGranat = CreateConVar("vip_he", "1", "Czy vip ma dostawaÄ granat HE na start rundy?");
- g_cvFlashGranat = CreateConVar("vip_flash", "1", "Czy vip ma dostawaÄ granat Flash na start rundy?");
- g_cvSmokeGranat = CreateConVar("vip_smoke", "1", "Czy vip ma dostawaÄ granat Smoke na start rundy?");
- g_cvDecoyGranat = CreateConVar("vip_decoy", "0", "Czy vip ma dostawaÄ granat Decoy na start rundy?");
- g_cvHealGranat = CreateConVar("vip_heal", "0", "Czy vip ma dostawaÄ granat LeczÄ cy na start rundy?");
- g_cvIncGranat = CreateConVar("vip_inc", "0", "Czy vip ma dostawaÄ granat PodpalajÄ cy (CT) na start rundy?");
- g_cvMolotovGranat = CreateConVar("vip_molotov", "0", "Czy vip ma dostawaÄ granat PodpalajÄ cy (TT) na start rundy?");
- g_cvTaGranat = CreateConVar("vip_tactic", "0", "Czy vip ma dostawaÄ granat Taktyczny na start rundy?");
- g_cvTagTabela = CreateConVar("vip_tag", "0", "Czy w tabeli ma widniec tag dla vip'a?");
- g_cvVipTagTabela = CreateConVar("sm_clantag", "[VIP]", "Jaki tag w tabeli ma posiadaÄ VIP?");
- g_cvPodwojnySkok = CreateConVar("double_jump", "1", "Czy vip ma posiadaÄ podwĂłjny skok?");
- g_cvMenuBroni = CreateConVar("vip_menu_broni", "1", "Czy ma byÄ menu broni dla vip'a?");
- g_cvRundaMenuBroni = CreateConVar("vip_runda_menubroni", "3", "Od ktorej rundy ma pokazywac menu broni dla vip'a?");
- g_cvDarmowyVip = CreateConVar("vip_od_danej_godzint", "1", "Czy ma byÄ wĹÄ czony VIP dla graczy w nocy od x do x godziny?");
- g_cvVipOdGodziny = CreateConVar("vip_od_godziny", "24", "Od ktorej godziny ma byc darmowy vip?");
- g_cvVipDoGodziny = CreateConVar("vip_do_godziny", "6", "Do ktorej godziny ma byc darmowy vip?");
- AutoExecConfig(true, "H2K_Vip_conf");
- }
- public void OnMapStart()
- {
- LiczbaRund = 0;
- }
- public void OnClientPutInServer(int client)
- {
- g_bWiadomoscHud[client] = true;
- }
- public void OnClientPostAdminCheck(int client)
- {
- if (GetConVarBool(g_cvPrzywitanieVip))
- {
- if (IsPlayerVIP(client))
- {
- PrintToChatAll("ââââââââââââââââââââââââââââââââââââââââââ");
- PrintToChatAll("%s %N doĹÄ czyĹ do gry", VIP_PREFIX, client);
- PrintToChatAll("ââââââââââââââââââââââââââââââââââââââââââ");
- }
- }
- }
- public void OnClientDisconnect(int client)
- {
- if (GetConVarBool(g_cvPozegnanieVip))
- {
- if (IsPlayerVIP(client))
- {
- PrintToChatAll("ââââââââââââââââââââââââââââââââââââââââââ");
- PrintToChatAll("%s %N wyszedĹ z gry", VIP_PREFIX, client);
- PrintToChatAll("ââââââââââââââââââââââââââââââââââââââââââ");
- }
- }
- }
- public Action Komenda_Hud(int client, int args)
- {
- if (!g_cvVipPisanieWHud.BoolValue)
- {
- PrintToChat(client, "Ta funkcja zostaĹa wyĹÄ czona przez administratora serwera");
- return Plugin_Handled;
- }
- if (!IsPlayerVIP(client))
- {
- PrintToChat(client, "Tylko vip moĹźe uĹźyÄ tej komendy");
- return Plugin_Handled;
- }
- if (args < 1)
- {
- ReplyToCommand(client, "[SM] UĹźycie: sm_hudsay <tekst>");
- return Plugin_Handled;
- }
- char text[192];
- GetCmdArgString(text, sizeof(text));
- for (int i = 1; i <= MaxClients; i++)
- {
- if (IsClientInGame(i) && !IsFakeClient(i))
- {
- SetHudTextParams(0.35, 0.225, 10.0, 0, 255, 0, 1, 0, 2.5, 2.0); //Tutaj se edytujemy tak o beka.
- ShowHudText(i, 5, "VIP: %N napisaĹ:\n%s", client, text);
- }
- }
- g_bWiadomoscHud[client] = false;
- CreateTimer(120.0, Timer_EnableMessage, client);
- return Plugin_Handled;
- }
- public Action Timer_EnableMessage(Handle timer, any client)
- {
- if(client)
- g_bWiadomoscHud[client] = true;
- }
- public Action MenuGlowne(int client)
- {
- if (IsValidClient(client)) {
- if (IsPlayerVIP(client)) {
- Menu menu = new Menu(MenuHandler1);
- menu.SetTitle("VIP : Wybierz BroĹ");
- menu.AddItem("weapon_ak47", "AK-47");
- menu.AddItem("weapon_m4a1", "M4A4");
- menu.AddItem("weapon_m4a1_silencer", "M4A1-S");
- menu.AddItem("weapon_awp", "AWP");
- menu.AddItem("weapon_ssg08", "SCOUT");
- menu.AddItem("weapon_xm1014", "XM1014");
- menu.AddItem("weapon_famas", "FAMAS");
- menu.ExitButton = true;
- menu.Display(client, 15);
- }
- }
- }
- public int MenuHandler1(Menu menu, MenuAction action, int client, int itemNum)
- {
- if (action == MenuAction_Select)
- {
- char info[32];
- GetMenuItem(menu, itemNum, info, sizeof(info));
- if (IsPlayerAlive(client))
- {
- StripAllWeapons(client);
- GivePlayerItem(client, "weapon_knife");
- GivePlayerItem(client, info);
- MenuBroni(client);
- }
- }
- else if (action == MenuAction_End) {
- CloseHandle(menu);
- }
- }
- public Action MenuBroni(int client)
- {
- if (IsValidClient(client)) {
- if (IsPlayerVIP(client)) {
- Menu menusec = new Menu(MenuHandler2);
- menusec.SetTitle("VIP : Wybierz Pistolet");
- menusec.AddItem("weapon_deagle", "Deagle");
- menusec.AddItem("weapon_revolver", "R8 Revolver");
- menusec.AddItem("weapon_fiveseven", "Five-Seven");
- menusec.AddItem("weapon_tec9", "Tec-9");
- menusec.AddItem("weapon_cz75a", "CZ7a");
- menusec.AddItem("weapon_elite", "Dual Elites");
- menusec.AddItem("weapon_p250", "p250");
- menusec.ExitButton = true;
- menusec.Display(client, 15);
- }
- }
- }
- public int MenuHandler2(Menu menusec, MenuAction action, int client, int itemNum)
- {
- if (action == MenuAction_Select)
- {
- char info[32];
- GetMenuItem(menusec, itemNum, info, sizeof(info));
- if (IsPlayerAlive(client)) {
- GivePlayerItem(client, info);
- }
- }
- else if (action == MenuAction_End) {
- CloseHandle(menusec);
- }
- }
- public Action Event_RoundStart(Handle hEvent, const char[] chName, bool bDontBroadcast)
- {
- if (GetConVarBool(g_cvDarmowyVip))
- {
- int od_godziny = GetConVarInt(g_cvVipOdGodziny);
- int do_godziny = GetConVarInt(g_cvVipDoGodziny);
- if(od_godziny || do_godziny)
- {
- char godzina_str[8];
- FormatTime(godzina_str, sizeof(godzina_str), "%H", GetTime());
- int godzina = StringToInt(godzina_str);
- if(od_godziny > do_godziny)
- DarmowyVip = (godzina >= od_godziny || godzina < do_godziny)? 1: 0;
- else
- DarmowyVip = (godzina >= od_godziny && godzina < do_godziny)? 1: 0;
- }
- else
- DarmowyVip = 0;
- }
- if (GameRules_GetProp("m_bWarmupPeriod") != 1)
- LiczbaRund = LiczbaRund + 1;
- }
- public Action ResetPoZmianie(Handle hEvent, const char[] chName, bool bDontBroadcast)
- {
- LiczbaRund = 0;
- }
- public Action Event_PlayerSpawn(Handle hEvent, const char[] chName, bool bDontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
- if (GameRules_GetProp("m_bWarmupPeriod") == 1)
- return;
- if (IsPlayerVIP(client))
- {
- SetEntityHealth(client, GetConVarInt(g_cvVipHP));
- if(LiczbaRund > 1)
- {
- SetEntProp(client, Prop_Send, "m_ArmorValue", GetConVarInt(g_cvVipArmor));
- SetEntProp(client, Prop_Send, "m_bHasHelmet", GetConVarInt(g_cvVipHelm));
- }
- else
- SetEntProp(client, Prop_Send, "m_ArmorValue", GetConVarInt(g_cvVipArmor));
- SetEntProp(client, Prop_Send, "m_iAccount", GetEntProp(client, Prop_Send, "m_iAccount") + GetConVarInt(g_cvVipPieniadzeNaStart));
- SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", GetConVarFloat(g_cvPredkoscGracza));
- SetEntityGravity(client, GetConVarFloat(g_cvGrawitacja));
- if (GetClientTeam(client) == CS_TEAM_CT && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0)GivePlayerItem(client, "item_defuser");
- if (LiczbaRund >= GetConVarInt(g_cvGranatyRunda))
- {
- if (GetConVarBool(g_cvHEGranat))GivePlayerItem(client, "weapon_hegrenade");
- if (GetConVarBool(g_cvFlashGranat))GivePlayerItem(client, "weapon_flashbang");
- if (GetConVarBool(g_cvSmokeGranat))GivePlayerItem(client, "weapon_smokegrenade");
- if (GetConVarBool(g_cvDecoyGranat))GivePlayerItem(client, "weapon_decoy");
- if (GetConVarBool(g_cvHealGranat))GivePlayerItem(client, "weapon_healthshot");
- if (GetConVarBool(g_cvIncGranat))GivePlayerItem(client, "weapon_incgrenade");
- if (GetClientTeam(client) == CS_TEAM_CT)
- {
- if (GetConVarBool(g_cvMolotovGranat))GivePlayerItem(client, "weapon_molotov");
- }
- if (GetConVarBool(g_cvTaGranat))GivePlayerItem(client, "weapon_tagrenade");
- }
- }
- if (GetConVarBool(g_cvMenuBroni))
- {
- if (LiczbaRund >= GetConVarInt(g_cvRundaMenuBroni))
- {
- MenuGlowne(client);
- }
- }
- }
- public Action Event_PlayerDeath(Event hEvent, const char[] chName, bool bDontBroadcast)
- {
- int attacker = GetClientOfUserId(hEvent.GetInt("attacker"));
- int victim = GetClientOfUserId(hEvent.GetInt("userid"));
- char weapon[64];
- GetEventString(hEvent, "weapon", weapon, sizeof(weapon));
- ReplaceString(weapon, sizeof(weapon), "weapon_", "");
- if (StrEqual(weapon, "knife_default_ct") || StrEqual(weapon, "knife_default_t") || StrEqual(weapon, "knife_t") || StrEqual(weapon, "knifegg") || StrEqual(weapon, "knife_flip") || StrEqual(weapon, "knife_gut") || StrEqual(weapon, "knife_karambit") || StrEqual(weapon, "bayonet") || StrEqual(weapon, "knife_m9_bayonet") || StrEqual(weapon, "knife_butterfly") || StrEqual(weapon, "knife_tactical") || StrEqual(weapon, "knife_falchion") || StrEqual(weapon, "knife_push") || StrEqual(weapon, "knife_survival_bowie")) {
- weapon = "knife";
- }
- if (IsPlayerVIP(attacker))
- {
- if (!IsValidClient(attacker)) {
- return;
- }
- if (GetClientTeam(attacker) != GetClientTeam(victim))
- {
- bool headshot = GetEventBool(hEvent, "headshot");
- int PieniadzeGracza = GetEntProp(attacker, Prop_Send, "m_iAccount");
- int HP = GetClientHealth(attacker);
- if (headshot)
- {
- SetEntProp(attacker, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipHeadShotPieniadze) + PieniadzeGracza);
- if (HP + GetConVarInt(g_cvVipHeadShotHP) > GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, GetConVarInt(g_cvMaxHP));
- if (HP + GetConVarInt(g_cvVipHeadShotHP) <= GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, HP + GetConVarInt(g_cvVipHeadShotHP));
- }
- else
- {
- SetEntProp(attacker, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipKillPieniadze) + PieniadzeGracza);
- if (HP + GetConVarInt(g_cvVipKillHP) > GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, GetConVarInt(g_cvMaxHP));
- if (HP + GetConVarInt(g_cvVipKillHP) <= GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, HP + GetConVarInt(g_cvVipKillHP));
- }
- if (StrEqual(weapon, "knife"))
- {
- SetEntProp(attacker, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipKillKnifePieniadze) + PieniadzeGracza);
- if (GetConVarBool(g_cvWiadomosciChat))
- {
- PrintToChat(attacker, "%s Jako VIP otrzymaĹeĹ %i punktĂłw za zabĂłjstwo z noĹźa", VIP_PREFIX);
- }
- }
- }
- }
- }
- public Action Event_BombPlanted(Event hEvent, const char[] chName, bool bDontBroadcast)
- {
- int client = GetClientOfUserId(hEvent.GetInt("userid"));
- int PieniadzeGracza = GetEntProp(client, Prop_Send, "m_iAccount");
- if (IsPlayerVIP(client)) {
- if (GetConVarBool(g_cvWiadomosciChat))
- {
- PrintToChat(client, "%s WĹasnie otrzymaĹeĹ %i pieniÄ ĹźkĂłw za podĹoĹźenie bomby!", VIP_PREFIX, GetConVarInt(g_cvVipPieniadzePodlozenie));
- }
- SetEntProp(client, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipPieniadzePodlozenie) + PieniadzeGracza);
- }
- }
- public Action Event_BombDefused(Handle hEvent, const char[] chName, bool bDontBroadcast)
- {
- int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
- int PieniadzeGracza = GetEntProp(client, Prop_Send, "m_iAccount");
- if (IsPlayerVIP(client))
- {
- if (GetConVarBool(g_cvWiadomosciChat))
- {
- PrintToChat(client, "%s WĹasnie otrzymaĹeĹ %i pieniÄ ĹźkĂłw za rozbrojenie bomby!", VIP_PREFIX, GetConVarInt(g_cvVipPieniadzeRozbrojenie));
- }
- SetEntProp(client, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipPieniadzeRozbrojenie) + PieniadzeGracza);
- }
- }
- public Action Event_RoundEnd(Event hEvent, const char[] chName, bool bDontBroadcast)
- {
- int WygranaDruzyna = GetEventInt(hEvent, "winner");
- for (int client = 1; client < MAXPLAYERS + 1; client++)
- {
- if (IsPlayerVIP(client) && IsValidClient(client))
- {
- RemoveNades(client);
- if (GetClientTeam(client) == WygranaDruzyna)
- {
- SetEntProp(client, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipWygranaPieniadze) + GetEntProp(client, Prop_Send, "m_iAccount"));
- }
- }
- }
- }
- public Action Event_TagTable(Event hEvent, const char[] chName, bool bDontBroadcast)
- {
- int client = GetClientOfUserId(hEvent.GetInt("userid"));
- char TagTabela[128];
- g_cvVipTagTabela.GetString(TagTabela, sizeof(TagTabela));
- if (IsPlayerVIP(client))
- {
- if (GetConVarBool(g_cvTagTabela))CS_SetClientClanTag(client, TagTabela);
- }
- }
- public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
- {
- if (!g_cvPodwojnySkok.BoolValue)
- return Plugin_Handled;
- if (IsPlayerVIP(client) && IsPlayerAlive(client))
- {
- static int g_fLastButtons[MAXPLAYERS + 1], g_fLastFlags[MAXPLAYERS + 1], g_iJumps[MAXPLAYERS + 1], fCurFlags, fCurButtons;
- fCurFlags = GetEntityFlags(client);
- fCurButtons = GetClientButtons(client);
- if (g_fLastFlags[client] & FL_ONGROUND && !(fCurFlags & FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)g_iJumps[client]++;
- else if (fCurFlags & FL_ONGROUND)g_iJumps[client] = 0;
- else if (!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP && g_iJumps[client] == 1)
- {
- g_iJumps[client]++;
- float vVel[3];
- GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
- vVel[2] = 250.0;
- TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel);
- }
- g_fLastFlags[client] = fCurFlags;
- g_fLastButtons[client] = fCurButtons;
- }
- return Plugin_Continue;
- }
- public Action PokazVipyOnline(int client, int args)
- {
- if (!g_cvVipyOnline.BoolValue)
- {
- PrintToChat(client, "Ta funkcja zostaĹa wyĹÄ czona przez administratora serwera");
- return Plugin_Handled;
- }
- int iCount = 0;
- Menu menu = new Menu(Menu_Handler);
- menu.SetTitle("Gracze VIP ktĂłrzy aktualnie znajdujÄ siÄ na serwerze");
- for (int i = 1; i < MaxClients; i++)
- {
- if (IsPlayerVIP(i) && IsValidClient(i) && IsClientInGame(i))
- {
- char format[128];
- char cid[16];
- IntToString(i, cid, sizeof cid);
- char name[MAX_NAME_LENGTH + 1];
- GetClientName(i, name, sizeof name);
- Format(format, sizeof format, "[VIP] Âť %s", name);
- menu.AddItem(cid, format, ITEMDRAW_DISABLED);
- iCount++;
- }
- }
- if(iCount == 0)
- menu.AddItem("ITEMDRAW_DISABLED", "Ups, wyglÄ da na to, Ĺźe nie ma graczy online, ktĂłrzy posiadajÄ usĹugÄ VIP.");
- menu.ExitButton = true;
- menu.Display(client, 0);
- return Plugin_Handled;
- }
- public int Menu_Handler(Menu menu, MenuAction action, int client, int itemNum)
- {
- if (action == MenuAction_End)CloseHandle(menu);
- }
- stock void StripAllWeapons(int client)
- {
- int iEnt;
- for (int i = 0; i <= 2; i++)
- {
- while ((iEnt = GetPlayerWeaponSlot(client, i)) != -1)
- {
- RemovePlayerItem(client, iEnt);
- AcceptEntityInput(iEnt, "Kill");
- }
- }
- }
- stock void RemoveNades(int client)
- {
- while (RemoveWeaponBySlot(client, 3)) { }
- for (int i = 0; i < 6; i++)
- SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, g_iaGrenadeOffsets[i]);
- }
- stock bool RemoveWeaponBySlot(int client, int iSlot)
- {
- int iEntity = GetPlayerWeaponSlot(client, iSlot);
- if (IsValidEdict(iEntity)) {
- RemovePlayerItem(client, iEntity);
- AcceptEntityInput(iEntity, "Kill");
- return true;
- }
- return false;
- }
- bool IsPlayerVIP(int client)
- {
- if (CheckCommandAccess(client, "sm_Vip", 0, true) || DarmowyVip)
- return true;
- return false;
- }
- bool IsValidClient(int client)
- {
- if (client <= 0 || client > MaxClients) {
- return false;
- }
- if (!IsClientInGame(client)) {
- return false;
- }
- if (IsFakeClient(client)) {
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement