#include <sourcemod>
#include <sdkhooks>
#include <sdktools_entinput>
#include <sdktools_functions>
#include <weapon_function>
#include <cstrike>
new bool:bClientVip[MAXPLAYERS + 1] = false;
new bool:Water[MAXPLAYERS + 1] = false;
new bool:SD[MAXPLAYERS + 1] = false;
new bool:CD[MAXPLAYERS + 1] = false;
new bool:Sheild[MAXPLAYERS + 1] = false;
new bool:Weapon[MAXPLAYERS + 1] = false;
new bool:IAI[MAXPLAYERS + 1] = false;
new bool:InVis[MAXPLAYERS + 1] = false;
new iRespawn[MAXPLAYERS + 1];
new Handle:ChangeDamage;
new Handle:hSheild;
new Handle:respawn;
public OnPluginStart()
{
RegConsoleCmd("sm_pw", MenuVip, "Open PW menu");
ChangeDamage = CreateConVar("pw_damage","1.2","Множитель урона (Урон*|x|)");
hSheild = CreateConVar("pw_sheild","0.2","Понижение урона (Щит). P.S: Чем меньше число тем меньше будет получаемый урон (Урон*|x|)");
respawn = CreateConVar("pw_respawn","2","Количество возраждений");
HookEvent("player_spawn",OnPlayerSpawn);
HookEvent("round_start",OnRoundStart);
}
public OnClientPostAdminCheck(client)
{
new AdminId:id = GetUserAdmin(client);
if (GetAdminFlag(id, Admin_Root, Access_Effective) == true)
{
bClientVip[client] = true;
iRespawn[client] = GetConVarInt(respawn);
}
SDKHook(client, SDKHook_OnTakeDamage, SDKHookCB:OnTakeDamage);
}
public OnClientDisconnect(client)
{
SDKUnhook(client, SDKHook_OnTakeDamage, SDKHookCB:OnTakeDamage);
}
public Action:MenuVip(client, args)
{
if (!bClientVip[client])
{
ReplyToCommand(client, "[PW] Вы не имеете доступа! Плагин ещё тестируется!");
}
else
{
new Handle:VipMenu = CreateMenu(Handle_VipMenu);
SetMenuTitle(VipMenu, "Pw меню:\n\n");
decl String:buffer[256];
FormatEx(buffer, sizeof(buffer), "[%s] Всплески при ранении", (Water[client] == false) ? "-":"+");
AddMenuItem(VipMenu, "Water", buffer);
FormatEx(buffer, sizeof(buffer), "[%s] Показ урона", (SD[client] == false) ? "-":"+");
AddMenuItem(VipMenu, "SD", buffer);
FormatEx(buffer, sizeof(buffer), "[%s] Повышение урона", (CD[client] == false) ? "-":"+");
AddMenuItem(VipMenu, "CD", buffer);
FormatEx(buffer, sizeof(buffer), "[%s] Щит", (Sheild[client] == false) ? "-":"+");
AddMenuItem(VipMenu, "Sheild", buffer);
FormatEx(buffer, sizeof(buffer), "[%s] В начале раунда [Awp+Deagle+He+Smoke]",(Weapon[client] == false) ? "-":"+");
AddMenuItem(VipMenu, "Weapons", buffer);
FormatEx(buffer, sizeof(buffer), "[%s] Нет урона от своей грены",(IAI[client] == false) ? "-":"+");
AddMenuItem(VipMenu, "IAI", buffer);
FormatEx(buffer, sizeof(buffer), "[%s] Невидимка (50%%)",(InVis[client] == false) ? "-":"+");
AddMenuItem(VipMenu, "InVis", buffer);
if(iRespawn[client]<=0)
{
FormatEx(buffer, sizeof(buffer), "Возраждения кончились");
AddMenuItem(VipMenu, "Respawn", buffer,ITEMDRAW_DISABLED);
}
else if(IsPlayerAlive(client))
{
FormatEx(buffer, sizeof(buffer), "Возрождение невозможно (Вы живы)");
AddMenuItem(VipMenu, "Respawn", buffer,ITEMDRAW_DISABLED)
}
else if(iRespawn[client]>0)
{
FormatEx(buffer, sizeof(buffer), "Возродиться [%d]",iRespawn[client]);
AddMenuItem(VipMenu, "Respawn", buffer);
}
DisplayMenu(VipMenu, client, 0);
}
}
public Handle_VipMenu(Handle:hMenu, MenuAction:action, client, param2)
{
if (action == MenuAction_Select)
{
decl String:info[256];
GetMenuItem(hMenu, param2, info, sizeof(info));
if (!strcmp("Water", info, true))
{
Water[client] = (Water[client] == false) ? true:false;
}
else if (!strcmp("SD", info, true))
{
SD[client] = (SD[client] == false) ? true:false;
}
else if (!strcmp("CD", info, true))
{
CD[client] = (CD[client] == false) ? true:false;
}
else if (!strcmp("Sheild", info, true))
{
Sheild[client] = (Sheild[client] == false) ? true:false;
}
else if (!strcmp("Weapons", info, true))
{
Weapon[client] = (Weapon[client] == false) ? true:false;
}
else if (!strcmp("IAI", info, true))
{
IAI[client] = (IAI[client] == false) ? true:false;
}
else if (!strcmp("InVis", info, true))
{
InVis[client] = (InVis[client] == false) ? true:false;
if(InVis[client])
{
SetEntityRenderMode(client,RENDER_TRANSALPHA);
SetEntityRenderColor(client,255,255,255,255/2);
}
else
{
SetEntityRenderMode(client,RENDER_TRANSALPHA);
SetEntityRenderColor(client,255,255,255,255);
}
}
else if (!strcmp("Respawn", info, true))
{
if(iRespawn[client]>0)
{
CS_RespawnPlayer(client);
--iRespawn[client];
}
else
{
iRespawn[client] = 0;
}
}
MenuVip(client, 0);
}
if (action == MenuAction_End) CloseHandle(hMenu);
}
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom)
{
if(victim&&attacker)
{
if(victim!=attacker && GetClientTeam(victim)!=GetClientTeam(attacker))
{
if (Water[attacker])
{
SetVariantString("WaterSurfaceExplosion");
AcceptEntityInput(victim, "DispatchEffect");
}
if (SD[attacker])
{
PrintCenterText(attacker, "-%0.0f HP", (!CD[attacker])?damage:damage*GetConVarFloat(ChangeDamage));
}
if (CD[attacker])
{
damage = damage*GetConVarFloat(ChangeDamage);
}
if (Sheild[victim])
{
damage = damage*GetConVarFloat(hSheild);
}
}
else
{
if (IAI[attacker])
{
damage = 0.0;
}
}
return Plugin_Changed;
}
return Plugin_Continue;
}
public Action:OnPlayerSpawn(Handle:event, const String:sEvName[], bool:bDontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid"));
if(Weapon[client])
{
GivePlayerItemEx(client, "weapon_awp", 99, 99);
GivePlayerItemEx(client, "weapon_deagle", 99, 99);
GivePlayerItem(client, "weapon_hegrenade");
GivePlayerItem(client, "weapon_smokegrenade");
}
if(InVis[client])
{
SetEntityRenderMode(client,RENDER_TRANSALPHA);
SetEntityRenderColor(client,255,255,255,255/2);
}
}
public Action:OnRoundStart(Handle:event, const String:sEvName[], bool:bDontBroadcast)
{
for(new i = 1; i<=MaxClients;i++)
{
if(i&&IsClientInGame(i)&&!IsFakeClient(i))
{
iRespawn[i] = GetConVarInt(respawn);
}
}
}