Drumanid
Нестандартное звание
- Сообщения
- 1,862
- Реакции
- 1,748
Помогите исправить ошибку, флудит в логи...
Смотрите под спойлером.
Исходник:
Смотрите под спойлером.
L 07/18/2016 - 18:13:05: [SM] Exception reported: Entity 4 (4) is invalid
L 07/18/2016 - 18:13:05: [SM] Blaming: DisableRadar.smx()
L 07/18/2016 - 18:13:05: [SM] Call stack trace:
L 07/18/2016 - 18:13:05: [SM] [0] GetEntProp
L 07/18/2016 - 18:13:05: [SM] [1] Line 33, /home/forums/content/files/2/4/8/3/8/6/133573.attach::RemoveRadar()
L 07/18/2016 - 18:13:05: [SM] Blaming: DisableRadar.smx()
L 07/18/2016 - 18:13:05: [SM] Call stack trace:
L 07/18/2016 - 18:13:05: [SM] [0] GetEntProp
L 07/18/2016 - 18:13:05: [SM] [1] Line 33, /home/forums/content/files/2/4/8/3/8/6/133573.attach::RemoveRadar()
Исходник:
PHP:
#include <sourcemod>
#define HIDE_RADAR_CSGO 1<<12
new String:strGame[10];
public Plugin:myinfo =
{
name = "Disable Radar",
author = "Internet Bully",
description = "Turns off Radar on spawn",
version = "1.2",
url = "http://www.sourcemod.net/"
}
public OnPluginStart()
{
HookEvent("player_spawn", Player_Spawn);
GetGameFolderName(strGame, sizeof(strGame));
if(StrContains(strGame, "cstrike") != -1)
HookEvent("player_blind", Event_PlayerBlind, EventHookMode_Post);
}
public Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
CreateTimer(0.0, RemoveRadar, GetEventInt(event, "userid"));
}
public Action:RemoveRadar(Handle:timer, any:userid)
{
new client = GetClientOfUserId(userid);
if(StrContains(strGame, "csgo") != -1)
SetEntProp(client, Prop_Send, "m_iHideHUD", HIDE_RADAR_CSGO);
else if(StrContains(strGame, "cstrike") != -1)
CSSHideRadar(client);
}
public Event_PlayerBlind(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
if (client && GetClientTeam(client) > 1)
{
new Float:fDuration = GetEntPropFloat(client, Prop_Send, "m_flFlashDuration");
CreateTimer(fDuration, RemoveRadar, client);
}
}
CSSHideRadar(client)
{
SetEntPropFloat(client, Prop_Send, "m_flFlashDuration", 3600.0);
SetEntPropFloat(client, Prop_Send, "m_flFlashMaxAlpha", 0.5);
}