Nekro
Терра инкогнита
- Сообщения
- 4,042
- Реакции
- 2,295
Доброго времени суток
Сыпит ошибки не могу понять, что не так. Подмогите пожалуйста
Ошибки
Плагин
Сыпит ошибки не могу понять, что не так. Подмогите пожалуйста
Ошибки
C-подобный:
L 07/12/2020 - 00:00:34: [SM] Exception reported: Invalid convar handle 0 (error 4)
L 07/12/2020 - 00:00:34: [SM] Blaming: end_effect.smx
L 07/12/2020 - 00:00:34: [SM] Call stack trace:
L 07/12/2020 - 00:00:34: [SM] [0] SetConVarInt
L 07/12/2020 - 00:00:34: [SM] [1] Line 66, end_effect.sp::OnEnd
L 07/12/2020 - 00:00:45: [SM] Exception reported: Invalid convar handle 0 (error 4)
L 07/12/2020 - 00:00:45: [SM] Blaming: end_effect.smx
L 07/12/2020 - 00:00:45: [SM] Call stack trace:
L 07/12/2020 - 00:00:45: [SM] [0] SetConVarInt
L 07/12/2020 - 00:00:45: [SM] [1] Line 54, end_effect.sp::OnStart
Плагин
C-подобный:
Handle gravity,
hgravitye,
hgravitys,
res_other,
hres_othere,
hres_others,
forcecamera,
hforcecamerae,
hforcecameras;
bool bEnable;
float speed;
public Plugin myinfo =
{
name = "Round end effect",
description = "Скорость, гравитация и т.д. в конце раунда",
author = "Nek.'a 2x2",
version = "1.2",
url = "https://ggwp.site/"
};
public void OnPluginStart()
{
ConVar cvar;
cvar = CreateConVar("sm_endef_enable", "1", "Включить/выключить плагин", _, true, _, true, 1.0);
cvar.AddChangeHook(CVarChanged_Enable);
bEnable = cvar.BoolValue;
cvar = CreateConVar("sm_endef_speed", "2.0", "Скорость в конце рануда", _, true, 1.0);
cvar.AddChangeHook(CVarChanged_Start);
speed = cvar.FloatValue;
hgravitye = CreateConVar("sm_endef_gravitye", "200", "Уровень гравитации в конце раунда");
hgravitys = CreateConVar("sm_endef_gravitys", "800", "Уровень гравитации в начале раунда");
gravity = FindConVar("sv_gravity");
hres_othere = CreateConVar("sm_endef_res_othere", "1", "Время воскрешение для обычных игроков в конце раунда");
hres_others = CreateConVar("sm_endef_res_others", "6", "Время воскрешение для обычных игроков в начале раунда");
res_other = FindConVar("sm_resurrection_other_time");
hforcecamerae = CreateConVar("sm_endef_forcecamerae", "0", "Заморозка камеры в конце раунда");
hforcecameras = CreateConVar("sm_endef_forcecameras", "1", "Заморозка камеры в начале раунда");
forcecamera = FindConVar("mp_forcecamera");
HookEvent("round_start", OnStart);
HookEvent("round_end", OnEnd);
AutoExecConfig(true, "end_effect");
}
public void CVarChanged_Enable(ConVar CVar, const char[] oldValue, const char[] newValue){bEnable = CVar.BoolValue;}
public void CVarChanged_Start(ConVar cvar, const char[] oldValue, const char[] newValue){speed = cvar.FloatValue;}
public void OnStart(Handle event, char[] name, bool dontBroadcast)
{
int gravitys = GetConVarInt(hgravitys);
int forcecameras = GetConVarInt(hforcecameras);
int res_others = GetConVarInt(hres_others);
if(bEnable)
SetConVarInt(gravity, gravitys);
SetConVarInt(res_other, res_others);
SetConVarInt(forcecamera, forcecameras);
}
public void OnEnd(Handle event, char[] name, bool dontBroadcast)
{
int gravitye = GetConVarInt(hgravitye);
int forcecamerae = GetConVarInt(hforcecamerae);
int res_othere = GetConVarInt(hres_othere);
if(bEnable)
SetConVarInt(gravity, gravitye);
SetConVarInt(forcecamera, forcecamerae);
SetConVarInt(res_other, res_othere);
for(int i = 1; i <= MaxClients; i++) if (IsClientInGame(i))
{
SetEntPropFloat(i, Prop_Data, "m_flLaggedMovementValue", speed);
}
}