Advertisement
supertimor

Untitled

Sep 17th, 2019
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.47 KB | None | 0 0
  1. /* Copyright (C) 2019 Mesharsky
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10.  
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14.  
  15. /*================ Aktualizacje ================
  16.  
  17. ~ Wersja "0.1" >> Pierwsze wydanie pluginu.
  18. ~ Wersja "0.2" >> Przepisanie pluginy na nowy syntax.
  19. ~ Wersja "0.3" >> Poprawiono większość kodu, pieniądze za rozbrojenie oraz podłożenie bomby już działają.
  20. ~ Wersja "0.4" >> Dodano cvary.
  21. ~ Wersja "0.5" >> Dodano więcej cvarów oraz poprawiono kilka błędów.
  22. ~ 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.
  23. ~ Wersja "0.7" >> Dodano pieniądze za wygranie rundy, poprawiono kod na zakończenie rundy.
  24. ~ 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
  25. ~ Wersja "0.9" >> Dodano tag [VIP] w cvarach.
  26. ~ Wersja "1.0" >> Zmieniono kolor wiadomości na czacie, dodano cvar dotyczący działaniu podwójnego skoku.
  27. ~ Wersja "1.1" >> Dodano nowy cvar oraz poprawiono kod na podwĂłjny skok.
  28. ~ Wersja "1.2" >> Teraz granaty nie spadają na ziemie przy nowej rundzie.
  29. ~ Wersja "1.3" >> Dodano darmowego vip'a od do danej godziny.
  30. ~ Wersja "1.4" >> Poprawki i sporo nowych rzeczy.
  31.  
  32. TODO
  33.  
  34. ~ Zjeść coś i dupnąć monsterka.
  35. ~ Uga buga
  36. ~ Buga uga
  37.  
  38. ==============================================*/
  39.  
  40. /* << Includy >> */
  41. #include <cstrike>
  42. #include <sourcemod>
  43. #include <sdktools>
  44. #include <sdkhooks>
  45.  
  46. /* << Define >> */
  47. #define NAZWA_PLUGINU "[CSGO] Zaawansowany system VIP na serwery CSGO"
  48. #define OPIS_PLUGINU "[CSGO] Zaawansowany system VIP na serwery CSGO"
  49. #define AUTOR_PLUGINU "Mesharsky"
  50. #define WERSJA_PLUGINU "1.4"
  51.  
  52. #define VIP_PREFIX " ★ \x02[VIP]\x04"
  53.  
  54. /* << Pragma >> */
  55. #pragma newdecls required
  56. #pragma semicolon 1
  57.  
  58. /* << Macro >> */
  59. #define LoopClients(%1) for(int %1 = 1; %1 <= MaxClients; %1++)\
  60. if(IsClientInGame(%1))
  61.  
  62. /* << ConVary >> */
  63. ConVar g_cvWiadomosciChat;
  64. ConVar g_cvVipyOnline;
  65. ConVar g_cvPrzywitanieVip;
  66. ConVar g_cvPozegnanieVip;
  67. ConVar g_cvVipPisanieWHud;
  68. ConVar g_cvVipHP;
  69. ConVar g_cvMaxHP;
  70. ConVar g_cvVipHeadShotHP;
  71. ConVar g_cvVipKillHP;
  72. ConVar g_cvPredkoscGracza;
  73. ConVar g_cvGrawitacja;
  74. ConVar g_cvVipArmor;
  75. ConVar g_cvVipHelm;
  76. ConVar g_cvGranatyRunda;
  77. ConVar g_cvHEGranat;
  78. ConVar g_cvFlashGranat;
  79. ConVar g_cvSmokeGranat;
  80. ConVar g_cvDecoyGranat;
  81. ConVar g_cvHealGranat;
  82. ConVar g_cvIncGranat;
  83. ConVar g_cvMolotovGranat;
  84. ConVar g_cvTaGranat;
  85. ConVar g_cvVipPieniadzeNaStart;
  86. ConVar g_cvVipPieniadzePodlozenie;
  87. ConVar g_cvVipPieniadzeRozbrojenie;
  88. ConVar g_cvVipHeadShotPieniadze;
  89. ConVar g_cvVipKillPieniadze;
  90. ConVar g_cvVipKillKnifePieniadze;
  91. ConVar g_cvVipWygranaPieniadze;
  92. ConVar g_cvTagTabela;
  93. ConVar g_cvVipTagTabela;
  94. ConVar g_cvPodwojnySkok;
  95. ConVar g_cvMenuBroni;
  96. ConVar g_cvRundaMenuBroni;
  97. ConVar g_cvDarmowyVip;
  98. ConVar g_cvVipOdGodziny;
  99. ConVar g_cvVipDoGodziny;
  100.  
  101. /* << Inty >> */
  102. int LiczbaRund = 0;
  103. int DarmowyVip = 0;
  104. int g_iaGrenadeOffsets[] = { 15, 17, 16, 14, 18, 17 };
  105.  
  106. /* << Boole >> */
  107. bool g_bWiadomoscHud[MAXPLAYERS+1];
  108.  
  109.  
  110. /* << Informacje o pluginie >> */
  111. public Plugin myinfo =
  112. {
  113. name = NAZWA_PLUGINU,
  114. author = AUTOR_PLUGINU,
  115. description = OPIS_PLUGINU,
  116. version = WERSJA_PLUGINU,
  117. url = "http://steamcommunity.com/id/MesharskyH2K"
  118. }
  119.  
  120. public void OnPluginStart()
  121. {
  122. HookEvent("round_start", Event_RoundStart);
  123. HookEvent("player_spawn", Event_TagTable);
  124. HookEvent("player_spawn", Event_PlayerSpawn);
  125. HookEvent("player_death", Event_PlayerDeath);
  126. HookEvent("bomb_planted", Event_BombPlanted);
  127. HookEvent("bomb_defused", Event_BombDefused);
  128. HookEvent("round_end", Event_RoundEnd);
  129. HookEvent("announce_phase_end", ResetPoZmianie);
  130. HookEvent("cs_intermission", ResetPoZmianie);
  131.  
  132. RegConsoleCmd("sm_vips", PokazVipyOnline);
  133. RegConsoleCmd("sm_vipy", PokazVipyOnline);
  134. RegConsoleCmd("sm_vipsay", Komenda_Hud);
  135.  
  136. /* << ConVary >> */
  137. g_cvWiadomosciChat = CreateConVar("vip_wiadomosci_chat", "1", "Czy pokazywać różne wiadomości na chacie np za zabicie.");
  138. g_cvVipyOnline = CreateConVar("vip_vipy_online", "1", "Czy włączyć funkcje Vipy Online?");
  139. g_cvPrzywitanieVip = CreateConVar("vip_przywitanie", "1", "Czy włączyć przywitanie Vipa?");
  140. g_cvPozegnanieVip = CreateConVar("vip_pozegnanie", "1", "Czy włączyć pożegnanie Vipa");
  141. g_cvVipPisanieWHud = CreateConVar("vip_hud_message", "1", "Czy pozwolić vipowi na pisanie w HUD?");
  142. g_cvVipHP = CreateConVar("zycie_vip", "105", "Ile zdrowia ma posiadać vip na start rundy?");
  143. g_cvMaxHP = CreateConVar("zycie_max_vip", "130", "Maksymalna ilość zdrowia jaką gracz może osiągnąć?");
  144. g_cvVipKillHP = CreateConVar("kill_hp_vip", "5", "Ile zdrowia ma dostawać vip za zabicie gracza?");
  145. g_cvVipHeadShotHP = CreateConVar("hs_hp_vip", "10", "Ile zdrowia ma dostawać vip za zabójstwo z HeadShot'a");
  146. g_cvPredkoscGracza = CreateConVar("vip_predkosc_ruchu", "1.0", "Prędkość ruchu vip'a (1.0 - standardowo)");
  147. g_cvGrawitacja = CreateConVar("vip_grawitacja", "1.0", "Grawitacja dla vip'a (1.0 - standardowo)");
  148. g_cvVipArmor = CreateConVar("armor_vip", "100", "Punkty kamizelki dla vipa? (od 1 - 100)");
  149. g_cvVipHelm = CreateConVar("helm_vip", "1", "Czy vip ma posiadać darmowy hełm? (0/1)");
  150. g_cvVipPieniadzeNaStart = CreateConVar("vip_dodatkowe_Pieniadze", "0", "Ilość dodatkowego Pieniadzeu na start rundy jaki ma vip dostawać.");
  151. g_cvVipKillPieniadze = CreateConVar("pieniadze_kill_vip", "200", "Ile vip ma dostawać pieniędzy za zabójstwo ?");
  152. g_cvVipKillKnifePieniadze = CreateConVar("pieniadze_kill_knife_vip", "200", "Ile vip ma dostawać pieniędzy za zabójstwo z noża ?");
  153. g_cvVipHeadShotPieniadze = CreateConVar("pieniadze_hs_vip", "500", "Ile vip ma dostawać pieniędzy za zabójstwo w głowę?");
  154. g_cvVipPieniadzePodlozenie = CreateConVar("pieniadze_podlozenie_vip", "1000", "Ile Pieniadzeu ma dostawać vip za podłożenie bomby?");
  155. g_cvVipPieniadzeRozbrojenie = CreateConVar("pieniadze_rozbrojenie_vip", "1000", "Ile Pieniadzeu ma dostawać vip za rozbrojenie bomby?");
  156. g_cvVipWygranaPieniadze = CreateConVar("pieniadze_wygranie_rundy", "500", "Ile Pieniadzeu ma dostawać vip za wygranie rundy?");
  157. g_cvGranatyRunda = CreateConVar("vip_nades_round", "1", "Od której rundy ma przyznawać darmowe granaty vipowi?");
  158. g_cvHEGranat = CreateConVar("vip_he", "1", "Czy vip ma dostawać granat HE na start rundy?");
  159. g_cvFlashGranat = CreateConVar("vip_flash", "1", "Czy vip ma dostawać granat Flash na start rundy?");
  160. g_cvSmokeGranat = CreateConVar("vip_smoke", "1", "Czy vip ma dostawać granat Smoke na start rundy?");
  161. g_cvDecoyGranat = CreateConVar("vip_decoy", "0", "Czy vip ma dostawać granat Decoy na start rundy?");
  162. g_cvHealGranat = CreateConVar("vip_heal", "0", "Czy vip ma dostawać granat Leczący na start rundy?");
  163. g_cvIncGranat = CreateConVar("vip_inc", "0", "Czy vip ma dostawać granat Podpalający (CT) na start rundy?");
  164. g_cvMolotovGranat = CreateConVar("vip_molotov", "0", "Czy vip ma dostawać granat Podpalający (TT) na start rundy?");
  165. g_cvTaGranat = CreateConVar("vip_tactic", "0", "Czy vip ma dostawać granat Taktyczny na start rundy?");
  166. g_cvTagTabela = CreateConVar("vip_tag", "0", "Czy w tabeli ma widniec tag dla vip'a?");
  167. g_cvVipTagTabela = CreateConVar("sm_clantag", "[VIP]", "Jaki tag w tabeli ma posiadać VIP?");
  168. g_cvPodwojnySkok = CreateConVar("double_jump", "1", "Czy vip ma posiadać podwójny skok?");
  169. g_cvMenuBroni = CreateConVar("vip_menu_broni", "1", "Czy ma być menu broni dla vip'a?");
  170. g_cvRundaMenuBroni = CreateConVar("vip_runda_menubroni", "3", "Od ktorej rundy ma pokazywac menu broni dla vip'a?");
  171. g_cvDarmowyVip = CreateConVar("vip_od_danej_godzint", "1", "Czy ma być włączony VIP dla graczy w nocy od x do x godziny?");
  172. g_cvVipOdGodziny = CreateConVar("vip_od_godziny", "24", "Od ktorej godziny ma byc darmowy vip?");
  173. g_cvVipDoGodziny = CreateConVar("vip_do_godziny", "6", "Do ktorej godziny ma byc darmowy vip?");
  174.  
  175.  
  176. AutoExecConfig(true, "H2K_Vip_conf");
  177. }
  178.  
  179. public void OnMapStart()
  180. {
  181. LiczbaRund = 0;
  182. }
  183.  
  184. public void OnClientPutInServer(int client)
  185. {
  186. g_bWiadomoscHud[client] = true;
  187. }
  188.  
  189. public void OnClientPostAdminCheck(int client)
  190. {
  191. if (GetConVarBool(g_cvPrzywitanieVip))
  192. {
  193. if (IsPlayerVIP(client))
  194. {
  195. PrintToChatAll("╔════════════════════════════════════════╗");
  196. PrintToChatAll("%s %N dołączył do gry", VIP_PREFIX, client);
  197. PrintToChatAll("╚════════════════════════════════════════╝");
  198. }
  199. }
  200. }
  201.  
  202. public void OnClientDisconnect(int client)
  203. {
  204. if (GetConVarBool(g_cvPozegnanieVip))
  205. {
  206. if (IsPlayerVIP(client))
  207. {
  208. PrintToChatAll("╔════════════════════════════════════════╗");
  209. PrintToChatAll("%s %N wyszedł z gry", VIP_PREFIX, client);
  210. PrintToChatAll("╚════════════════════════════════════════╝");
  211. }
  212. }
  213. }
  214.  
  215. public Action Komenda_Hud(int client, int args)
  216. {
  217. if (!g_cvVipPisanieWHud.BoolValue)
  218. {
  219. PrintToChat(client, "Ta funkcja została wyłączona przez administratora serwera");
  220. return Plugin_Handled;
  221. }
  222.  
  223. if (!IsPlayerVIP(client))
  224. {
  225. PrintToChat(client, "Tylko vip może użyć tej komendy");
  226. return Plugin_Handled;
  227. }
  228.  
  229. if (args < 1)
  230. {
  231. ReplyToCommand(client, "[SM] UĹźycie: sm_hudsay <tekst>");
  232. return Plugin_Handled;
  233. }
  234.  
  235. char text[192];
  236. GetCmdArgString(text, sizeof(text));
  237.  
  238. for (int i = 1; i <= MaxClients; i++)
  239. {
  240. if (IsClientInGame(i) && !IsFakeClient(i))
  241. {
  242. SetHudTextParams(0.35, 0.225, 10.0, 0, 255, 0, 1, 0, 2.5, 2.0); //Tutaj se edytujemy tak o beka.
  243. ShowHudText(i, 5, "VIP: %N napisał:\n%s", client, text);
  244. }
  245. }
  246.  
  247. g_bWiadomoscHud[client] = false;
  248. CreateTimer(120.0, Timer_EnableMessage, client);
  249.  
  250. return Plugin_Handled;
  251. }
  252.  
  253. public Action Timer_EnableMessage(Handle timer, any client)
  254. {
  255. if(client)
  256. g_bWiadomoscHud[client] = true;
  257. }
  258.  
  259. public Action MenuGlowne(int client)
  260. {
  261. if (IsValidClient(client)) {
  262. if (IsPlayerVIP(client)) {
  263. Menu menu = new Menu(MenuHandler1);
  264. menu.SetTitle("VIP : Wybierz Broń");
  265. menu.AddItem("weapon_ak47", "AK-47");
  266. menu.AddItem("weapon_m4a1", "M4A4");
  267. menu.AddItem("weapon_m4a1_silencer", "M4A1-S");
  268. menu.AddItem("weapon_awp", "AWP");
  269. menu.AddItem("weapon_ssg08", "SCOUT");
  270. menu.AddItem("weapon_xm1014", "XM1014");
  271. menu.AddItem("weapon_famas", "FAMAS");
  272. menu.ExitButton = true;
  273. menu.Display(client, 15);
  274. }
  275. }
  276. }
  277.  
  278. public int MenuHandler1(Menu menu, MenuAction action, int client, int itemNum)
  279. {
  280. if (action == MenuAction_Select)
  281. {
  282. char info[32];
  283. GetMenuItem(menu, itemNum, info, sizeof(info));
  284.  
  285. if (IsPlayerAlive(client))
  286. {
  287. StripAllWeapons(client);
  288. GivePlayerItem(client, "weapon_knife");
  289. GivePlayerItem(client, info);
  290. MenuBroni(client);
  291. }
  292. }
  293.  
  294. else if (action == MenuAction_End) {
  295. CloseHandle(menu);
  296. }
  297. }
  298.  
  299. public Action MenuBroni(int client)
  300. {
  301. if (IsValidClient(client)) {
  302. if (IsPlayerVIP(client)) {
  303. Menu menusec = new Menu(MenuHandler2);
  304. menusec.SetTitle("VIP : Wybierz Pistolet");
  305. menusec.AddItem("weapon_deagle", "Deagle");
  306. menusec.AddItem("weapon_revolver", "R8 Revolver");
  307. menusec.AddItem("weapon_fiveseven", "Five-Seven");
  308. menusec.AddItem("weapon_tec9", "Tec-9");
  309. menusec.AddItem("weapon_cz75a", "CZ7a");
  310. menusec.AddItem("weapon_elite", "Dual Elites");
  311. menusec.AddItem("weapon_p250", "p250");
  312. menusec.ExitButton = true;
  313. menusec.Display(client, 15);
  314. }
  315. }
  316. }
  317.  
  318. public int MenuHandler2(Menu menusec, MenuAction action, int client, int itemNum)
  319. {
  320.  
  321. if (action == MenuAction_Select)
  322. {
  323. char info[32];
  324. GetMenuItem(menusec, itemNum, info, sizeof(info));
  325.  
  326. if (IsPlayerAlive(client)) {
  327. GivePlayerItem(client, info);
  328. }
  329. }
  330.  
  331. else if (action == MenuAction_End) {
  332. CloseHandle(menusec);
  333. }
  334. }
  335.  
  336. public Action Event_RoundStart(Handle hEvent, const char[] chName, bool bDontBroadcast)
  337. {
  338. if (GetConVarBool(g_cvDarmowyVip))
  339. {
  340. int od_godziny = GetConVarInt(g_cvVipOdGodziny);
  341. int do_godziny = GetConVarInt(g_cvVipDoGodziny);
  342. if(od_godziny || do_godziny)
  343. {
  344. char godzina_str[8];
  345. FormatTime(godzina_str, sizeof(godzina_str), "%H", GetTime());
  346. int godzina = StringToInt(godzina_str);
  347. if(od_godziny > do_godziny)
  348. DarmowyVip = (godzina >= od_godziny || godzina < do_godziny)? 1: 0;
  349. else
  350. DarmowyVip = (godzina >= od_godziny && godzina < do_godziny)? 1: 0;
  351. }
  352. else
  353. DarmowyVip = 0;
  354. }
  355.  
  356. if (GameRules_GetProp("m_bWarmupPeriod") != 1)
  357. LiczbaRund = LiczbaRund + 1;
  358. }
  359.  
  360. public Action ResetPoZmianie(Handle hEvent, const char[] chName, bool bDontBroadcast)
  361. {
  362. LiczbaRund = 0;
  363. }
  364.  
  365. public Action Event_PlayerSpawn(Handle hEvent, const char[] chName, bool bDontBroadcast)
  366. {
  367. int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
  368.  
  369. if (GameRules_GetProp("m_bWarmupPeriod") == 1)
  370. return;
  371.  
  372. if (IsPlayerVIP(client))
  373. {
  374. SetEntityHealth(client, GetConVarInt(g_cvVipHP));
  375. if(LiczbaRund > 1)
  376. {
  377. SetEntProp(client, Prop_Send, "m_ArmorValue", GetConVarInt(g_cvVipArmor));
  378. SetEntProp(client, Prop_Send, "m_bHasHelmet", GetConVarInt(g_cvVipHelm));
  379. }
  380. else
  381. SetEntProp(client, Prop_Send, "m_ArmorValue", GetConVarInt(g_cvVipArmor));
  382. SetEntProp(client, Prop_Send, "m_iAccount", GetEntProp(client, Prop_Send, "m_iAccount") + GetConVarInt(g_cvVipPieniadzeNaStart));
  383. SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", GetConVarFloat(g_cvPredkoscGracza));
  384. SetEntityGravity(client, GetConVarFloat(g_cvGrawitacja));
  385. if (GetClientTeam(client) == CS_TEAM_CT && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0)GivePlayerItem(client, "item_defuser");
  386. if (LiczbaRund >= GetConVarInt(g_cvGranatyRunda))
  387. {
  388. if (GetConVarBool(g_cvHEGranat))GivePlayerItem(client, "weapon_hegrenade");
  389. if (GetConVarBool(g_cvFlashGranat))GivePlayerItem(client, "weapon_flashbang");
  390. if (GetConVarBool(g_cvSmokeGranat))GivePlayerItem(client, "weapon_smokegrenade");
  391. if (GetConVarBool(g_cvDecoyGranat))GivePlayerItem(client, "weapon_decoy");
  392. if (GetConVarBool(g_cvHealGranat))GivePlayerItem(client, "weapon_healthshot");
  393. if (GetConVarBool(g_cvIncGranat))GivePlayerItem(client, "weapon_incgrenade");
  394. if (GetClientTeam(client) == CS_TEAM_CT)
  395. {
  396. if (GetConVarBool(g_cvMolotovGranat))GivePlayerItem(client, "weapon_molotov");
  397. }
  398. if (GetConVarBool(g_cvTaGranat))GivePlayerItem(client, "weapon_tagrenade");
  399. }
  400. }
  401.  
  402. if (GetConVarBool(g_cvMenuBroni))
  403. {
  404. if (LiczbaRund >= GetConVarInt(g_cvRundaMenuBroni))
  405. {
  406. MenuGlowne(client);
  407. }
  408. }
  409. }
  410.  
  411. public Action Event_PlayerDeath(Event hEvent, const char[] chName, bool bDontBroadcast)
  412. {
  413. int attacker = GetClientOfUserId(hEvent.GetInt("attacker"));
  414. int victim = GetClientOfUserId(hEvent.GetInt("userid"));
  415.  
  416. char weapon[64];
  417. GetEventString(hEvent, "weapon", weapon, sizeof(weapon));
  418. ReplaceString(weapon, sizeof(weapon), "weapon_", "");
  419.  
  420. 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")) {
  421. weapon = "knife";
  422. }
  423.  
  424. if (IsPlayerVIP(attacker))
  425. {
  426. if (!IsValidClient(attacker)) {
  427. return;
  428. }
  429.  
  430. if (GetClientTeam(attacker) != GetClientTeam(victim))
  431. {
  432. bool headshot = GetEventBool(hEvent, "headshot");
  433. int PieniadzeGracza = GetEntProp(attacker, Prop_Send, "m_iAccount");
  434. int HP = GetClientHealth(attacker);
  435.  
  436. if (headshot)
  437. {
  438. SetEntProp(attacker, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipHeadShotPieniadze) + PieniadzeGracza);
  439. if (HP + GetConVarInt(g_cvVipHeadShotHP) > GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, GetConVarInt(g_cvMaxHP));
  440. if (HP + GetConVarInt(g_cvVipHeadShotHP) <= GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, HP + GetConVarInt(g_cvVipHeadShotHP));
  441. }
  442. else
  443. {
  444. SetEntProp(attacker, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipKillPieniadze) + PieniadzeGracza);
  445. if (HP + GetConVarInt(g_cvVipKillHP) > GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, GetConVarInt(g_cvMaxHP));
  446. if (HP + GetConVarInt(g_cvVipKillHP) <= GetConVarInt(g_cvMaxHP))SetEntityHealth(attacker, HP + GetConVarInt(g_cvVipKillHP));
  447. }
  448.  
  449. if (StrEqual(weapon, "knife"))
  450. {
  451. SetEntProp(attacker, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipKillKnifePieniadze) + PieniadzeGracza);
  452. if (GetConVarBool(g_cvWiadomosciChat))
  453. {
  454. PrintToChat(attacker, "%s Jako VIP otrzymałeś %i punktów za zabójstwo z noża", VIP_PREFIX);
  455. }
  456. }
  457. }
  458. }
  459. }
  460.  
  461. public Action Event_BombPlanted(Event hEvent, const char[] chName, bool bDontBroadcast)
  462. {
  463. int client = GetClientOfUserId(hEvent.GetInt("userid"));
  464. int PieniadzeGracza = GetEntProp(client, Prop_Send, "m_iAccount");
  465.  
  466. if (IsPlayerVIP(client)) {
  467.  
  468. if (GetConVarBool(g_cvWiadomosciChat))
  469. {
  470. PrintToChat(client, "%s Własnie otrzymałeś %i pieniążków za podłożenie bomby!", VIP_PREFIX, GetConVarInt(g_cvVipPieniadzePodlozenie));
  471. }
  472. SetEntProp(client, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipPieniadzePodlozenie) + PieniadzeGracza);
  473. }
  474. }
  475.  
  476. public Action Event_BombDefused(Handle hEvent, const char[] chName, bool bDontBroadcast)
  477. {
  478. int client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
  479. int PieniadzeGracza = GetEntProp(client, Prop_Send, "m_iAccount");
  480.  
  481. if (IsPlayerVIP(client))
  482. {
  483. if (GetConVarBool(g_cvWiadomosciChat))
  484. {
  485. PrintToChat(client, "%s Własnie otrzymałeś %i pieniążków za rozbrojenie bomby!", VIP_PREFIX, GetConVarInt(g_cvVipPieniadzeRozbrojenie));
  486. }
  487. SetEntProp(client, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipPieniadzeRozbrojenie) + PieniadzeGracza);
  488. }
  489. }
  490.  
  491. public Action Event_RoundEnd(Event hEvent, const char[] chName, bool bDontBroadcast)
  492. {
  493. int WygranaDruzyna = GetEventInt(hEvent, "winner");
  494.  
  495. for (int client = 1; client < MAXPLAYERS + 1; client++)
  496. {
  497. if (IsPlayerVIP(client) && IsValidClient(client))
  498. {
  499. RemoveNades(client);
  500.  
  501. if (GetClientTeam(client) == WygranaDruzyna)
  502. {
  503. SetEntProp(client, Prop_Send, "m_iAccount", GetConVarInt(g_cvVipWygranaPieniadze) + GetEntProp(client, Prop_Send, "m_iAccount"));
  504. }
  505. }
  506. }
  507. }
  508.  
  509. public Action Event_TagTable(Event hEvent, const char[] chName, bool bDontBroadcast)
  510. {
  511. int client = GetClientOfUserId(hEvent.GetInt("userid"));
  512.  
  513. char TagTabela[128];
  514. g_cvVipTagTabela.GetString(TagTabela, sizeof(TagTabela));
  515.  
  516. if (IsPlayerVIP(client))
  517. {
  518. if (GetConVarBool(g_cvTagTabela))CS_SetClientClanTag(client, TagTabela);
  519. }
  520. }
  521.  
  522. public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
  523. {
  524. if (!g_cvPodwojnySkok.BoolValue)
  525. return Plugin_Handled;
  526.  
  527. if (IsPlayerVIP(client) && IsPlayerAlive(client))
  528. {
  529. static int g_fLastButtons[MAXPLAYERS + 1], g_fLastFlags[MAXPLAYERS + 1], g_iJumps[MAXPLAYERS + 1], fCurFlags, fCurButtons;
  530. fCurFlags = GetEntityFlags(client);
  531. fCurButtons = GetClientButtons(client);
  532. if (g_fLastFlags[client] & FL_ONGROUND && !(fCurFlags & FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP)g_iJumps[client]++;
  533. else if (fCurFlags & FL_ONGROUND)g_iJumps[client] = 0;
  534. else if (!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP && g_iJumps[client] == 1)
  535. {
  536. g_iJumps[client]++;
  537. float vVel[3];
  538. GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
  539. vVel[2] = 250.0;
  540. TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel);
  541. }
  542.  
  543. g_fLastFlags[client] = fCurFlags;
  544. g_fLastButtons[client] = fCurButtons;
  545. }
  546. return Plugin_Continue;
  547. }
  548.  
  549. public Action PokazVipyOnline(int client, int args)
  550. {
  551. if (!g_cvVipyOnline.BoolValue)
  552. {
  553. PrintToChat(client, "Ta funkcja została wyłączona przez administratora serwera");
  554. return Plugin_Handled;
  555. }
  556.  
  557. int iCount = 0;
  558. Menu menu = new Menu(Menu_Handler);
  559. menu.SetTitle("Gracze VIP którzy aktualnie znajdują się na serwerze");
  560.  
  561. for (int i = 1; i < MaxClients; i++)
  562. {
  563. if (IsPlayerVIP(i) && IsValidClient(i) && IsClientInGame(i))
  564. {
  565. char format[128];
  566. char cid[16];
  567. IntToString(i, cid, sizeof cid);
  568. char name[MAX_NAME_LENGTH + 1];
  569. GetClientName(i, name, sizeof name);
  570. Format(format, sizeof format, "[VIP] Âť %s", name);
  571. menu.AddItem(cid, format, ITEMDRAW_DISABLED);
  572. iCount++;
  573. }
  574. }
  575.  
  576. if(iCount == 0)
  577. menu.AddItem("ITEMDRAW_DISABLED", "Ups, wygląda na to, że nie ma graczy online, którzy posiadają usługę VIP.");
  578.  
  579. menu.ExitButton = true;
  580. menu.Display(client, 0);
  581.  
  582. return Plugin_Handled;
  583. }
  584.  
  585. public int Menu_Handler(Menu menu, MenuAction action, int client, int itemNum)
  586. {
  587. if (action == MenuAction_End)CloseHandle(menu);
  588. }
  589.  
  590. stock void StripAllWeapons(int client)
  591. {
  592. int iEnt;
  593. for (int i = 0; i <= 2; i++)
  594. {
  595. while ((iEnt = GetPlayerWeaponSlot(client, i)) != -1)
  596. {
  597. RemovePlayerItem(client, iEnt);
  598. AcceptEntityInput(iEnt, "Kill");
  599. }
  600. }
  601. }
  602.  
  603. stock void RemoveNades(int client)
  604. {
  605. while (RemoveWeaponBySlot(client, 3)) { }
  606. for (int i = 0; i < 6; i++)
  607. SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, g_iaGrenadeOffsets[i]);
  608. }
  609.  
  610. stock bool RemoveWeaponBySlot(int client, int iSlot)
  611. {
  612. int iEntity = GetPlayerWeaponSlot(client, iSlot);
  613. if (IsValidEdict(iEntity)) {
  614. RemovePlayerItem(client, iEntity);
  615. AcceptEntityInput(iEntity, "Kill");
  616. return true;
  617. }
  618. return false;
  619. }
  620.  
  621. bool IsPlayerVIP(int client)
  622. {
  623. if (CheckCommandAccess(client, "sm_Vip", 0, true) || DarmowyVip)
  624. return true;
  625.  
  626. return false;
  627. }
  628.  
  629. bool IsValidClient(int client)
  630. {
  631. if (client <= 0 || client > MaxClients) {
  632. return false;
  633. }
  634.  
  635. if (!IsClientInGame(client)) {
  636. return false;
  637. }
  638.  
  639. if (IsFakeClient(client)) {
  640. return false;
  641. }
  642.  
  643. return true;
  644. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement