CS:Source v34 SDKHooks_TakeDamage

Сообщения
9
Реакции
-1
Ошибка
CS:Source v34 [SM] Native "SDKHooks_TakeDamage" reported: SDKHooks_TakeDamage is not supported on this engine.
Список плагинов
01 "Admin File Reader" (1.7.3-stable+5265) by AlliedModders LLC
02 "Admin Help" (1.7.3-stable+5265) by AlliedModders LLC
03 "Admin Menu" (1.7.3-stable+5265) by AlliedModders LLC
04 "Advertisements" (0.6.2) by Tsunami, Otstrel.ru Team
05 "Ammo" (1.1) by wS / Schmidt
06 "Anti-Flood" (1.7.3-stable+5265) by AlliedModders LLC
07 "Basic Ban Commands" (1.7.3-stable+5265) by AlliedModders LLC
08 "Basic Chat" (1.7.3-stable+5265) by AlliedModders LLC
09 "Basic Comm Control" (1.7.3-stable+5265) by AlliedModders LLC
10 "Basic Commands" (1.7.3-stable+5265) by AlliedModders LLC
11 "Basic Info Triggers" (1.7.3-stable+5265) by AlliedModders LLC
12 "Basic Votes" (1.7.3-stable+5265) by AlliedModders LLC
13 "Client Preferences" (1.7.3-stable+5265) by AlliedModders LLC
14 "Connect_info" (2.0) by R1KO
15 "Fun Commands" (1.7.3-stable+5265) by AlliedModders LLC
16 "Fun Votes" (1.7.3-stable+5265) by AlliedModders LLC
17 "GameVoting" (1.8.8) by Neatek
18 "he.smx"
19 "Join Sound" (1.2) by wS
20 "MapChooser" (1.7.3-stable+5265) by AlliedModders LLC
21 "Nextmap" (1.7.3-stable+5265) by AlliedModders LLC
22 "Map Nominations" (1.7.3-stable+5265) by AlliedModders LLC
23 "Player Commands" (1.7.3-stable+5265) by AlliedModders LLC
24 "Player Class Model" (1.3_1) by wS / Schmidt (╨Ф╨╛╨┐. EPacker2 - ╨┐╤Г╤В╤М ╨║ ╤Б╨║╨░╤З╨║╨░╨╝)
25 "Quake Sounds" (2.7) by dalto, Grrrrrrrrrrrrrrrrrrr, and psychonic
26 "Reserved Slots" (1.7.3-stable+5265) by AlliedModders LLC
27 "Resetscore+" (1.5.1) by AlmazON
28 "Rock The Vote" (1.7.3-stable+5265) by AlliedModders LLC
29 "Rules" (1.1) by wS (World-Source.Ru)
30 "[Shop] Core" (2.0.22) by FrozDark
31 "[Shop] Equipments" (2.1.1) by FrozDark
32 "[Shop] Money Distributor" (1.4.3) by FrozDark (HLModders LLC)
33 "[Shop] Top10 Function" (2.0.1) by FrozDark
34 "[Shop] Trails" (2.2.3) by FrozDark (HLModders LLC)
35 "SM Super Commands" (0.60) by pRED*
36 "SM Super Menu" (0.5) by pRED*
37 "SoDStats" (1.0.11) by ]SoD[ Frostbyte
38 "Sound Commands" (1.7.3-stable+5265) by AlliedModders LLC
39 "Spectator Switch" (1.1) by HSFighter
40 "stop_sound.smx"
41 "Zombie:Reloaded" (3.1) by Greyscale | Richard Helgeby
42 "Zstuck" (0.4) by SoZika
Версия SourceMod
1.7.3
ОС
Windows
Версия Metamod
1.10.6
Исходный код
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <zombiereloaded>

#define SLOW_SMOKE_EFFECT "models/props/slow/smoke_effect/slow_smoke_effect.mdl"

public Plugin:myinfo =
{
name = "ZR Poison Nade",
author = "POMKA",
description = "Poison Nade for Zombie mod",
version = "1.0",
url = "http://IbizaGaming.ru/"
};

new Handle:g_hSmokeGrenades;

new Handle:g_hCVSeconds, Handle:g_hCVDamage, Handle:g_hCVSmokeTime, Handle:g_hCVEnable, Handle:g_hCVDistance;

new bool:g_bEnable;

public OnPluginStart()
{
g_hCVEnable = CreateConVar("sm_poisonnade_enable", "1", "1 - enable, 0 - disable plugin", _, true, 0.0, true, 1.0);
g_hCVDamage = CreateConVar("sm_poisonnade_damage", "1", "How much damage should we deal to the players in the smoke?", FCVAR_PLUGIN, true, 0.0);
g_hCVSeconds = CreateConVar("sm_poisonname_seconds", "1", "Deal damage every x seconds.", FCVAR_PLUGIN, true, 1.0);
g_hCVSmokeTime = CreateConVar("sm_poisonnade_smoketime", "25", "Smoke time in seconds");
g_hCVDistance = CreateConVar("sm_poisonname_distance", "220", "Distance of take damage");

g_bEnable = GetConVarBool(g_hCVEnable);
HookConVarChange(g_hCVEnable, OnConVarChange);

g_hSmokeGrenades = CreateArray();

HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
HookEvent("round_start", Event_RoundStart);

AutoExecConfig(true, "zr_poison_nade");
}

public OnMapStart()
{
AddFileToDownloadsTable(SLOW_SMOKE_EFFECT);
AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.vvd");
AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.dx80.vtx");
AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.dx90.vtx");
AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.sw.vtx");
AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.xbox.vtx");

AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect.vmt");
AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect.vtf");
AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect_2.vmt");
AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect_2.vtf");

PrecacheModel(SLOW_SMOKE_EFFECT, false);
}

public OnMapEnd()
{
if(!g_bEnable)
return;

new iSize = GetArraySize(g_hSmokeGrenades);
new Handle:hGrenade, Handle:hTimer;
for(new i=0; i<iSize; i++)
{
hGrenade = GetArrayCell(g_hSmokeGrenades, i);
if(GetArraySize(hGrenade) > 3)
{
hTimer = GetArrayCell(hGrenade, 3);
KillTimer(hTimer);
hTimer = GetArrayCell(hGrenade, 4);
if(hTimer != INVALID_HANDLE)
KillTimer(hTimer);
}
CloseHandle(hGrenade);
}
ClearArray(g_hSmokeGrenades);
}

public OnConVarChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
if(convar == g_hCVEnable)
g_bEnable = GetConVarBool(g_hCVEnable);
}

public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
if(!g_bEnable)
return;

new iSize = GetArraySize(g_hSmokeGrenades);
new Handle:hGrenade, Handle:hTimer;
for(new i=0; i<iSize; i++)
{
hGrenade = GetArrayCell(g_hSmokeGrenades, i);
if(GetArraySize(hGrenade) > 3)
{
hTimer = GetArrayCell(hGrenade, 3);
KillTimer(hTimer);
hTimer = GetArrayCell(hGrenade, 4);
if(hTimer != INVALID_HANDLE)
KillTimer(hTimer);
}
CloseHandle(hGrenade);
}
ClearArray(g_hSmokeGrenades);
}

public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
if(!g_bEnable)
return Plugin_Continue;

decl String:sWeapon[64];
GetEventString(event, "weapon", sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon, "env_smokestack"))
{
SetEventString(event, "weapon", "flashbang");
}
return Plugin_Continue;
}

public OnEntityCreated(entity, const String:classname[])
{
if(StrEqual(classname, "smokegrenade_projectile", false))
SDKHook(entity, SDKHook_Spawn, Hook_OnSpawnProjectile);

if(StrEqual(classname, "env_particlesmokegrenade", false))
SDKHook(entity, SDKHook_Spawn, Hook_OnSpawnParticles);
}

public Hook_OnSpawnProjectile(entity)
{
if(!g_bEnable)
return;

new client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");

if(!IsClientInGame(client))
return;

new Handle:hGrenade = CreateArray();
PushArrayCell(hGrenade, client);
PushArrayCell(hGrenade, entity);
PushArrayCell(g_hSmokeGrenades, hGrenade);
}

public Hook_OnSpawnParticles(entity)
{
if(!g_bEnable)
return;

new Float:fOrigin[3], Float:fOriginSmoke[3];
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fOrigin);

new iSize = GetArraySize(g_hSmokeGrenades);
new Handle:hGrenade, iGrenade;
for(new i = 0; i < iSize; i++)
{
hGrenade = GetArrayCell(g_hSmokeGrenades, i);
iGrenade = GetArrayCell(hGrenade, 1);
GetEntPropVector(iGrenade, Prop_Send, "m_vecOrigin", fOriginSmoke);

if(fOrigin[0] == fOriginSmoke[0] && fOrigin[1] == fOriginSmoke[1] && fOrigin[2] == fOriginSmoke[2])
{
AcceptEntityInput(entity, "Kill");

new SmokeEntity = CreateEntityByName("env_smokestack");
DispatchKeyValue(SmokeEntity, "SmokeMaterial", "particle/particle_smokegrenade.vmt");
DispatchKeyValue(SmokeEntity, "basespread", "30");
DispatchKeyValue(SmokeEntity, "spreadspeed", "5");
DispatchKeyValue(SmokeEntity, "speed", "5");
DispatchKeyValue(SmokeEntity, "startsize", "100");
DispatchKeyValue(SmokeEntity, "endsize", "100");
DispatchKeyValue(SmokeEntity, "rate", "5");
DispatchKeyValue(SmokeEntity, "jetlength", "30");
DispatchKeyValue(SmokeEntity, "renderamt", "200");
DispatchKeyValue(SmokeEntity, "Translucency", "150");
DispatchKeyValue(SmokeEntity, "rendercolor", "124 252 0");
DispatchSpawn(SmokeEntity);
TeleportEntity(SmokeEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
AcceptEntityInput(SmokeEntity, "TurnOn");
PushArrayCell(hGrenade, SmokeEntity);

new Handle:hTimer = CreateTimer(GetConVarFloat(g_hCVSmokeTime), Timer_RemoveSmoke, SmokeEntity, TIMER_FLAG_NO_MAPCHANGE);
PushArrayCell(hGrenade, hTimer);

new Handle:hTimer2 = INVALID_HANDLE;
hTimer2 = CreateTimer(GetConVarFloat(g_hCVSeconds), Timer_CheckDamage, EntIndexToEntRef(SmokeEntity), TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
PushArrayCell(hGrenade, hTimer2);

new slow_smoke_effect_ent = CreateEntityByName("prop_dynamic");
DispatchKeyValueVector(slow_smoke_effect_ent, "origin", fOrigin);
DispatchKeyValue(slow_smoke_effect_ent, "model", SLOW_SMOKE_EFFECT);
AcceptEntityInput(slow_smoke_effect_ent, "DisableCollision");
DispatchSpawn(slow_smoke_effect_ent);
SetEntityMoveType(slow_smoke_effect_ent, MOVETYPE_NONE);
TeleportEntity(slow_smoke_effect_ent, fOrigin, NULL_VECTOR, NULL_VECTOR);
PushArrayCell(hGrenade, slow_smoke_effect_ent);

break;
}
}
}

public Action:Timer_RemoveSmoke(Handle:timer, any:entity)
{
new iSize = GetArraySize(g_hSmokeGrenades);
new Handle:hGrenade, iGrenade = -1;
for(new i=0; i<iSize; i++)
{
hGrenade = GetArrayCell(g_hSmokeGrenades, i);
if(GetArraySize(hGrenade) > 3)
{
iGrenade = GetArrayCell(hGrenade, 2);
if(iGrenade == entity)
{
AcceptEntityInput(entity, "TurnOff");
AcceptEntityInput(entity, "Kill");

new Handle:hTimer = GetArrayCell(hGrenade, 4);

if(hTimer != INVALID_HANDLE)
KillTimer(hTimer);

new slow_smoke_effect_ent = GetArrayCell(hGrenade, 5);
if(IsValidEdict(slow_smoke_effect_ent))
AcceptEntityInput(slow_smoke_effect_ent, "Kill");

RemoveFromArray(g_hSmokeGrenades, i);
break;
}
}
}

return Plugin_Stop;
}

public Action:Timer_CheckDamage(Handle:timer, any:entityref)
{
new entity = EntRefToEntIndex(entityref);
if(entity == INVALID_ENT_REFERENCE)
return Plugin_Continue;

new iSize = GetArraySize(g_hSmokeGrenades);
new Handle:hGrenade, iGrenade = -1;
for(new i=0; i<iSize; i++)
{
hGrenade = GetArrayCell(g_hSmokeGrenades, i);
if(GetArraySize(hGrenade) > 3)
{
iGrenade = GetArrayCell(hGrenade, 2);
if(iGrenade == entity)
break;
}
}

if(iGrenade == -1)
return Plugin_Continue;

new client = GetArrayCell(hGrenade, 0);
if(!client || !IsClientInGame(client) || !IsPlayerAlive(client))
return Plugin_Continue;

if(ZR_IsClientZombie(client))
{
RemoveSmoke(entity);
return Plugin_Continue;
}

new Float:fSmokeOrigin[3], Float:fOrigin[3];
GetEntPropVector(iGrenade, Prop_Send, "m_vecOrigin", fSmokeOrigin);

for(new i=1;i<=MaxClients;i++)
{
if(IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientZombie(i))
{
GetClientAbsOrigin(i, fOrigin);
if(GetVectorDistance(fSmokeOrigin, fOrigin) <= GetConVarInt(g_hCVDistance))
SDKHooks_TakeDamage(i, iGrenade, client, GetConVarFloat(g_hCVDamage), DMG_POISON, -1, NULL_VECTOR, fSmokeOrigin);
}
}

return Plugin_Continue;
}

RemoveSmoke(entity)
{
new iSize = GetArraySize(g_hSmokeGrenades);
new Handle:hGrenade, iGrenade = -1;
for(new i=0; i<iSize; i++)
{
hGrenade = GetArrayCell(g_hSmokeGrenades, i);
if(GetArraySize(hGrenade) > 3)
{
iGrenade = GetArrayCell(hGrenade, 2);
if(iGrenade == entity)
{
AcceptEntityInput(entity, "TurnOff");
AcceptEntityInput(entity, "Kill");

new Handle:hTimer = GetArrayCell(hGrenade, 4);

if(hTimer != INVALID_HANDLE)
KillTimer(hTimer);

new slow_smoke_effect_ent = GetArrayCell(hGrenade, 5);
if(IsValidEdict(slow_smoke_effect_ent))
AcceptEntityInput(slow_smoke_effect_ent, "Kill");

RemoveFromArray(g_hSmokeGrenades, i);
break;
}
}
}
}
CS:Source v34 Не поддерживает данную структуру SDKHooks_TakeDamage
Можете помочь и сделать через Player_hurt или как он там Point_hurt точно не знаю
Плагин работает визуально но не наносит урон(
 

Вложения

  • 11.1 KB Просмотры: 3
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Вместо 284 строки добавь блок кода, где будет проверка на здоровье и его уменьшение, либо смерть.
 
Сообщения
9
Реакции
-1
fl0wer, Будь добор помоги пожалуйста я не шарю в этом нихера (((
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Kewn, к сожалению не могу помочь, потому что я не разработчик.
 
Сообщения
9
Реакции
-1
fl0wer, Хммм чет я не много в шоке :crazy: В каком плане не разработчик?



В общем у меня такой вопрос есть такая штука

C++:
stock TakeDamage(Victim, Damage, Attacker = 0, DamageType = DMG_GENERIC, String:WeaponName[] = "")

{
    if(Victim > 0 && IsValidEdict(Victim) && IsClientInGame(Victim) && IsPlayerAlive(Victim) && Damage > 0)
    {
        new String:sDamage[16];
        IntToString(Damage, sDamage, 16);
        new String:sDamageType[32];
        IntToString(DamageType, sDamageType, 32);
        new pointHurt = CreateEntityByName("point_hurt");
        if(pointHurt)
        {
            DispatchKeyValue(Victim, "targetname", "war3_hurtme");
            DispatchKeyValue(pointHurt, "DamageTarget", "war3_hurtme");
            DispatchKeyValue(pointHurt, "Damage", sDamage);
            DispatchKeyValue(pointHurt, "DamageType", sDamageType);
            if(!StrEqual(WeaponName, ""))
            {
                DispatchKeyValue(pointHurt, "classname", WeaponName);
            }
            DispatchSpawn(pointHurt);
            AcceptEntityInput(pointHurt, "Hurt", Attacker > 0 ? Attacker : -1);
            DispatchKeyValue(pointHurt, "classname", "point_hurt");
            DispatchKeyValue(Victim, "targetname", "war3_donthurtme");
            RemoveEdict(pointHurt);
        }
    }
}

вместо
C++:
native void SDKHooks_TakeDamage(int entity, int inflictor, int attacker,
        float damage, int damageType=DMG_GENERIC, int weapon=-1,
        const float damageForce[3]=NULL_VECTOR, const float damagePosition[3]=NULL_VECTOR);

Выглядит в коде плагина вот так:


C++:
 //SDKHooks_TakeDamage(target, client, client, 0.0, DMG_ACID);
        TakeDamage(target, 0, client, DMG_ACID);

Что с этим делать ???
 
Сообщения
9
Реакции
-1
fl0wer, А как мне быть я вообще беспомощный в этом плане
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Один раз показываю, запоминай

Код:
            {
                new iResultHP = GetEntProp(i, Prop_Send, "m_iHealth") - GetConVarInt(g_hCVDamage);

                if (iResultHP > 0)
                    SetEntProp(i, Prop_Send, "m_iHealth", iResultHP);
                else
                    ForcePlayerSuicide(i);
            }
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
ну ты фигню какую-то сделал, у тебя ошибки.
 
Сообщения
9
Реакции
-1
fl0wer, Короче все скомпелировал но толку ноль дамаг все также не наноситься
а ошибка пропала)
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
молодец, так держать, думаю в 2020 мы даже увидим то, что ты там сделал.
 
Сообщения
9
Реакции
-1
fl0wer, Короче зобяков не коцает и даже их не убивает
C++:
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <zombiereloaded>

#define SLOW_SMOKE_EFFECT "models/props/slow/smoke_effect/slow_smoke_effect.mdl"

public Plugin:myinfo =
{
    name = "ZR Poison Nade",
    author = "POMKA",
    description = "Poison Nade for Zombie mod",
    version = "1.0",
    url = "http://IbizaGaming.ru/"
};

new Handle:g_hSmokeGrenades;

new Handle:g_hCVSeconds, Handle:g_hCVDamage, Handle:g_hCVSmokeTime, Handle:g_hCVEnable, Handle:g_hCVDistance;

new bool:g_bEnable;

public OnPluginStart()
{
    g_hCVEnable = CreateConVar("sm_poisonnade_enable", "1", "1 - enable, 0 - disable plugin",  _, true, 0.0, true, 1.0);
    g_hCVDamage = CreateConVar("sm_poisonnade_damage", "1", "How much damage should we deal to the players in the smoke?", FCVAR_PLUGIN, true, 0.0);
    g_hCVSeconds = CreateConVar("sm_poisonname_seconds", "1", "Deal damage every x seconds.", FCVAR_PLUGIN, true, 1.0);
    g_hCVSmokeTime = CreateConVar("sm_poisonnade_smoketime", "25", "Smoke time in seconds");
    g_hCVDistance = CreateConVar("sm_poisonname_distance", "220", "Distance of take damage");
  
    g_bEnable = GetConVarBool(g_hCVEnable);
    HookConVarChange(g_hCVEnable, OnConVarChange);
  
    g_hSmokeGrenades = CreateArray();
  
    HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
    HookEvent("round_start", Event_RoundStart);
  
    AutoExecConfig(true, "zr_poison_nade");
}

public OnMapStart()
{
    AddFileToDownloadsTable(SLOW_SMOKE_EFFECT);
    AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.vvd");
    AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.dx80.vtx");
    AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.dx90.vtx");
    AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.sw.vtx");
    AddFileToDownloadsTable("models/props/slow/smoke_effect/slow_smoke_effect.xbox.vtx");
  
    AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect.vmt");
    AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect.vtf");
    AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect_2.vmt");
    AddFileToDownloadsTable("materials/models/props/slow/smoke_effect/slow_smoke_effect_2.vtf");
  
    PrecacheModel(SLOW_SMOKE_EFFECT, false);
}

public OnMapEnd()
{
    if(!g_bEnable)
        return;
  
    new iSize = GetArraySize(g_hSmokeGrenades);
    new Handle:hGrenade, Handle:hTimer;
    for(new i=0; i<iSize; i++)
    {
        hGrenade = GetArrayCell(g_hSmokeGrenades, i);
        if(GetArraySize(hGrenade) > 3)
        {
            hTimer = GetArrayCell(hGrenade, 3);
            KillTimer(hTimer);
            hTimer = GetArrayCell(hGrenade, 4);
            if(hTimer != INVALID_HANDLE)
                KillTimer(hTimer);
        }
        CloseHandle(hGrenade);
    }
    ClearArray(g_hSmokeGrenades);
}

public OnConVarChange(Handle:convar, const String:oldValue[], const String:newValue[])
{
    if(convar == g_hCVEnable)
        g_bEnable = GetConVarBool(g_hCVEnable);
}

public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(!g_bEnable)
        return;
  
    new iSize = GetArraySize(g_hSmokeGrenades);
    new Handle:hGrenade, Handle:hTimer;
    for(new i=0; i<iSize; i++)
    {
        hGrenade = GetArrayCell(g_hSmokeGrenades, i);
        if(GetArraySize(hGrenade) > 3)
        {
            hTimer = GetArrayCell(hGrenade, 3);
            KillTimer(hTimer);
            hTimer = GetArrayCell(hGrenade, 4);
            if(hTimer != INVALID_HANDLE)
                KillTimer(hTimer);
        }
        CloseHandle(hGrenade);
    }
    ClearArray(g_hSmokeGrenades);
}

public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(!g_bEnable)
        return Plugin_Continue;
  
    decl String:sWeapon[64];
    GetEventString(event, "weapon", sWeapon, sizeof(sWeapon));
    if(StrEqual(sWeapon, "env_smokestack"))
    {
        SetEventString(event, "weapon", "flashbang");
    }
    return Plugin_Continue;
}

public OnEntityCreated(entity, const String:classname[])
{
    if(StrEqual(classname, "smokegrenade_projectile", false))
        SDKHook(entity, SDKHook_Spawn, Hook_OnSpawnProjectile);
  
    if(StrEqual(classname, "env_particlesmokegrenade", false))
        SDKHook(entity, SDKHook_Spawn, Hook_OnSpawnParticles);
}

public Hook_OnSpawnProjectile(entity)
{
    if(!g_bEnable)
        return;
  
    new client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
  
    if(!IsClientInGame(client))
        return;
  
    new Handle:hGrenade = CreateArray();
    PushArrayCell(hGrenade, client);
    PushArrayCell(hGrenade, entity);
    PushArrayCell(g_hSmokeGrenades, hGrenade);
}

public Hook_OnSpawnParticles(entity)
{
    if(!g_bEnable)
        return;
  
    new Float:fOrigin[3], Float:fOriginSmoke[3];
    GetEntPropVector(entity, Prop_Send, "m_vecOrigin", fOrigin);
  
    new iSize = GetArraySize(g_hSmokeGrenades);
    new Handle:hGrenade, iGrenade;
    for(new i = 0; i < iSize; i++)
    {
        hGrenade = GetArrayCell(g_hSmokeGrenades, i);
        iGrenade = GetArrayCell(hGrenade, 1);
        GetEntPropVector(iGrenade, Prop_Send, "m_vecOrigin", fOriginSmoke);
      
        if(fOrigin[0] == fOriginSmoke[0] && fOrigin[1] == fOriginSmoke[1] && fOrigin[2] == fOriginSmoke[2])
        {
            AcceptEntityInput(entity, "Kill");
          
            new SmokeEntity = CreateEntityByName("env_smokestack");
            DispatchKeyValue(SmokeEntity, "SmokeMaterial", "particle/particle_smokegrenade.vmt");
            DispatchKeyValue(SmokeEntity, "basespread", "30");
            DispatchKeyValue(SmokeEntity, "spreadspeed", "5");
            DispatchKeyValue(SmokeEntity, "speed", "5");
            DispatchKeyValue(SmokeEntity, "startsize", "100");
            DispatchKeyValue(SmokeEntity, "endsize", "100");
            DispatchKeyValue(SmokeEntity, "rate", "5");
            DispatchKeyValue(SmokeEntity, "jetlength", "30");
            DispatchKeyValue(SmokeEntity, "renderamt", "200");
            DispatchKeyValue(SmokeEntity, "Translucency", "150");
            DispatchKeyValue(SmokeEntity, "rendercolor", "124 252 0");
            DispatchSpawn(SmokeEntity);
            TeleportEntity(SmokeEntity, fOrigin, NULL_VECTOR, NULL_VECTOR);
            AcceptEntityInput(SmokeEntity, "TurnOn");
            PushArrayCell(hGrenade, SmokeEntity);
          
            new Handle:hTimer = CreateTimer(GetConVarFloat(g_hCVSmokeTime), Timer_RemoveSmoke, SmokeEntity, TIMER_FLAG_NO_MAPCHANGE);
            PushArrayCell(hGrenade, hTimer);
          
            new Handle:hTimer2 = INVALID_HANDLE;
            hTimer2 = CreateTimer(GetConVarFloat(g_hCVSeconds), Timer_CheckDamage, EntIndexToEntRef(SmokeEntity), TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
            PushArrayCell(hGrenade, hTimer2);
          
            new slow_smoke_effect_ent = CreateEntityByName("prop_dynamic");
            DispatchKeyValueVector(slow_smoke_effect_ent, "origin", fOrigin);
            DispatchKeyValue(slow_smoke_effect_ent, "model", SLOW_SMOKE_EFFECT);
            AcceptEntityInput(slow_smoke_effect_ent, "DisableCollision");
            DispatchSpawn(slow_smoke_effect_ent);
            SetEntityMoveType(slow_smoke_effect_ent, MOVETYPE_NONE);
            TeleportEntity(slow_smoke_effect_ent, fOrigin, NULL_VECTOR, NULL_VECTOR);
            PushArrayCell(hGrenade, slow_smoke_effect_ent);
          
            break;
        }
    }
}

public Action:Timer_RemoveSmoke(Handle:timer, any:entity)
{
    new iSize = GetArraySize(g_hSmokeGrenades);
    new Handle:hGrenade, iGrenade = -1;
    for(new i=0; i<iSize; i++)
    {
        hGrenade = GetArrayCell(g_hSmokeGrenades, i);
        if(GetArraySize(hGrenade) > 3)
        {
            iGrenade = GetArrayCell(hGrenade, 2);
            if(iGrenade == entity)
            {
                AcceptEntityInput(entity, "TurnOff");
                AcceptEntityInput(entity, "Kill");
              
                new Handle:hTimer = GetArrayCell(hGrenade, 4);
              
                if(hTimer != INVALID_HANDLE)
                    KillTimer(hTimer);
              
                new slow_smoke_effect_ent = GetArrayCell(hGrenade, 5);
                if(IsValidEdict(slow_smoke_effect_ent))
                    AcceptEntityInput(slow_smoke_effect_ent, "Kill");
              
                RemoveFromArray(g_hSmokeGrenades, i);
                break;
            }
        }
    }
  
    return Plugin_Stop;
}

public Action:Timer_CheckDamage(Handle:timer, any:entityref)
{
    new entity = EntRefToEntIndex(entityref);
    if(entity == INVALID_ENT_REFERENCE)
        return Plugin_Continue;
  
    new iSize = GetArraySize(g_hSmokeGrenades);
    new Handle:hGrenade, iGrenade = -1;
    for(new i=0; i<iSize; i++)
    {
        hGrenade = GetArrayCell(g_hSmokeGrenades, i);
        if(GetArraySize(hGrenade) > 3)
        {
            iGrenade = GetArrayCell(hGrenade, 2);
            if(iGrenade == entity)
                break;
        }
    }
  
    if(iGrenade == -1)
        return Plugin_Continue;
  
    new client = GetArrayCell(hGrenade, 0);
    if(!client || !IsClientInGame(client) || !IsPlayerAlive(client))
        return Plugin_Continue;
  
    if(ZR_IsClientZombie(client))
    {
        RemoveSmoke(entity);
        return Plugin_Continue;
    }
  
    new Float:fSmokeOrigin[3], Float:fOrigin[3];
    GetEntPropVector(iGrenade, Prop_Send, "m_vecOrigin", fSmokeOrigin);
  
    for(new i=1;i<=MaxClients;i++)
    {
        if(IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientZombie(i))
        {
            GetClientAbsOrigin(i, fOrigin);
            if(GetVectorDistance(fSmokeOrigin, fOrigin) <= GetConVarInt(g_hCVDistance))
          {
                new iResultHP = GetEntProp(i, Prop_Send, "m_iHealth") - GetConVarInt(g_hCVDamage);

                if (iResultHP > 0)
                    SetEntProp(i, Prop_Send, "m_iHealth", iResultHP);
                else
                    ForcePlayerSuicide(i);
            }
        }
    }
  
    return Plugin_Continue;
}

RemoveSmoke(entity)
{
    new iSize = GetArraySize(g_hSmokeGrenades);
    new Handle:hGrenade, iGrenade = -1;
    for(new i=0; i<iSize; i++)
    {
        hGrenade = GetArrayCell(g_hSmokeGrenades, i);
        if(GetArraySize(hGrenade) > 3)
        {
            iGrenade = GetArrayCell(hGrenade, 2);
            if(iGrenade == entity)
            {
                AcceptEntityInput(entity, "TurnOff");
                AcceptEntityInput(entity, "Kill");
              
                new Handle:hTimer = GetArrayCell(hGrenade, 4);
              
                if(hTimer != INVALID_HANDLE)
                    KillTimer(hTimer);
              
                new slow_smoke_effect_ent = GetArrayCell(hGrenade, 5);
                if(IsValidEdict(slow_smoke_effect_ent))
                    AcceptEntityInput(slow_smoke_effect_ent, "Kill");
              
                RemoveFromArray(g_hSmokeGrenades, i);
                break;
            }
        }
    }
}
 
Сообщения
56
Реакции
84
Ужасный код и автор плагина явно не он.
https://forums.alliedmods.net/showthread.php?t=158363

Дебаг в таймер добавь.
Код:
public Action:Timer_CheckDamage(Handle:timer, any:entityref)
{
    PrintToChatAll("TEST");

Посмотри что будет после того как ты выкинул смок.
Если сообщений в чате TEST не появится, значит код вообще не выполняется, где то проверку не проходит.
Править этот код вряд ли кто то будет(искать где косяк), проще по новому написать... Но это уже совсем другая история.
 
Сообщения
56
Реакции
84
Kewn, у тебя в коде есть паблик public Action:Timer_CheckDamage(Handle:timer, any:entityref) добавь после { вот это PrintToChatAll("TEST"); после перекомпилируй плагин и загрузи на сервер, зайди на сервер и кинь смок, если в чате не появится сообщение TEST - это потеря.
 
Сообщения
9
Реакции
-1
Drumanid, решил проблему установкой см 1.9.0 там видимо убрали проверку) и все заработало даже на cssv34
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу