0-BuTaJIuK-0
Участник
- Сообщения
- 235
- Реакции
- 57
Подскажите способы защиты от декомпиляции плагина и привязки карты к плагину
Такой страшный говнокод, что показать стыдно?способы защиты от декомпиляции плагина
Забудь это коварное слово «бан по железу»,увы 34 версия заброшена и в ней много дыр для троля администрации сервера,конкретных решений мне не известно,раз ве что кикать пока не замучается перезаходить читерБан по железу,бан под сеть,бан по ip можно как то это всё в одно сделать,css v34?
https://hlmod.net/resources/super-adminka.10/Здравствуйте. Подскажите плагин невидимый админ.
Админ становится невидимый.без оружия,без тени.так же передвигается по карте.
приват или бесплатный есть?
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#tryinclude <jenkins>
#define VERSION "1.4fix"
#if !defined BUILD
#define BUILD "0"
#endif
#define SPECTATOR 1
#define JOIN_MESSAGE "Player %N has joined the game"
#define QUIT_MESSAGE "Player %N left the game (Disconnected by user.)"
public Plugin:myinfo =
{
name = "Admin Stealth",
author = "necavi",
description = "Allows administrators to become nearly completely invisible.",
version = VERSION,
url = "http://necavi.org/"
}
new bool:g_bIsInvisible[MAXPLAYERS + 1];
new g_iSpectateTarget[MAXPLAYERS + 1];
new Float:g_fLastSpecChange[MAXPLAYERS + 1];
new g_iOldTeam[MAXPLAYERS + 1];
new Handle:g_hHostname = INVALID_HANDLE;
public OnPluginStart()
{
CreateConVar("sm_adminstealth_version", VERSION);
CreateConVar("sm_adminstealth_build", BUILD);
RegAdminCmd("sm_stealth", Command_Stealth, ADMFLAG_CUSTOM3, "Allows an administrator to toggle complete invisibility on themselves.");
g_hHostname = FindConVar("hostname");
AddCommandListener(Command_JoinTeam, "jointeam");
AddCommandListener(Command_Status, "status");
HookEventEx("round_prestart", Event_RoundPrestart, EventHookMode_PostNoCopy);
HookEventEx("round_poststart", Event_RoundPoststart, EventHookMode_PostNoCopy);
}
public OnClientDisconnect(client)
{
if(g_bIsInvisible[client]) InvisOff(client, false);
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon, &subtype, &cmdnum, &tickcount, &seed, mouse[2])
{
if(g_bIsInvisible[client] && buttons & IN_JUMP && GetGameTime() > g_fLastSpecChange[client] + 1.0)
{
static current_target, new_target;
current_target = GetClientOfUserId(g_iSpectateTarget[client]);
for(new i = current_target + 1; i <= MaxClients + current_target; i++)
{
new_target = (i >= MaxClients) ? i % MaxClients : i;
PrintToChat(client, "current_target: %d new_target = %d", current_target, new_target);
if(new_target != client && ValidPlayer(new_target) && IsPlayerAlive(new_target))
{
g_iSpectateTarget[client] = GetClientUserId(new_target);
decl Float:target_origin[3], Float:target_angles[3];
GetClientAbsOrigin(new_target, target_origin);
GetClientEyeAngles(new_target, target_angles);
TeleportEntity(client, target_origin, target_angles, NULL_VECTOR);
g_fLastSpecChange[client] = GetGameTime();
return Plugin_Continue;
}
}
}
return Plugin_Continue;
}
public Action:Command_JoinTeam(client, const String:command[], args)
{
if(g_bIsInvisible[client])
{
PrintToChat(client, "[SM] Can not join team when in invisible mode!");
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action:Event_WeaponCanUse(client,weapon)
{
return Plugin_Handled;
}
public Action:Command_Status(client, const String:command[], args)
{
if(CheckCommandAccess(client, "sm_stealth", 0))
{
return Plugin_Continue;
}
decl String:buffer[64];
GetConVarString(g_hHostname,buffer,sizeof(buffer));
PrintToConsole(client,"hostname: %s",buffer);
PrintToConsole(client,"version : 1909615/24 1909615 secure");
GetCurrentMap(buffer,sizeof(buffer));
decl Float:vec[3];
GetClientAbsOrigin(client, vec);
PrintToConsole(client,"map : %s at: %.0f x, %.0f y, %.0f z", buffer, vec[0], vec[1], vec[2]);
PrintToConsole(client,"players : %d (%d max)", GetClientCount() - GetInvisCount(), MaxClients);
PrintToConsole(client,"# userid name uniqueid connected ping loss state");
decl String:name[18], String:steamID[19], String:time[9];
for(new i = 1; i <= MaxClients; i++)
{
if(ValidPlayer(i))
{
if(!g_bIsInvisible)
{
Format(name,sizeof(name),"\"%N\"",i);
#if SOURCEMOD_V_MAJOR > 1 || SOURCEMOD_V_MINOR > 5
GetClientAuthId(i,AuthId_Engine,steamID,sizeof(steamID));
#else
GetClientAuthString(i,steamID,sizeof(steamID));
#endif
if(!IsFakeClient(i))
{
FormatShortTime(RoundToFloor(GetClientTime(i)),time,sizeof(time));
PrintToConsole(client,"# %6d %-19s %19s %9s %4d %4d active", GetClientUserId(i),
name, steamID, time, RoundToFloor(GetClientAvgLatency(i,NetFlow_Both) * 1000.0),
RoundToFloor(GetClientAvgLoss(i,NetFlow_Both) * 100.0));
}
else
{
PrintToConsole(client,"# %6d %-19s %19s active", GetClientUserId(i), name, steamID);
}
}
}
}
return Plugin_Stop;
}
public Action:Command_Stealth(client, args)
{
if(client)
{
ToggleInvis(client);
LogAction(client, -1, "%N has toggled stealth mode.", client);
}
return Plugin_Handled;
}
ToggleInvis(client)
{
if(g_bIsInvisible[client]) InvisOff(client);
else InvisOn(client);
}
InvisOff(client, bool:stop=true, bool:announce=true)
{
g_bIsInvisible[client] = !announce;
if(stop)
{
SetEntProp(client, Prop_Send, "m_iTeamNum", g_iOldTeam[client]);
if(GetClientTeam(client) != SPECTATOR)
{
SetEntProp(client, Prop_Send, "m_lifeState", 0);
SetEntProp(client, Prop_Data, "m_takedamage", 2);
SetEntityMoveType(client, MOVETYPE_ISOMETRIC);
SDKUnhook(client, SDKHook_WeaponCanUse, Event_WeaponCanUse);
if(IsPlayerAlive(client)) GivePlayerItem(client, "weapon_knife");
if(announce) PrintToChat(client, "You are no longer in stealth mode.");
}
}
if(announce) PrintToChatAll(JOIN_MESSAGE, client);
}
InvisOn(client, bool:announce=true)
{
g_bIsInvisible[client] = true;
g_iOldTeam[client] = GetEntProp(client,Prop_Send,"m_iTeamNum");
SetEntProp(client, Prop_Send, "m_iTeamNum", 4);
if(GetClientTeam(client) != SPECTATOR)
{
SetEntProp(client, Prop_Send, "m_lifeState",2);
SetEntProp(client, Prop_Data, "m_takedamage",0);
SetEntityMoveType(client, MOVETYPE_NOCLIP);
new entity = CreateEntityByName("player_weaponstrip");
AcceptEntityInput(entity, "strip", client);
AcceptEntityInput(entity, "kill");
SDKHook(client, SDKHook_WeaponCanUse, Event_WeaponCanUse);
}
if(announce)
{
PrintToChat(client, "You are now in stealth mode.");
PrintToChatAll(QUIT_MESSAGE, client);
}
}
bool:ValidPlayer(client)
{
return client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client);
}
FormatShortTime(time, String:outTime[], size)
{
new temp;
temp = time % 60;
Format(outTime, size,"%02d",temp);
temp = (time % 3600) / 60;
Format(outTime, size,"%02d:%s", temp, outTime);
temp = (time % 86400) / 3600;
if(temp > 0)
{
Format(outTime, size, "%d%:s", temp, outTime);
}
}
GetInvisCount()
{
new count = 0;
for(new i = 1; i <= MaxClients; i++)
{
if(g_bIsInvisible)
{
count++;
}
}
return count;
}
public Event_RoundPrestart(Handle:event, String:name[], bool:dontBroadcast)
{
for (new i = 1; i <= MaxClients; ++i)
{
if(g_bIsInvisible) InvisOff(i, true, false);
}
}
public Event_RoundPoststart(Handle:event, String:name[], bool:dontBroadcast)
{
for (new i = 1; i <= MaxClients; ++i)
{
if(g_bIsInvisible) InvisOn(i, false);
}
}
L 06/01/2020 - 08:51:24: [SM] Exception reported: Array index out-of-bounds (index 100, limit 100)Palonez, проверяй
public Plugin:myinfo =
{
name = "Admins Autoregeneration HP",
author = "AlmazON",
description = "Авторегенерация HP Админов",
version = "1.0.0",
url = "http://www.hlmod.ru"
}
new Float:fRS, Handle:hTRA, iA[MAXPLAYERS-1], iAH, iAT, iOH, iP[MAXPLAYERS+1], iRF, iRP, iRU, String:sPH[32];
public OnPluginStart()
{
HookConVarChange(hTRA=CreateConVar("admin_regen_hp_flags", "", "Flags of the administration for access to regeneration.\n\"\" - all."), RF);
GetConVarString(hTRA,sPH,AdminFlags_TOTAL);
iRF = ReadFlagString(sPH[0] ? sPH:"abcdefghijklmnopqrstz");
HookConVarChange(hTRA=CreateConVar("admin_regen_hp_peak", "100", "The peak amount of regenerated health.",_, true,2.0), RP);
iRP = GetConVarInt(hTRA);
HookConVarChange(hTRA=CreateConVar("admin_regen_hp_speed", "1.0", "The speed of healing in seconds.",_, true,0.1), RS);
fRS = GetConVarFloat(hTRA);
HookConVarChange(hTRA=CreateConVar("admin_regen_hp_units", "2", "The number of units healing at a time.\n0 - disable.",_, true,0.0), RU);
RU(hTRA, sPH, sPH);
if((iOH=FindSendPropOffs("CCSPlayer", "m_iHealth"))==-1)
{
if(GameConfGetKeyValue((hTRA=LoadGameConfigFile("core.games")), "m_iHealth", sPH,sizeof(sPH))==false) sPH = "m_iHealth";
CloseHandle(hTRA);
}AutoExecConfig(_, "AdminsAutoregenerationHP");
}
public OnMapEnd() iAT = 0;
public OnRebuildAdminCache(AdminCachePart:P) if(iRU) if(P==AdminCache_Admins)
{
iAH = iAT;
iAT = 0;
for(new i=1; i<=MaxClients; ++i)
{
if(IsClientInGame(i)) if(GetClientTeam(i)>1) if(GetUserFlagBits(i) &iRF)
{
iP[iA[iAT]=i] = ++iAT;
continue;
}iP[i] = 0;
}if(iAH)
{
if(iAT==0) CloseHandle(hTRA);
}else if(iAT) TRA();
}
public RF(Handle:C, String:O[], const String:N[])
{
iRF = ReadFlagString(N[0] ? N:"abcdefghijklmnopqrstz");
OnRebuildAdminCache(AdminCache_Admins);
}
public RP(Handle:C, String:O[], String:N[]) iRP = GetConVarInt(C);
public RS(Handle:C, String:O[], String:N[])
{
fRS = GetConVarFloat(C);
if(iAT)
{
CloseHandle(hTRA);
TRA();
}
}
public RU(Handle:C, String:O[], String:N[]) if(iRU)
{
if((iRU=GetConVarInt(C))==0)
{
UnhookEvent("player_team", PT);
if(iAT)
{
iAT = 0;
CloseHandle(hTRA);
}
}
}else if((iRU=GetConVarInt(C)))
{
HookEvent("player_team", PT);
OnRebuildAdminCache(AdminCache_Admins);
}
public PT(Handle:E, String:N[], bool:B) if(GetEventInt(E,"oldteam") >1)
{
if(GetEventBool(E,"disconnect") || GetEventInt(E,"team") <2) if(iP[(iAH=GetClientOfUserId(GetEventInt(E,"userid")))])
{
if(--iAT) iP[iA[iP[iAH]-1]=iA[iAT]] = iP[iAH];
else CloseHandle(hTRA);
iP[iAH] = 0;
}
}else if(GetEventInt(E,"team") >1) if(GetUserFlagBits((iAH=GetClientOfUserId(GetEventInt(E,"userid")))) &iRF) if((iP[iA[iAT]=iAH]=++iAT)==1) TRA();
public Action:RA(Handle:T)
{
new i;
do if(0<(iAH=GetClientHealth(iA[i]))<iRP) SetEntProp(iA[i], Prop_Send,sPH, iAH+iRU<iRP ? iAH+iRU:iRP);
while(++i<iAT);
return Plugin_Continue;
}
public Action:RO(Handle:T)
{
new i;
do if(0<(iAH=GetEntData(iA[i], iOH))<iRP) SetEntData(iA[i], iOH, iAH+iRU<iRP ? iAH+iRU:iRP);
while(++i<iAT);
return Plugin_Continue;
}
TRA() hTRA = CreateTimer(fRS, iOH==-1 ? RA:RO, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
FindSendPropOffs на FindSendPropInfo или HasEntPropподправил форматирование текста,заменилПривет что это за ошибка при комиле.Игра Counter-Strike Source v.34
warning 234: symbol "FindSendPropOffs" is marked as deprecated: Use FindSendPropInfo instead, or HasEntProp if you just want to check for existence.И как избавится?AdminsAutoregenerationHP:public Plugin:myinfo = { name = "Admins Autoregeneration HP", author = "AlmazON", description = "Авторегенерация HP Админов", version = "1.0.0", url = "http://www.hlmod.ru" } new Float:fRS, Handle:hTRA, iA[MAXPLAYERS-1], iAH, iAT, iOH, iP[MAXPLAYERS+1], iRF, iRP, iRU, String:sPH[32]; public OnPluginStart() { HookConVarChange(hTRA=CreateConVar("admin_regen_hp_flags", "", "Flags of the administration for access to regeneration.\n\"\" - all."), RF); GetConVarString(hTRA,sPH,AdminFlags_TOTAL); iRF = ReadFlagString(sPH[0] ? sPH:"abcdefghijklmnopqrstz"); HookConVarChange(hTRA=CreateConVar("admin_regen_hp_peak", "100", "The peak amount of regenerated health.",_, true,2.0), RP); iRP = GetConVarInt(hTRA); HookConVarChange(hTRA=CreateConVar("admin_regen_hp_speed", "1.0", "The speed of healing in seconds.",_, true,0.1), RS); fRS = GetConVarFloat(hTRA); HookConVarChange(hTRA=CreateConVar("admin_regen_hp_units", "2", "The number of units healing at a time.\n0 - disable.",_, true,0.0), RU); RU(hTRA, sPH, sPH); if((iOH=FindSendPropOffs("CCSPlayer", "m_iHealth"))==-1) { if(GameConfGetKeyValue((hTRA=LoadGameConfigFile("core.games")), "m_iHealth", sPH,sizeof(sPH))==false) sPH = "m_iHealth"; CloseHandle(hTRA); }AutoExecConfig(_, "AdminsAutoregenerationHP"); } public OnMapEnd() iAT = 0; public OnRebuildAdminCache(AdminCachePart:P) if(iRU) if(P==AdminCache_Admins) { iAH = iAT; iAT = 0; for(new i=1; i<=MaxClients; ++i) { if(IsClientInGame(i)) if(GetClientTeam(i)>1) if(GetUserFlagBits(i) &iRF) { iP[iA[iAT]=i] = ++iAT; continue; }iP[i] = 0; }if(iAH) { if(iAT==0) CloseHandle(hTRA); }else if(iAT) TRA(); } public RF(Handle:C, String:O[], const String:N[]) { iRF = ReadFlagString(N[0] ? N:"abcdefghijklmnopqrstz"); OnRebuildAdminCache(AdminCache_Admins); } public RP(Handle:C, String:O[], String:N[]) iRP = GetConVarInt(C); public RS(Handle:C, String:O[], String:N[]) { fRS = GetConVarFloat(C); if(iAT) { CloseHandle(hTRA); TRA(); } } public RU(Handle:C, String:O[], String:N[]) if(iRU) { if((iRU=GetConVarInt(C))==0) { UnhookEvent("player_team", PT); if(iAT) { iAT = 0; CloseHandle(hTRA); } } }else if((iRU=GetConVarInt(C))) { HookEvent("player_team", PT); OnRebuildAdminCache(AdminCache_Admins); } public PT(Handle:E, String:N[], bool:B) if(GetEventInt(E,"oldteam") >1) { if(GetEventBool(E,"disconnect") || GetEventInt(E,"team") <2) if(iP[(iAH=GetClientOfUserId(GetEventInt(E,"userid")))]) { if(--iAT) iP[iA[iP[iAH]-1]=iA[iAT]] = iP[iAH]; else CloseHandle(hTRA); iP[iAH] = 0; } }else if(GetEventInt(E,"team") >1) if(GetUserFlagBits((iAH=GetClientOfUserId(GetEventInt(E,"userid")))) &iRF) if((iP[iA[iAT]=iAH]=++iAT)==1) TRA(); public Action:RA(Handle:T) { new i; do if(0<(iAH=GetClientHealth(iA[i]))<iRP) SetEntProp(iA[i], Prop_Send,sPH, iAH+iRU<iRP ? iAH+iRU:iRP); while(++i<iAT); return Plugin_Continue; } public Action:RO(Handle:T) { new i; do if(0<(iAH=GetEntData(iA[i], iOH))<iRP) SetEntData(iA[i], iOH, iAH+iRU<iRP ? iAH+iRU:iRP); while(++i<iAT); return Plugin_Continue; } TRA() hTRA = CreateTimer(fRS, iOH==-1 ? RA:RO, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
FindSendPropOffs на FindSendPropInfo
#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);
}
Данный плагин работает для всех. Кто может добавить работу только для админов? Начиная с флага bC++:#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); }
#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)
{
int client = GetClientOfUserId(id);
if (client < 1)
return Plugin_Stop;
if(GetUserFlagBits(client) & ADMFLAG_BAN)
{
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);
}
C++:#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) { int client = GetClientOfUserId(id) != 0; if(GetUserFlagBits(client) & ADMFLAG_BAN) { 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); }
L 06/02/2020 - 15:38:31: Info (map "$2000$_muha") (file "/cstrike/addons/sourcemod/logs/errors_20200602.log")
L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid
L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx
L 06/02/2020 - 15:38:31: [SM] Call stack trace:
L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits
L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer
L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid
L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx
L 06/02/2020 - 15:38:31: [SM] Call stack trace:
L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits
L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer
L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid
L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx
L 06/02/2020 - 15:38:31: [SM] Call stack trace:
L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits
L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer
L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid
L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx
L 06/02/2020 - 15:38:31: [SM] Call stack trace:
L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits
L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer
L 06/02/2020 - 15:38:53: Error log file session closed
изменил выше пробуйC-подобный:L 06/02/2020 - 15:38:31: Info (map "$2000$_muha") (file "/cstrike/addons/sourcemod/logs/errors_20200602.log") L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx L 06/02/2020 - 15:38:31: [SM] Call stack trace: L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx L 06/02/2020 - 15:38:31: [SM] Call stack trace: L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx L 06/02/2020 - 15:38:31: [SM] Call stack trace: L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer L 06/02/2020 - 15:38:31: [SM] Exception reported: Client index 0 is invalid L 06/02/2020 - 15:38:31: [SM] Blaming: wh_cl_d.smx L 06/02/2020 - 15:38:31: [SM] Call stack trace: L 06/02/2020 - 15:38:31: [SM] [0] GetUserFlagBits L 06/02/2020 - 15:38:31: [SM] [1] Line 49, C:\sourcemod\scripting\wh_cl_d.sp::player_spawn_Timer L 06/02/2020 - 15:38:53: Error log file session closed