#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#pragma newdecls required;
bool g_bHH;
bool aktywny [MAXPLAYERS];
Handle g_Wlaczony;
Handle g_Poczatek;
Handle g_Koniec;
Handle StartHP;
Handle MaxHP;
Handle StartMoney;
Handle MoneyZabicieGlowa;
Handle MoneyZabicie;
Handle HPZabicieGlowa;
Handle HPZabicie;
Handle RozbrojonaBomba;
Handle PodlozonaBomba;
Handle Kamizelka;
Handle Kask;
Handle DefuseKit;
Handle Medishot;
Handle Smokegrenade;
Handle Flashbang;
Handle Hegrenade;
Handle Molotov;
Handle Decoy;
Handle Tagrenade;
Handle Remove_grenade;
Handle Podwojny_Skok;
Handle Grawitacja;
Handle Szybkosc;
int g_iaGrenadeOffsets[] = { 15, 17, 16, 14, 18, 17 };
public Plugin myinfo =
{
name = "VIP Od Godziny",
author = "BlaKi",
description = "Nocny VIP",
version = "1.1",
url = "http://CSGdansk.pl"
};
public void OnPluginStart()
{
HookEvent("round_start", Round_Start);
HookEvent("round_end", Sprawdz_Czas);
HookEvent("player_spawn", Player_Spawn);
HookEvent("player_death", Player_Death);
HookEvent("player_death", Player_Death);
HookEvent("bomb_planted", Bomb_Planted);
HookEvent("bomb_defused", Bomb_Defused);
CreateConVar("nocny_vip", "1.0", "Nocny VIP by BlaKi", FCVAR_NOTIFY);
g_Wlaczony = CreateConVar("vip_aktywny", "1", "Czy Nocny VIP ma byc wlaczony", FCVAR_NONE, true, 0.0, true, 1.0)
g_Poczatek = CreateConVar("vip_start", "22", "Od ktorej godziny Nocny VIP ma byc aktywny", FCVAR_NOTIFY);
g_Koniec = CreateConVar("vip_stop", "8", "Do ktorej godziny ma trwac Nocny VIP", FCVAR_NOTIFY);
StartHP = CreateConVar("vip_startzycie", "100", "Ilosc HP na start rundy", FCVAR_NOTIFY);
MaxHP = CreateConVar("vip_hp_max", "100", "Maksymalna ilosc HP, ktora moze posiadac VIP", FCVAR_NOTIFY);
StartMoney = CreateConVar("vip_money", "800", "Ilosc $ na start rundy", FCVAR_NOTIFY);
MoneyZabicieGlowa = CreateConVar("vip_HSMoney", "0", "Ilosc $ za Headshot", FCVAR_NOTIFY);
MoneyZabicie = CreateConVar("vip_KillMoney", "0", "Ilosc $ za fraga", FCVAR_NOTIFY);
HPZabicieGlowa = CreateConVar("vip_HPHS", "0", "Ilosc HP za Headshot", FCVAR_NOTIFY);
HPZabicie = CreateConVar("vip_HPKill", "0", "Ilosc HP za fraga", FCVAR_NOTIFY);
RozbrojonaBomba = CreateConVar("vip_bomb_planted", "0", "Ilosc $ za podlozenie bomby", FCVAR_NOTIFY);
PodlozonaBomba = CreateConVar("vip_bomb_defused", "0", "Ilosc $ za rozbrojenie bomby", FCVAR_NOTIFY);
Kamizelka = CreateConVar("vip_kamizelka", "0", "Kamizelka na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Kask = CreateConVar("vip_kask", "0", "Kask na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
DefuseKit = CreateConVar("vip_defusekit", "0", "Zestaw do rozbrajania dla CT na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
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);
Medishot = CreateConVar("vip_grenade_healtshot", "0", "Ilosc medishotow na start rundy (0-4)", FCVAR_NOTIFY);
Smokegrenade = CreateConVar("vip_grenade_smokegrenade", "0", "Smoke na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Flashbang = CreateConVar("vip_grenade_flashbang", "0", "Flash na start rundy (0-2))", FCVAR_NOTIFY);
Hegrenade = CreateConVar("vip_grenade_hegrenade", "0", "Granat na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Molotov = CreateConVar("vip_grenade_molotov", "0", "Molotov dla tt lub Incendiary dla ct na start rundy",FCVAR_NONE, true, 0.0, true, 1.0);
Decoy = CreateConVar("vip_grenade_decoy", "0", "Decoy na start rundy", FCVAR_NONE, true, 0.0, true, 1.0);
Tagrenade = CreateConVar("vip_grenade_tagrenade", "0", "Granat taktyczny na start rundy",FCVAR_NONE, true, 0.0, true, 1.0);
Podwojny_Skok = CreateConVar("vip_podwojny_skok", "0", "Podwojny skok", FCVAR_NONE, true, 0.0, true, 1.0);
Grawitacja = CreateConVar("vip_gravity", "1.0", "Grawitacja (1.0 - standardowa)", FCVAR_PLUGIN);
Szybkosc = CreateConVar("vip_speed", "1.0", "Predkosc poruszania sie (1.0 - standardowo)", FCVAR_PLUGIN);
MoneyZabicie = CreateConVar("vip_kill_money", "200", "Ilosc $ za fraga", FCVAR_NOTIFY);
HPZabicie = CreateConVar("vip_hp_kill", "5", "Ilosc HP za fraga", FCVAR_NOTIFY);
AutoExecConfig(true, "Nocny_Vip_Settings");
}
public Action Round_Start(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if(g_bHH)
{
aktywny[client] = true;
}
else if(!g_bHH)
{
aktywny[client] = false;
}
}
//////RZECZY OTRZYMYWANE PRZY SPAWNIE///////
public Action Player_Spawn(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int g_Medishot = GetConVarInt(Medishot);
int g_zycie = GetConVarInt(StartHP);
int g_kasastart = GetConVarInt(StartMoney);
int money = GetEntProp(client, Prop_Send, "m_iAccount");
int Slepak = GetConVarInt(Flashbang);
if(aktywny[client])
{
if(GetConVarBool(Remove_grenade)) StripNades(client);
{
SetEntityHealth(client, g_zycie);
SetEntityGravity(client, GetConVarFloat(Grawitacja));
SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", GetConVarFloat(Szybkosc));
SetEntProp(client, Prop_Send, "m_iAccount", money + g_kasastart);
if(GetConVarBool(Kamizelka)) SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
if(GetConVarBool(Kask)) SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
if(GetConVarBool(Smokegrenade)) GivePlayerItem(client, "weapon_smokegrenade");
if(GetConVarBool(Hegrenade)) GivePlayerItem(client, "weapon_hegrenade");
if(GetConVarBool(Molotov) && GetClientTeam(client)==CS_TEAM_T) GivePlayerItem(client, "weapon_molotov");
if(GetConVarBool(Molotov) && GetClientTeam(client)==CS_TEAM_CT) GivePlayerItem(client, "weapon_incgrenade");
if (GetConVarBool(Decoy)) GivePlayerItem(client, "weapon_decoy");
if (GetConVarBool(Tagrenade)) GivePlayerItem(client, "weapon_tagrenade");
if(GetConVarInt(Medishot))
{
for (int i = 1; i <= g_Medishot; i++)
GivePlayerItem(client, "weapon_healthshot");
}
if(GetConVarBool(Flashbang))
{
for (int i = 1; i <= Slepak; i++)
GivePlayerItem(client, "weapon_flashbang");
}
if(GetClientTeam(client)==CS_TEAM_CT)
{
if(GetConVarBool(DefuseKit) && GetEntProp(client, Prop_Send, "m_bHasDefuser") == 0) GivePlayerItem(client, "item_defuser");
}
}
}
}
//////HP i MONEY ZA KILLA I HS'A///////
public Action Player_Death(Handle event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
int money = GetEntProp(attacker, Prop_Send, "m_iAccount");
int health = GetEntProp(attacker, Prop_Send, "m_iHealth");
int g_HSMoney = GetConVarInt(MoneyZabicieGlowa);
int g_KillMoney = GetConVarInt(MoneyZabicie);
int g_HSHP = GetConVarInt(HPZabicieGlowa);
int g_HPKill = GetConVarInt(HPZabicie);
int Max_HP = GetConVarInt(MaxHP);
bool headshot = GetEventBool(event, "headshot");
if(aktywny[attacker])
{
if(headshot)
{
SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_HSMoney);
if(health >= Max_HP - g_HSHP)
{
SetEntityHealth(attacker, Max_HP);
}
else
{
SetEntityHealth(attacker, health + g_HSHP);
}
}
else
{
SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_KillMoney);
if(health >= Max_HP - g_HPKill)
{
SetEntityHealth(attacker, Max_HP);
}
else
{
SetEntityHealth(attacker, health + g_HPKill);
}
}
}
}
///////BOMB DEFUSE/PLANTED///////
public Action Bomb_Planted(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int money = GetEntProp(client, Prop_Send, "m_iAccount");
int BombaPodlozona = GetConVarInt(PodlozonaBomba);
if(aktywny[client])
{
SetEntProp(client, Prop_Send, "m_iAccount", money + BombaPodlozona);
}
}
public Action Bomb_Defused(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int money = GetEntProp(client, Prop_Send, "m_iAccount");
int BombaRozbrojona = GetConVarInt(RozbrojonaBomba);
if(aktywny[client])
{
SetEntProp(client, Prop_Send, "m_iAccount", money + BombaRozbrojona);
}
}
/////////CZAS///////
public Action Sprawdz_Czas(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int start = GetConVarInt(g_Poczatek);
int stop = GetConVarInt(g_Koniec);
if(IsValidPlayer(client) && GetConVarBool(g_Wlaczony))
{
char cCzas[16];
FormatTime
(cCzas
, sizeof(cCzas
), "%H", GetTime
())
int iCzas = StringToInt(cCzas)
if(iCzas>start||iCzas<stop)
g_bHH=true;
else
g_bHH=false;
}
}
////////// DOUBLE JUMP ///////////
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float[3] vel, float[3] angles, int &weapon)
{
if(aktywny[client])
{
if(GetConVarBool(Podwojny_Skok))
{
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;
}
}
}
stock bool RemoveWeaponBySlot(int client, int iSlot)
{
int iEntity = GetPlayerWeaponSlot(client, iSlot);
if(IsValidEdict(iEntity) && aktywny[client])
{
RemovePlayerItem(client, iEntity);
AcceptEntityInput(iEntity, "Kill");
return true;
}
return false;
}
stock void StripNades(int client)
{
if(aktywny[client])
{
while(RemoveWeaponBySlot(client, 3)){}
for (int i = 0; i < 6; i++)
SetEntProp(client, Prop_Send, "m_iAmmo", 0, _, g_iaGrenadeOffsets[i]);
}
}
stock bool IsValidPlayer(int client)
{
if(client >= 1 && client <= MaxClients && IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) )
return true;
return false;
}