Приветствую. Как можно выдать вх только админу по флагу b?
Код:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public Plugin:myinfo =
{
name = "WH Clients Death",
author = "-=1989=- and WS FiX Nek.'a 2x2",
version = "3.4.1"
};
new g_MySprite[MAXPLAYERS + 1];
new g_MySpriteRef[MAXPLAYERS + 1];
public OnPluginStart()
{
HookEvent("player_spawn", player_spawn);
HookEvent("player_death", ClearEvent);
HookEvent("player_team", ClearEvent);
}
public OnMapStart()
{
AddFileToDownloadsTable("materials/ggwp/wh/rectangle_blue.vmt");
AddFileToDownloadsTable("materials/ggwp/wh/rectangle_blue.vtf");
AddFileToDownloadsTable("materials/ggwp/wh/rectangle_red.vmt");
AddFileToDownloadsTable("materials/ggwp/wh/rectangle_red.vtf");
PrecacheDecal("ggwp/wh/rectangle_blue.vmt", true);
PrecacheDecal("ggwp/wh/rectangle_red", true);
}
public ClearEvent(Handle:event, const String:name[], bool:silent)
{
wS_ClearSprite(GetClientOfUserId(GetEventInt(event, "userid")));
}
public player_spawn(Handle:event, const String:name[], bool:silent)
{
CreateTimer(0.1, player_spawn_Timer, GetEventInt(event, "userid"), TIMER_FLAG_NO_MAPCHANGE);
}
public Action:player_spawn_Timer(Handle:timer, any:id)
{
new client = GetClientOfUserId(id);
if (client < 1)
return Plugin_Stop;
wS_ClearSprite(client);
if (!IsPlayerAlive(client))
return Plugin_Stop;
new ent = CreateEntityByName("env_sprite");
if (ent < 1)
{
LogError("env_sprite error");
return Plugin_Stop;
}
g_MySprite[client] = ent;
g_MySpriteRef[client] = EntIndexToEntRef(ent);
decl Float:pos[3]; GetClientAbsOrigin(client, pos); pos[2] += 35.0;
DispatchKeyValueVector(ent, "origin", pos);
DispatchKeyValue(ent, "model", GetClientTeam(client) == 2 ? "ggwp/wh/rectangle_red.vmt" : "ggwp/wh/rectangle_blue.vmt");
DispatchKeyValue(ent, "rendermode", "0");
DispatchKeyValue(ent, "renderfx", "0");
DispatchKeyValue(ent, "renderamt", "255");
DispatchKeyValue(ent, "scale", "0.5");
DispatchKeyValue(ent, "GlowProxySize", "61.0");
DispatchSpawn(ent);
SetVariantString("!activator");
AcceptEntityInput(ent, "SetParent", client, ent);
SDKHook(ent, SDKHook_SetTransmit, Hook_SetTransmit);
return Plugin_Stop;
}
public Action:Hook_SetTransmit(entity, client)
{
return entity == g_MySprite[client] || IsPlayerAlive(client) ? Plugin_Handled : Plugin_Continue;
}
stock wS_ClearSprite(client)
{
if (g_MySprite[client] > 0)
{
new ent = EntRefToEntIndex(g_MySpriteRef[client]);
if (ent > 0) AcceptEntityInput(ent, "Kill");
g_MySprite[client] = 0;
g_MySpriteRef[client] = 0;
}
}
public OnClientDisconnect(client)
{
wS_ClearSprite(client);
}