native error

Сообщения
21
Реакции
-5
Ошибка
L 06/17/2020 - 01:48:23: Start of error session.
L 06/17/2020 - 01:48:23: Info (map "gg_fy_iceworld_1337") (file "addons/amxmodx/logs/error_20200617.log")
L 06/17/2020 - 01:48:23: [ENGINE] Invalid entity 171
L 06/17/2020 - 01:48:23: [AMXX] Displaying debug trace (plugin "CSDM_LaserMine.amxx", version "19.09.2015")
L 06/17/2020 - 01:48:23: [AMXX] Run time error 10: native error (native "entity_get_string")
L 06/17/2020 - 01:48:23: [AMXX] [0] CSDM_LaserMine.sma::HamHook_TripMine_Damage (line 617)
ОС
Windows
Amx Mod X
Amx Mod X 1.9.0
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.696-dev
Build date: 18:46:47 May 18 2020 (2228)
Build from: https://github.com/dreamstalker/rehlds/commit/987ee51
ReGamedll
ReGameDLL version: 5.17.0.466-dev
Build date: 02:56:24 May 27 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/bffb373
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 15:47:38 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
[ 1] AMX Mod X        RUN   -    amxmodx_mm.dll          v1.9.0.5270      ini  Start ANY
[ 2] Reunion RUN - reunion_mm.dll v0.1.0.92 ini Start Never
[ 3] ReSemiclip RUN - resemiclip_mm.dll v2.3.9 ini Chlvl ANY
[ 4] ReAuthCheck RUN - reauthcheck_mm.dll v0.1.6 ini Start Never
[ 5] Rechecker RUN - rechecker_mm.dll v2.5 ini Chlvl ANY
[ 6] Revoice RUN - revoice_mm.dll v0.1.0.34 ini Start Never
[ 7] WHBlocker RUN - whblocker_mm.dll v1.5.697 ini Chlvl ANY
[ 8] SafeNameAndChat RUN - safenameandchat.dll v1.1 ini ANY ANY
[ 9] CStrike RUN - cstrike_amxx.dll v1.9.0.5270 pl1 ANY ANY
[10] CSX RUN - csx_amxx.dll v1.9.0.5270 pl1 ANY ANY
[11] MySQL RUN - mysql_amxx.dll v1.9.0.5270 pl1 ANY ANY
[12] SQLite RUN - sqlite_amxx.dll v1.9.0.5270 pl1 ANY ANY
[13] Fun RUN - fun_amxx.dll v1.9.0.5270 pl1 ANY ANY
[14] Engine RUN - engine_amxx.dll v1.9.0.5270 pl1 ANY ANY
[15] FakeMeta RUN - fakemeta_amxx.dll v1.9.0.5270 pl1 ANY ANY
[16] GeoIP RUN - geoip_amxx.dll v1.9.0.5270 pl1 ANY ANY
[17] Ham Sandwich RUN - hamsandwich_amxx.dll v1.9.0.5270 pl1 ANY ANY
[18] ReAPI RUN - reapi_amxx.dll v5.13.0.194-dev pl1 ANY Never
[19] ReCSDM RUN - csdm_amxx.dll v3.6 pl1 ANY ANY
[20] ReAimDetector RUN - reaimdetector_amxx.dll v0.2.2 pl1 ANY Never
Список плагинов
name                    version     author            file             status
[ 1] Admin Commands 1.9.0.5270 AMXX Dev Team admincmd.amxx running
[ 2] Anti Flood 1.9.0.5270 AMXX Dev Team antiflood.amxx running
[ 3] Admin Votes 1.9.0.5270 AMXX Dev Team adminvote.amxx running
[ 4] Admin Base 1.9.0.5270 AMXX Dev Team admin.amxx running
[ 5] Stats Configuration 1.9.0.5270 AMXX Dev Team statscfg.amxx running
[ 6] Pause Plugins 1.9.0.5270 AMXX Dev Team pausecfg.amxx running
[ 7] menu on key m 228 unknown menu.amxx running
[ 8] Maps Menu 1.9.0.5270 AMXX Dev Team mapsmenu.amxx running
[ 9] Players Menu 1.9.0.5270 AMXX Dev Team plmenu.amxx running
[ 10] Menus Front-End 1.9.0.5270 AMXX Dev Team menufront.amxx running
[ 11] Commands Menu 1.9.0.5270 AMXX Dev Team cmdmenu.amxx running
[ 12] Plugin Menu 1.9.0.5270 AMXX Dev Team pluginmenu.amxx running
[ 13] Weapon Menu 0.0.9 SavSin CSDM_Style_Gun_ debug
[ 14] Show timeleft for CSDM 1.0 neygomon Showtimeleftscd running
[ 15] Bullet Damage 0.0.1 ConnorMcLeod bullet_damage.a running
[ 16] Game Namer 1.1 NeuroToxin gamenamechanger running
[ 17] 'Fire in the hole' blo 1.0 xPaw hidefireintheho running
[ 18] LongJump Enabler 1.0.1 ConnorMcLeod longjump.amxx running
[ 19] MultiJump 1.1 twistedeuphoria multijump.amxx running
[ 20] [ReAPI] Hint blocker 0.1.0 F@tn0M reapi_hint_bloc running
[ 21] Automatic Unstuck 1.5 NL)Ramon(NL stuck.amxx running
[ 22] DeRoiD's Mapchooser 2.33 DeRoiD dmc233.amxx running
[ 23] Sentry guns 1.1 JGHG & miRror CSDM_Sentry.amx debug
[ 24] SF TripMine 19.09.2015 serfreeman1337 CSDM_LaserMine. debug
[ 25] unknown unknown unknown CSDM_laserfence debug
[ 26] Client Autoexec on Con 1.1 Torch miRror client_autoexec running
[ 27] Build Dispenser #1.0.5 NOVA csdm_dispenser_ running
[ 28] Welcome HudMsg 0.1 KpacaB4IK dhud.amxx running
[ 29] [ReApi] Killer ScreenF 0.0.4 Vaqtincha reapi_killer_sc running
[ 30] [ReAPI] Vampire 1.0.1 MakapoH reapi_vampire.a running
[ 31] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 32] Toggle Water 0.2 mx?! ToggleWater.amx running
[ 33] Longjump Player Model 0.1 KORD_12.7 p_longjump.amxx running
[ 34] Frag Counter 1.0 Kia Armani kills_counter.a running
[ 35] Spect Bot 1.4 Jack Daniel`s spect_bot.amxx running
[ 36] Ping Faker 1.5a MeRcyLeZZ pingfaker.amxx running
[ 37] ResetScore 1.0 Leo_[BH] resetscore_reap running
[ 38] Lite Vip System 1.3 Hypa_[KZ] CSDM_vip.amxx running
[ 39] Chat Manager 4.5.1 OciXCrom crx_chatmanager running
[ 40] Team Balance Control 1.3.9 gyxoBka TeamBalanceCont running
[ 41] Fake Ping For Bots 1.0 fl0wer fake_ping_for_b running
[ 42] Models Replacement 0.0.2 ConnorMcLeod | V models_replacem running
[ 43] CSDM Main 3.6.0.1 CSDM Team csdm_item.amxx running
[ 44] ReCSDM Spawns 3.6.0.1 ReCSDM Team csdm_spawn_pres running
[ 45] ReCSDM Misc 3.6.0.1 ReCSDM Team csdm_misc.amxx running
[ 46] ReCSDM Stripper 3.6.0.1 KWo csdm_stripper.a running
[ 47] ReCSDM Item Mode 3.6.0.1 FALUCO & KWo & S csdm_itemmode.a running
[ 48] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 49] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 50] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 51] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 52] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
52 plugins, 52 running
Автор плагина
serfreeman1337
Версия плагина
19.09.2015
Исходный код
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <beams>

#define PLUGIN "SF TripMine"
#define VERSION "19.09.2015"
#define AUTHOR "serfreeman1337"

#if AMXX_VERSION_NUM < 183
#define message_begin_f(%0,%1,%2,%3) engfunc(EngFunc_MessageBegin,%0,%1,%2,%3)
#define write_coord_f(%0) engfunc(EngFunc_WriteCoord,%0)

#define Ham_CS_Player_ResetMaxSpeed Ham_Item_PreFrame

#include <dhudmessage>
#endif

#define SND_STOP (1<<5)

#define TRIPMINE_MODEL "models/error_csdm/sentry/v_tripmine.mdl" // tripmine model
#define TRIPMINE_CLASSNAME "lasermine" // tripmine classname

#define BEAM_SPRITERED "sprites/SecondNewCSDM/BuildLaserMine/laserr.spr"
#define BEAM_SPRITEBLUE "sprites/SecondNewCSDM/BuildLaserMine/laserb.spr"

#define TRIPMINE_PLANTSOUND "SecondNewCSDM/BuildLaserMine/mine_deploy.wav" // plant sound
#define TRIPMINE_CHARGESOUND "SecondNewCSDM/BuildLaserMine/mine_charge.wav" // charge sound
#define TRIPMINE_ACTIVESOUND "SecondNewCSDM/BuildLaserMine/mine_activate.wav" // active sound
#define TRIPMINE_HITSOUND "SecondNewCSDM/BuildLaserMine/beamstart9.wav" // hit sound


#define PLANTWAITTIME 0.1
#define POWERUPTIME 2.0
#define BEAM_WIDTH 5.0 //свечение луча
#define BEAM_BRIGHT 255.0

#define PLANT_TIME 1.0 // tripmine plant time
#define MINE_HEALTH 800.0 // tripmine health
#define ADMIN_MAX_COUNT 4 // maximum tripmine count
#define BOSS_MAX_COUNT 4 // maximum tripmine count
#define VIP_MAX_COUNT 4 // maximum tripmine count
#define MAX_COUNT 4 // maximum tripmine count
#define MINE_DAMAGE 300.0 // laser damage
#define MINE_COST 300 // tripmine cost
#define PLANT_RADIUS 64.0 // default plant radius
#define LASER_LENGTH 8128.0 // maximum laser length

#define MINE_EXPLODED_REWARD 400 // reward exploded mine

#define EV_TM_hOwner EV_ENT_euser4
#define EV_TM_pBeam EV_ENT_euser3
#define EV_TM_team EV_INT_iuser4
#define EV_TM_plantTime EV_FL_fuser4
#define EV_TM_mVecDir EV_VEC_vuser4
#define EV_TM_mVecEnd EV_VEC_vuser3

#define EV_TM_mineId EV_INT_iuser3

#define ENTITY_REFERENCE "func_breakable"

/** pId */
#define IsAlive(%1) (bool:(is_user_alive(%1)))

/** pId */
#define IsConnected(%1) (bool:(is_user_connected(%1)))

/** pId */
#define IsValid(%1) (bool:(pev_valid(%1)))

/** pId */
#define IsValidPev(%1) (bool:(pev_valid(%1) == 2))

/** pId */
#define Player_GetTeam(%1) get_pdata_int(%1, m_iTeam)

/** MODEL_ */
#define PRECACHE_MODEL(%0) engfunc(EngFunc_PrecacheModel, %0)

/** SOUND_ */
#define PRECACHE_SOUND(%0) engfunc(EngFunc_PrecacheSound, %0)

/** iEnt */
#define REMOVE_ENTITY(%1) engfunc(EngFunc_RemoveEntity, %1)

enum _:DATA_PLAYER_MINE
{
PD_MINE_ENT,
Float:PD_NEXTPLANT_TIME,
bool:PD_START_SET
}

new g_eUserData[33][DATA_PLAYER_MINE];

new g_iMaxPlayers, g_iSpriteId;
new HamHook:g_iHamHook_PostThink, g_iThinkHook;

const MsgId_SayText = 76;
const MsgId_Money = 102;
const MsgId_StatusText = 106;
const MsgId_BarTime = 108;

const XO_PLAYER = 5;

const m_iTeam = 114;
const m_iMoney = 115;

public plugin_precache()
{
PRECACHE_MODEL(TRIPMINE_MODEL);

PRECACHE_MODEL(BEAM_SPRITERED);
PRECACHE_MODEL(BEAM_SPRITEBLUE);
PRECACHE_SOUND(TRIPMINE_HITSOUND);
PRECACHE_SOUND(TRIPMINE_PLANTSOUND);
PRECACHE_SOUND(TRIPMINE_CHARGESOUND);
PRECACHE_SOUND(TRIPMINE_ACTIVESOUND);
g_iSpriteId = PRECACHE_MODEL("sprites/SecondNewCSDM/BuildLaserMine/csdm_explode.spr");
}

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR);

register_clcmd("+setlaser", "ClCmd_SetLaser");
register_clcmd("-setlaser", "ClCmd_DropLaser");
register_forward(FM_CmdStart, "fw_CmdStart");

register_think("beam", "EngineHook_Beam_Think");
register_think(TRIPMINE_CLASSNAME, "EngineHook_TripMine_Think");

RegisterHam(Ham_Killed, ENTITY_REFERENCE, "HamHook_TripMine_Killed");
RegisterHam(Ham_TakeDamage, ENTITY_REFERENCE, "HamHook_TripMine_Damage");

register_logevent("LogEventHook_RoundStart", 2, "1=Round_End");
register_logevent("LogEventHook_RoundStart", 2, "1=Round_Start");

g_iMaxPlayers = get_maxplayers()
}

public fw_CmdStart( id, uc_handle, randseed )
{
if (!is_user_alive(id))
return FMRES_IGNORED

static bool:now,bool:old;now=((get_uc(uc_handle,UC_Buttons)&IN_USE)?true:false),old=((pev(id,pev_oldbuttons)&IN_USE)?true:false)

if(now&&old)
{
ClCmd_SetLaser(id)
}
else if(!now&&old)
{
ClCmd_DropLaser(id)
}
return FMRES_IGNORED;
}

public EngineHook_Beam_Think(iEnt)
{
new iMine = entity_get_edict(iEnt, EV_ENT_owner);

if(!IsValid(iEnt)) UTIL_Remove(iEnt);

if(entity_get_int(iEnt, EV_TM_mineId) != entity_get_int(iMine, EV_TM_mineId))
{
UTIL_Remove(iEnt);
}
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.05);
}

public LogEventHook_RoundStart()
{
new iEnt = FM_NULLENT;

while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", TRIPMINE_CLASSNAME)) > 0)
{
new iBeam = entity_get_edict(iEnt, EV_TM_pBeam);

if(IsValid(iBeam)) REMOVE_ENTITY(iBeam);

REMOVE_ENTITY(iEnt);
}
}

public ClCmd_SetLaser(pId)
{
if(get_user_flags(pId) & ADMIN_BAN)
{
if(Player_GetMines(pId) >= ADMIN_MAX_COUNT)
{
g_eUserData[pId][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME);
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(pId, "Установлено максимальное количество мин! ");
return PLUGIN_HANDLED;
}
}
else if(get_user_flags(pId) & ADMIN_LEVEL_G)
{
if(Player_GetMines(pId) >= BOSS_MAX_COUNT)
{
g_eUserData[pId][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME);
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(pId, "Установлено максимальное количество мин! ");
return PLUGIN_HANDLED;
}
}
else if(get_user_flags(pId) & ADMIN_LEVEL_H)
{
if(Player_GetMines(pId) >= VIP_MAX_COUNT)
{
g_eUserData[pId][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME);
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(pId, "Установлено максимальное количество мин! ");
return PLUGIN_HANDLED;
}
}
else if(get_user_flags(pId) & ADMIN_USER)
{
if(Player_GetMines(pId) >= MAX_COUNT)
{
g_eUserData[pId][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME);
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(pId, "Установлено максимальное количество мин! ");
return PLUGIN_HANDLED;
}
}


g_eUserData[pId][PD_START_SET] = true

g_iThinkHook++
if(g_iThinkHook == 1)
{
if(!g_iHamHook_PostThink)
{
#if AMXX_VERSION_NUM >= 183
g_iHamHook_PostThink = RegisterHamPlayer(Ham_Player_PostThink, "HamHook_Player_PostThink", true);
#else
g_iHamHook_PostThink = RegisterHam(Ham_Player_PostThink, "player", "HamHook_Player_PostThink", true);
#endif
}
else EnableHamForward(g_iHamHook_PostThink);
}
return PLUGIN_HANDLED;
}

public ClCmd_DropLaser(pId)
{
if(!g_eUserData[pId][PD_START_SET]) return PLUGIN_HANDLED

g_iThinkHook--
if(g_iThinkHook <= 0) DisableHamForward(g_iHamHook_PostThink);

g_eUserData[pId][PD_START_SET] = false;

if(IsValid(g_eUserData[pId][PD_MINE_ENT]))
{
UTIL_SendBarTime(pId, 0.0);
REMOVE_ENTITY(g_eUserData[pId][PD_MINE_ENT]);
g_eUserData[pId][PD_MINE_ENT] = FM_NULLENT;
g_eUserData[pId][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME);
}
return PLUGIN_HANDLED;
}

public HamHook_Player_PostThink(pId)
{
if(g_eUserData[pId][PD_START_SET])
{
if(TripMine_PlantThink(pId))
{
TripMine_Plant(pId, g_eUserData[pId][PD_MINE_ENT]);
}
}
}

TripMine_Spawn()
{
new iEnt;

static iszAllocString;
if(iszAllocString || (iszAllocString = engfunc(EngFunc_AllocString, ENTITY_REFERENCE)))
{
iEnt = engfunc(EngFunc_CreateNamedEntity, iszAllocString);
}

entity_set_string(iEnt, EV_SZ_classname, TRIPMINE_CLASSNAME);
entity_set_int(iEnt, EV_INT_movetype, MOVETYPE_FLY);
entity_set_int(iEnt, EV_INT_solid, SOLID_NOT);

entity_set_model(iEnt, TRIPMINE_MODEL);
entity_set_float(iEnt, EV_FL_frame, 0.0);
entity_set_int(iEnt, EV_INT_body, 3);
entity_set_int(iEnt, EV_INT_sequence, 7);
entity_set_float(iEnt, EV_FL_framerate, 0.0);

entity_set_size(iEnt, Float:{-8.0,-8.0,-8.0}, Float:{8.0,8.0,8.0});

return iEnt;
}

Player_GetMines(pId)
{
new iEnt = FM_NULLENT, iChar;

while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", TRIPMINE_CLASSNAME)) > 0 && IsValid(iEnt))
{
if(pId == entity_get_edict(iEnt, EV_TM_hOwner))
{
iChar++;
}
}
return iChar;
}

TripMine_PlantThink(pId, bool:bReset = false)
{
if(g_eUserData[pId][PD_NEXTPLANT_TIME] > get_gametime()) return false;

new iEnt = g_eUserData[pId][PD_MINE_ENT];

if(!IsAlive(pId) || Player_GetMoney(pId) - MINE_COST < 0)
{
if(IsValid(iEnt))
{
REMOVE_ENTITY(iEnt);
UTIL_SendBarTime(pId, 0.0);
}
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(pId, " не хватает денег, нужно %d $", MINE_COST);

g_eUserData[pId][PD_MINE_ENT] = FM_NULLENT;
ClCmd_DropLaser(pId);

return false;
}

if(bReset)
{
if(IsValid(iEnt))
{
REMOVE_ENTITY(iEnt);
UTIL_SendBarTime(pId, 0.0);
g_eUserData[pId][PD_MINE_ENT] = FM_NULLENT;

return true;
}
return false;
}

new Float:vecSrc[3], Float:vecAiming[3];
entity_get_vector(pId, EV_VEC_v_angle, vecSrc);
engfunc(EngFunc_MakeVectors, vecSrc);

entity_get_vector(pId, EV_VEC_origin, vecSrc);
entity_get_vector(pId, EV_VEC_view_ofs, vecAiming);

xs_vec_add(vecSrc, vecAiming, vecSrc);
get_global_vector(GL_v_forward, vecAiming);

xs_vec_mul_scalar(vecAiming, PLANT_RADIUS, vecAiming);
xs_vec_add(vecSrc, vecAiming, vecAiming);

new Float:flFraction;
engfunc(EngFunc_TraceLine, vecSrc, vecAiming, IGNORE_MISSILE|IGNORE_GLASS|IGNORE_MONSTERS, pId, 0);

get_tr2(0, TR_flFraction, flFraction);

if(flFraction < 1.0)
{
new pHit;

new Float:vecEnd[3], bool:bUpdate;
get_tr2(0, TR_vecEndPos,vecEnd)

while((pHit = engfunc(EngFunc_FindEntityInSphere, pHit, vecEnd, 8.0)) != 0)
{
if(pHit <= g_iMaxPlayers || pHit == iEnt) continue;

new szClassName[32];
entity_get_string(pHit, EV_SZ_classname, szClassName, charsmax(szClassName));

if(strcmp(szClassName, TRIPMINE_CLASSNAME) == 0)
{
bUpdate = true;
if(!IsValid(iEnt)) return false;
}
}

if(!IsValid(iEnt))
{
iEnt = TripMine_Spawn();

entity_set_int(iEnt, EV_INT_rendermode, kRenderTransAdd);
entity_set_float(iEnt, EV_FL_renderamt, 255.0);

new Float:flPlantMine = PLANT_TIME;

entity_set_float(iEnt, EV_TM_plantTime, get_gametime() + flPlantMine);
entity_set_float(pId, EV_FL_maxspeed, 1.0);

UTIL_SendBarTime(pId, flPlantMine);

g_eUserData[pId][PD_MINE_ENT] = iEnt;
}

if(!bUpdate)
{
new Float:vecPlaneNormal[3], Float:flAngles[3];
get_tr2(0, TR_vecPlaneNormal, vecPlaneNormal);
vector_to_angle(vecPlaneNormal, flAngles);

xs_vec_mul_scalar(vecPlaneNormal, 8.0, vecPlaneNormal);
xs_vec_add(vecEnd, vecPlaneNormal, vecEnd);

entity_set_origin(iEnt, vecEnd);
entity_set_vector(iEnt, EV_VEC_angles, flAngles);
}

if(entity_get_float(iEnt, EV_TM_plantTime) < get_gametime())
{
new Float:m_vecDir[3],Float:flAngles[3];

entity_get_vector(iEnt, EV_VEC_angles, flAngles);
engfunc(EngFunc_MakeVectors, flAngles);
get_global_vector(GL_v_forward, m_vecDir);

m_vecDir[2] =- m_vecDir[2];

entity_set_vector(iEnt, EV_TM_mVecDir, m_vecDir);
return true;
}
}
else
{
if(IsValid(iEnt))
{
REMOVE_ENTITY(iEnt);
UTIL_SendBarTime(pId, 0.0);
g_eUserData[pId][PD_MINE_ENT] = FM_NULLENT;
}
}
return false;
}

TripMine_Plant(pId, iEnt)
{
g_eUserData[pId][PD_MINE_ENT] = FM_NULLENT;
g_eUserData[pId][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME);

entity_set_int(iEnt, EV_INT_rendermode, kRenderNormal);
entity_set_float(iEnt, EV_FL_renderamt, 0.0);

entity_set_edict(iEnt, EV_TM_hOwner, pId);
entity_set_int(iEnt, EV_TM_team, Player_GetTeam(pId));

emit_sound(iEnt, CHAN_VOICE,TRIPMINE_PLANTSOUND, 1.0, ATTN_NORM, 0, PITCH_NORM);
emit_sound(iEnt, CHAN_BODY,TRIPMINE_CHARGESOUND, 0.2, ATTN_NORM, 0, PITCH_NORM);

entity_set_float(iEnt, EV_TM_plantTime, get_gametime() + POWERUPTIME);
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + POWERUPTIME);

ExecuteHamB(Ham_CS_Player_ResetMaxSpeed, pId);

Player_SetMoney(pId, Player_GetMoney(pId) - MINE_COST);
ClCmd_DropLaser(pId);
return true;
}

public EngineHook_TripMine_Think(iEnt)
{
if(entity_get_float(iEnt, EV_TM_plantTime))
{
new Float:m_vecDir[3];
entity_get_vector(iEnt, EV_TM_mVecDir, m_vecDir);

new Float:vecSrc[3], Float:vecEnd[3];

entity_get_vector(iEnt, EV_VEC_origin, vecSrc);
xs_vec_copy(vecSrc, vecEnd);

xs_vec_mul_scalar(m_vecDir, 8.0, m_vecDir);
xs_vec_add(vecSrc, m_vecDir, vecSrc);

entity_get_vector(iEnt, EV_TM_mVecDir, m_vecDir);
xs_vec_mul_scalar(m_vecDir, 32.0, m_vecDir);
xs_vec_add(vecEnd, m_vecDir, vecEnd);

engfunc(EngFunc_TraceLine, vecSrc, vecEnd, DONT_IGNORE_MONSTERS, iEnt, 0);

new Float:flFraction;
get_tr2(0, TR_flFraction, flFraction);

if(flFraction == 1.0)
{
get_tr2(0, TR_vecEndPos, vecEnd)

new iFind;
while((iFind = engfunc(EngFunc_FindEntityInSphere, iFind, vecSrc, 12.0)) != 0)
{
if(iFind > g_iMaxPlayers) break;

entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1);
return;
}

emit_sound(iEnt, CHAN_BODY, TRIPMINE_CHARGESOUND, 0.0, ATTN_NORM, SND_STOP, 0);
emit_sound(iEnt, CHAN_VOICE, TRIPMINE_ACTIVESOUND, 0.5, ATTN_NORM, 1,75);

entity_set_int(iEnt, EV_TM_mineId, random(1337));
TripMine_MakeBeam(iEnt);

entity_set_int(iEnt, EV_INT_solid, SOLID_BBOX);
entity_set_float(iEnt, EV_TM_plantTime, 0.0);

entity_set_float(iEnt, EV_FL_takedamage, DAMAGE_YES);
entity_set_float(iEnt, EV_FL_dmg, 100.0);
entity_set_float(iEnt, EV_FL_health, MINE_HEALTH);
}
}

new iBeam = entity_get_edict(iEnt, EV_TM_pBeam);
if(entity_get_float(iEnt, EV_FL_health) <= 0.0 && IsValid(iBeam))
{
ExecuteHamB(Ham_Killed, iEnt, 0, 0); return;
}

new pId = entity_get_edict(iEnt, EV_TM_hOwner);
if(!is_user_alive(pId) || Player_GetTeam(pId) != entity_get_int(iEnt, EV_TM_team))
{
new iBeam = entity_get_edict(iEnt, EV_TM_pBeam);
if(IsValid(iBeam)) UTIL_Remove(iBeam);

REMOVE_ENTITY(iEnt);
return;
}

if(IsValid(iBeam))
{
new Float:vecSrc[3], Float:vecEnd[3];

entity_get_vector(iEnt, EV_VEC_origin, vecSrc);
entity_get_vector(iEnt, EV_TM_mVecEnd, vecEnd);

new pHit, iTraceLine = create_tr2();
engfunc(EngFunc_TraceLine, vecSrc, vecEnd, DONT_IGNORE_MONSTERS, iEnt, iTraceLine);

pHit = get_tr2(iTraceLine, TR_pHit);
get_tr2(iTraceLine, TR_vecEndPos, vecEnd);

Beam_SetStartPos(iBeam, vecEnd);

message_begin_f(MSG_PVS, SVC_TEMPENTITY, vecEnd, 0);
write_byte(TE_SPARKS);
write_coord_f(vecEnd[0]);
write_coord_f(vecEnd[1]);
write_coord_f(vecEnd[2]);
message_end();

if(0 < pHit <= g_iMaxPlayers)
{
new iTeam = entity_get_int(iEnt,EV_TM_team);

if(Player_GetTeam(pHit) != iTeam && entity_get_float(pHit, EV_FL_takedamage) != 0.0)
{
if(ExecuteHamB(Ham_TakeDamage, pHit, iEnt, entity_get_edict(iEnt,EV_TM_hOwner), MINE_DAMAGE, 16777216))
{
ExecuteHamB(Ham_TraceBleed, pHit, 1337.0, Float:{0.0,0.0,0.0}, iTraceLine, DMG_ENERGYBEAM);
}
else
{
emit_sound(pHit, CHAN_WEAPON,TRIPMINE_HITSOUND, 1.0, ATTN_NORM, 0, PITCH_NORM);
entity_set_vector(pHit, EV_VEC_velocity, Float:{0.0,0.0,0.0});
}
}
}
free_tr2(iTraceLine);
}

if(IsValid(iEnt))
{
TripMine_StatusInfo(iEnt);
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1);
}
}

TripMine_StatusInfo(iEnt)
{
if(!IsValid(iEnt)) return;

new pId, Float:flOrigin[3], hitEnt, bh;
entity_get_vector(iEnt, EV_VEC_origin, flOrigin);

while((pId = engfunc(EngFunc_FindEntityInSphere, pId, flOrigin, 1024.0)) != 0)
{
if(pId > g_iMaxPlayers) break;
if(Player_GetTeam(pId) != entity_get_int(iEnt, EV_TM_team)) continue;

get_user_aiming(pId, hitEnt, bh);

if(hitEnt != iEnt) continue;

new iPlanterId; //iTeam = entity_get_int(iEnt, EV_TM_team);

iPlanterId = entity_get_edict(iEnt, EV_TM_hOwner);

set_hudmessage ( 255, 255, 255, -1.0, 0.54, 0, 0.0, 0.1, 0.2, 0.1 )
show_hudmessage(pId, "%s^nhp: %.0f/%.0f", Player_GetName(iPlanterId), entity_get_float(iEnt, EV_FL_health), MINE_HEALTH);
}
}

public HamHook_TripMine_Damage(iEnt, iInflictor, pIda)
{
new szClassName[32]; entity_get_string(iEnt, EV_SZ_classname, szClassName, charsmax(szClassName))

if(strcmp(szClassName, TRIPMINE_CLASSNAME) != 0) return HAM_IGNORED;

entity_set_edict(iEnt, EV_ENT_dmg_inflictor, pIda);

if(!(0 < pIda <= g_iMaxPlayers)) return HAM_IGNORED;

if(entity_get_int(iEnt, EV_TM_team) == Player_GetTeam(pIda) && entity_get_edict(iEnt, EV_TM_hOwner) != pIda)
return HAM_SUPERCEDE;

return HAM_IGNORED;
}

public HamHook_TripMine_Killed(iEnt)
{
new szClassName[32]; entity_get_string(iEnt, EV_SZ_classname, szClassName, charsmax(szClassName));

if(strcmp(szClassName, TRIPMINE_CLASSNAME) != 0) return HAM_IGNORED

new iBeam = entity_get_edict(iEnt, EV_TM_pBeam);

if(IsValid(iBeam)) UTIL_Remove(iBeam);

new Float:flOrigin[3], Float:m_vecDir[3];
entity_get_vector(iEnt, EV_VEC_origin, flOrigin);
entity_get_vector(iEnt, EV_TM_mVecDir, m_vecDir);
xs_vec_mul_scalar(m_vecDir, 8.0, m_vecDir);
xs_vec_add(flOrigin, m_vecDir, flOrigin);

message_begin_f(MSG_PVS, SVC_TEMPENTITY, flOrigin, 0);
write_byte(TE_EXPLOSION);
write_coord_f(flOrigin[0]);
write_coord_f(flOrigin[1]);
write_coord_f(flOrigin[2]);
write_short(g_iSpriteId);
write_byte(20);
write_byte(15);
write_byte(0);
message_end();

new iKiller = entity_get_edict(iEnt, EV_ENT_dmg_inflictor);
new hOwner = entity_get_edict(iEnt, EV_TM_hOwner);

if(!(0 < iKiller <= g_iMaxPlayers) || iKiller == entity_get_edict(iEnt, EV_TM_hOwner))
{
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(hOwner, "Ваша мина взорвана!");
}
else
{
Player_SetMoney(iKiller, Player_GetMoney(iKiller) + MINE_EXPLODED_REWARD);
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(iKiller, " Вы получили %d$ за уничтожение мины игрока %s", MINE_EXPLODED_REWARD, Player_GetName(hOwner));
set_dhudmessage( 255, 255, 255, -1.0, 0.85, 0, 0.0, 2.0, 0.0, 0.0 )
show_dhudmessage(hOwner, "%s уничтожил вашу мину!", Player_GetName(iKiller));
}
return HAM_IGNORED;
}

TripMine_MakeBeam(iEnt)
{
new iBeam = Beam_Create(entity_get_int(iEnt, EV_TM_team) == 1 ? BEAM_SPRITERED : BEAM_SPRITEBLUE, BEAM_WIDTH);

new Float:m_vecDir[3], Float:vecSrc[3], Float:vecOrigin[3];
entity_get_vector(iEnt, EV_TM_mVecDir, m_vecDir);
entity_get_vector(iEnt, EV_VEC_origin, vecSrc);
xs_vec_copy(vecSrc, vecOrigin);
xs_vec_mul_scalar(m_vecDir, LASER_LENGTH, m_vecDir);
xs_vec_add(vecSrc, m_vecDir, vecSrc);

Beam_PointsInit(iBeam, vecSrc, vecOrigin);
Beam_SetScrollRate(iBeam, 255.0);
Beam_SetBrightness(iBeam, BEAM_BRIGHT);

entity_set_edict(iEnt, EV_TM_pBeam, iBeam);
entity_set_vector(iEnt, EV_TM_mVecEnd, vecSrc);
entity_set_edict(iBeam, EV_ENT_owner, iEnt);

entity_set_int(iBeam, EV_TM_mineId, entity_get_int(iEnt, EV_TM_mineId));
entity_set_float(iBeam, EV_FL_nextthink, get_gametime() + 0.1);
}

Player_SetMoney(pId, iMoney)
{
if(!IsValidPev(pId)) return;

set_pdata_int(pId, m_iMoney, iMoney, XO_PLAYER);

message_begin(MSG_ONE_UNRELIABLE, MsgId_Money, _, pId);
write_long(iMoney);
write_byte(_:IsAlive(pId));
message_end();
}

Player_GetMoney(pId)
{
return !IsValidPev(pId) ? 0 : get_pdata_int(pId, m_iMoney, XO_PLAYER);
}

Player_GetName(pId)
{
new szName[32];
get_user_name(pId, szName, charsmax(szName));

return szName;
}

UTIL_SendBarTime(pId, Float:flDuration)
{
if(flDuration == 0.0)
{
ExecuteHamB(Ham_CS_Player_ResetMaxSpeed, pId);
}

message_begin(MSG_ONE, MsgId_BarTime, _, pId);
write_short(floatround(flDuration));
message_end();
}

UTIL_Remove(iEnt)
{
if(!iEnt) return;

entity_set_int(iEnt, EV_INT_flags, entity_get_int(iEnt, EV_INT_flags) | FL_KILLME);
}

stock UTIL_SayText(pId, const szMessage[], any:...)
{
new iPlayers[32], iCount = 1;
new szMsg[191]; vformat(szMsg, charsmax(szMsg), szMessage, 3);

replace_all(szMsg, 190, "\g", "^4");
replace_all(szMsg, 190, "\n", "^1");
replace_all(szMsg, 190, "\t", "^3");

if(pId) iPlayers[0] = pId; else get_players(iPlayers, iCount, "ch");
{
for(new pId = 0; pId < iCount; pId++)
{
if(IsConnected(iPlayers[pId]))
{
message_begin(MSG_ONE_UNRELIABLE, MsgId_SayText, _, iPlayers[pId]);
write_byte(iPlayers[pId]);
write_string(szMsg);
message_end();
}
}
}
}
помогите пожалуйстя)
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
1,042
Реакции
206
Предупреждения
1
Помог
6 раз(а)
Объект (Entity) на валидность чекни.
 
Сообщения
21
Реакции
-5
BiZaJe, а как ето сделать, напиши если не сложно, за ранние Спасибо!
 
Сообщения
1,042
Реакции
206
Предупреждения
1
Помог
6 раз(а)
papezhuk, делаешь условие с is_valid_ent(Entity свою пихнешь)
 

hajimura

Е777КХ05
Сообщения
290
Реакции
228
Помог
6 раз(а)
Код:
public HamHook_TripMine_Damage(iEnt, iInflictor, pIda)
{
++  if(!is_valid_ent(iEnt)) return HAM_IGNORED;
    new szClassName[32]; entity_get_string(iEnt, EV_SZ_classname, szClassName, charsmax(szClassName))

    if(strcmp(szClassName, TRIPMINE_CLASSNAME) != 0) return HAM_IGNORED;
         
    entity_set_edict(iEnt, EV_ENT_dmg_inflictor, pIda);
 
    if(!(0 < pIda <= g_iMaxPlayers)) return HAM_IGNORED;
 
    if(entity_get_int(iEnt, EV_TM_team) == Player_GetTeam(pIda) && entity_get_edict(iEnt, EV_TM_hOwner) != pIda)
            return HAM_SUPERCEDE;

    return HAM_IGNORED;
}
 
  • Нравится
Реакции: Ayk

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

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