Facebook
From Violet Elephant, 5 Years ago, written in PHP.
Embed
Download Paste or View Raw
Hits: 250
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4. #include <cstrike>
  5.  
  6. #pragma newdecls required;
  7.  
  8. bool g_bHH;
  9. bool aktywny [MAXPLAYERS];
  10.  
  11. Handle g_Wlaczony;
  12. Handle g_Poczatek;
  13. Handle g_Koniec;
  14.  
  15. Handle StartHP;
  16. Handle MaxHP;
  17. Handle StartMoney;
  18. Handle MoneyZabicieGlowa;
  19. Handle MoneyZabicie;
  20. Handle HPZabicieGlowa;
  21. Handle HPZabicie;
  22. Handle RozbrojonaBomba;
  23. Handle PodlozonaBomba;
  24. Handle Kamizelka;
  25. Handle Kask;
  26. Handle DefuseKit;
  27. Handle Medishot;
  28. Handle Smokegrenade;
  29. Handle Flashbang;
  30. Handle Hegrenade;
  31. Handle Molotov;
  32. Handle Decoy;
  33. Handle Tagrenade;
  34. Handle Remove_grenade;
  35. Handle Podwojny_Skok;
  36. Handle Grawitacja;
  37. Handle Szybkosc;
  38.  
  39. int g_iaGrenadeOffsets[] =  { 15, 17, 16, 14, 18, 17 };
  40.  
  41. public Plugin myinfo =
  42. {
  43.         name = "VIP Od Godziny",
  44.         author = "BlaKi",
  45.         description = "Nocny VIP",
  46.         version = "1.1",
  47.         url = "http://CSGdansk.pl"
  48. };
  49.  
  50. public void OnPluginStart()
  51. {
  52.         HookEvent("round_start",        Round_Start);
  53.         HookEvent("round_end",          Sprawdz_Czas);
  54.         HookEvent("player_spawn",       Player_Spawn);
  55.         HookEvent("player_death",       Player_Death);
  56.         HookEvent("player_death",       Player_Death);
  57.         HookEvent("bomb_planted",       Bomb_Planted);
  58.         HookEvent("bomb_defused",       Bomb_Defused);
  59.        
  60.         CreateConVar("nocny_vip", "1.0", "Nocny VIP by BlaKi", FCVAR_NOTIFY);
  61.        
  62.         g_Wlaczony = CreateConVar("vip_aktywny", "1", "Czy Nocny VIP ma byc wlaczony", FCVAR_NONE, true, 0.0, true, 1.0)
  63.         g_Poczatek = CreateConVar("vip_start", "22", "Od ktorej godziny Nocny VIP ma byc aktywny", FCVAR_NOTIFY);
  64.         g_Koniec = CreateConVar("vip_stop", "8", "Do ktorej godziny ma trwac Nocny VIP", FCVAR_NOTIFY);
  65.        
  66.         StartHP = CreateConVar("vip_startzycie", "100", "Ilosc HP na start rundy", FCVAR_NOTIFY);
  67.         MaxHP = CreateConVar("vip_hp_max", "100", "Maksymalna ilosc HP, ktora moze posiadac VIP", FCVAR_NOTIFY);
  68.         StartMoney = CreateConVar("vip_money", "800", "Ilosc $ na start rundy", FCVAR_NOTIFY); 
  69.         MoneyZabicieGlowa = CreateConVar("vip_HSMoney", "0", "Ilosc $ za Headshot", FCVAR_NOTIFY);
  70.         MoneyZabicie = CreateConVar("vip_KillMoney", "0", "Ilosc $ za fraga", FCVAR_NOTIFY);   
  71.         HPZabicieGlowa = CreateConVar("vip_HPHS", "0", "Ilosc HP za Headshot", FCVAR_NOTIFY);
  72.         HPZabicie = CreateConVar("vip_HPKill", "0", "Ilosc HP za fraga", FCVAR_NOTIFY);
  73.         RozbrojonaBomba = CreateConVar("vip_bomb_planted", "0", "Ilosc $ za podlozenie bomby", FCVAR_NOTIFY);
  74.         PodlozonaBomba = CreateConVar("vip_bomb_defused", "0", "Ilosc $ za rozbrojenie bomby", FCVAR_NOTIFY);  
  75.         Kamizelka = CreateConVar("vip_kamizelka", "0", "Kamizelka na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
  76.         Kask = CreateConVar("vip_kask", "0", "Kask na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
  77.         DefuseKit = CreateConVar("vip_defusekit", "0", "Zestaw do rozbrajania dla CT na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);       
  78.         Remove_grenade = CreateConVar("vip_grenade_remove", "0", "Na początku rundy/respawn usuwa wszystkie granaty (Przydatne przy wypadaniu granatów", FCVAR_NONE, true, 0.0, true, 1.0);
  79.         Medishot = CreateConVar("vip_grenade_healtshot", "0", "Ilosc medishotow na start rundy (0-4)", FCVAR_NOTIFY);
  80.         Smokegrenade = CreateConVar("vip_grenade_smokegrenade", "0", "Smoke na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
  81.         Flashbang = CreateConVar("vip_grenade_flashbang", "0", "Flash na start rundy (0-2))", FCVAR_NOTIFY);
  82.         Hegrenade = CreateConVar("vip_grenade_hegrenade", "0", "Granat na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
  83.         Molotov = CreateConVar("vip_grenade_molotov", "0", "Molotov dla tt lub Incendiary dla ct na start rundy",FCVAR_NONE, true, 0.0, true, 1.0);
  84.         Decoy = CreateConVar("vip_grenade_decoy", "0", "Decoy na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
  85.         Tagrenade = CreateConVar("vip_grenade_tagrenade", "0", "Granat taktyczny na start rundy",FCVAR_NONE, true, 0.0, true, 1.0);
  86.         Podwojny_Skok = CreateConVar("vip_podwojny_skok", "0", "Podwojny skok", FCVAR_NONE, true, 0.0, true, 1.0);
  87.         Grawitacja = CreateConVar("vip_gravity", "1.0", "Grawitacja (1.0 - standardowa)", FCVAR_PLUGIN);
  88.         Szybkosc = CreateConVar("vip_speed", "1.0", "Predkosc poruszania sie (1.0 - standardowo)", FCVAR_PLUGIN);
  89.  
  90.        
  91.         MoneyZabicie = CreateConVar("vip_kill_money", "200", "Ilosc $ za fraga", FCVAR_NOTIFY);
  92.         HPZabicie = CreateConVar("vip_hp_kill", "5", "Ilosc HP za fraga", FCVAR_NOTIFY);       
  93.        
  94.         AutoExecConfig(true, "Nocny_Vip_Settings");
  95. }
  96.  
  97. public Action Round_Start(Handle event, const char[] name, bool dontBroadcast)
  98. {
  99.         int client = GetClientOfUserId(GetEventInt(event, "userid"));
  100.        
  101.         if(g_bHH)
  102.         {
  103.                 aktywny[client] = true;
  104.         }
  105.         else if(!g_bHH)
  106.         {
  107.                 aktywny[client] = false;
  108.         }
  109. }
  110.  
  111. //////RZECZY OTRZYMYWANE PRZY SPAWNIE///////
  112.  
  113. public Action Player_Spawn(Handle event, const char[] name, bool dontBroadcast)
  114. {
  115.         int client = GetClientOfUserId(GetEventInt(event, "userid"));
  116.         int g_Medishot = GetConVarInt(Medishot);
  117.         int g_zycie = GetConVarInt(StartHP);
  118.         int g_kasastart = GetConVarInt(StartMoney);
  119.         int money = GetEntProp(client, Prop_Send, "m_iAccount");
  120.         int Slepak = GetConVarInt(Flashbang);
  121.        
  122.         if(aktywny[client])
  123.         {
  124.                 if(GetConVarBool(Remove_grenade)) StripNades(client);
  125.                 {
  126.                         SetEntityHealth(client, g_zycie);
  127.                         SetEntityGravity(client, GetConVarFloat(Grawitacja));
  128.                         SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", GetConVarFloat(Szybkosc));
  129.                         SetEntProp(client, Prop_Send, "m_iAccount", money + g_kasastart);
  130.                        
  131.                         if(GetConVarBool(Kamizelka)) SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
  132.                         if(GetConVarBool(Kask)) SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
  133.                         if(GetConVarBool(Smokegrenade)) GivePlayerItem(client, "weapon_smokegrenade");
  134.                         if(GetConVarBool(Hegrenade)) GivePlayerItem(client, "weapon_hegrenade");
  135.                         if(GetConVarBool(Molotov) && GetClientTeam(client)==CS_TEAM_T) GivePlayerItem(client, "weapon_molotov");
  136.                         if(GetConVarBool(Molotov) && GetClientTeam(client)==CS_TEAM_CT) GivePlayerItem(client, "weapon_incgrenade");
  137.                         if (GetConVarBool(Decoy)) GivePlayerItem(client, "weapon_decoy");
  138.                         if (GetConVarBool(Tagrenade)) GivePlayerItem(client, "weapon_tagrenade");
  139.                        
  140.                         if(GetConVarInt(Medishot))
  141.                         {
  142.                                 for (int i = 1; i <= g_Medishot; i++)
  143.                                 GivePlayerItem(client, "weapon_healthshot");
  144.                         }
  145.                         if(GetConVarBool(Flashbang))
  146.                         {
  147.                                 for (int i = 1; i <= Slepak; i++)
  148.                                 GivePlayerItem(client, "weapon_flashbang");
  149.                         }
  150.                        
  151.                         if(GetClientTeam(client)==CS_TEAM_CT)
  152.                         {
  153.                                 if(GetConVarBool(DefuseKit) && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
  154.                         }
  155.                 }
  156.         }
  157. }
  158.  
  159. //////HP i MONEY ZA KILLA I HS'A///////
  160.  
  161. public Action Player_Death(Handle event, const char[] name, bool dontBroadcast)
  162. {
  163.         int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  164.         int money = GetEntProp(attacker, Prop_Send, "m_iAccount");
  165.         int health = GetEntProp(attacker, Prop_Send, "m_iHealth");
  166.         int g_HSMoney = GetConVarInt(MoneyZabicieGlowa);
  167.         int g_KillMoney = GetConVarInt(MoneyZabicie);
  168.         int g_HSHP = GetConVarInt(HPZabicieGlowa);
  169.         int g_HPKill = GetConVarInt(HPZabicie);
  170.         int Max_HP = GetConVarInt(MaxHP);
  171.  
  172.        
  173.         bool headshot = GetEventBool(event, "headshot");
  174.        
  175.         if(aktywny[attacker])
  176.         {
  177.                 if(headshot)
  178.                 {
  179.                         SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_HSMoney);
  180.                        
  181.                         if(health >= Max_HP - g_HSHP)
  182.                         {
  183.                                 SetEntityHealth(attacker, Max_HP);
  184.                         }
  185.                         else
  186.                         {
  187.                                 SetEntityHealth(attacker, health + g_HSHP);
  188.                         }
  189.                 }
  190.                 else
  191.                 {
  192.                         SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_KillMoney);
  193.                         if(health >= Max_HP - g_HPKill)
  194.                         {
  195.                                 SetEntityHealth(attacker, Max_HP);
  196.                         }
  197.                         else
  198.                         {
  199.                                 SetEntityHealth(attacker, health + g_HPKill);
  200.                         }
  201.                 }
  202.         }
  203. }
  204.  
  205. ///////BOMB DEFUSE/PLANTED///////
  206.  
  207. public Action Bomb_Planted(Handle event, const char[] name, bool dontBroadcast)
  208. {
  209.         int client = GetClientOfUserId(GetEventInt(event, "userid"));
  210.         int money = GetEntProp(client, Prop_Send, "m_iAccount");
  211.         int BombaPodlozona = GetConVarInt(PodlozonaBomba);
  212.        
  213.         if(aktywny[client])
  214.         {
  215.                         SetEntProp(client, Prop_Send, "m_iAccount", money + BombaPodlozona);
  216.         }
  217. }
  218.  
  219. public Action Bomb_Defused(Handle event, const char[] name, bool dontBroadcast)
  220. {
  221.         int client = GetClientOfUserId(GetEventInt(event, "userid"));
  222.         int money = GetEntProp(client, Prop_Send, "m_iAccount");
  223.         int BombaRozbrojona = GetConVarInt(RozbrojonaBomba);
  224.        
  225.         if(aktywny[client])
  226.         {
  227.                 SetEntProp(client, Prop_Send, "m_iAccount", money + BombaRozbrojona);
  228.         }
  229. }
  230.  
  231. /////////CZAS///////
  232.  
  233. public Action Sprawdz_Czas(Handle event, const char[] name, bool dontBroadcast)
  234. {      
  235.         int client = GetClientOfUserId(GetEventInt(event, "userid"));
  236.         int start = GetConVarInt(g_Poczatek);
  237.         int stop = GetConVarInt(g_Koniec);
  238.        
  239.         if(IsValidPlayer(client) && GetConVarBool(g_Wlaczony))
  240.         {
  241.                 char cCzas[16];
  242.                 FormatTime(cCzas, sizeof(cCzas), "%H", GetTime())
  243.                
  244.                 int iCzas = StringToInt(cCzas)
  245.            
  246.                 if(iCzas>start||iCzas<stop)
  247.                 g_bHH=true;
  248.                 else
  249.                 g_bHH=false;
  250.         }
  251. }
  252.  
  253. ////////// DOUBLE JUMP ///////////
  254.  
  255. public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float[3] vel, float[3] angles, int &weapon)
  256. {
  257.         if(aktywny[client])
  258.         {
  259.                 if(GetConVarBool(Podwojny_Skok))
  260.                 {
  261.                         static int g_fLastButtons[MAXPLAYERS+1], g_fLastFlags[MAXPLAYERS+1], g_iJumps[MAXPLAYERS+1], fCurFlags, fCurButtons;
  262.                         fCurFlags = GetEntityFlags(client);
  263.                         fCurButtons = GetClientButtons(client);
  264.                         if (g_fLastFlags[client] & FL_ONGROUND && !(fCurFlags & FL_ONGROUND) && !(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP) g_iJumps[client]++;
  265.                         else if(fCurFlags & FL_ONGROUND) g_iJumps[client] = 0;
  266.                         else if(!(g_fLastButtons[client] & IN_JUMP) && fCurButtons & IN_JUMP && g_iJumps[client] <= 1)
  267.                         {
  268.                                 g_iJumps[client]++;
  269.                                 float vVel[3];
  270.                                 GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
  271.                                 vVel[2] = 250.0;
  272.                                 TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVel);
  273.                         }
  274.                         g_fLastFlags[client] = fCurFlags;
  275.                         g_fLastButtons[client] = fCurButtons;
  276.                 }
  277.         }
  278. }
  279.  
  280. stock bool RemoveWeaponBySlot(int client, int iSlot)
  281. {
  282.         int iEntity = GetPlayerWeaponSlot(client, iSlot);
  283.        
  284.         if(IsValidEdict(iEntity) && aktywny[client])
  285.         {
  286.                 RemovePlayerItem(client, iEntity);
  287.                 AcceptEntityInput(iEntity, "Kill");
  288.                 return true;
  289.         }
  290.         return false;
  291. }
  292.  
  293. stock void StripNades(int client)
  294. {
  295.         if(aktywny[client])
  296.         {
  297.                 while(RemoveWeaponBySlot(client, 3)){}
  298.                 for (int i = 0; i < 6; i++)
  299.                 SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, g_iaGrenadeOffsets[i]);
  300.         }
  301. }
  302.  
  303. stock bool IsValidPlayer(int client)
  304. {
  305.         if(client >= 1 && client <= MaxClients && IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) )
  306.         return true;
  307.  
  308.         return false;
  309. }