LaserMines

Сообщения
38
Реакции
-1
Помог
1 раз(а)
Ошибка
L 10/27/2019 - 13:44:38: [AMXX] Run time error 4 (plugin "h_laser.amxx") - debug not enabled!
L 10/27/2019 - 13:44:38: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without

debug:
L 10/27/2019 - 14:25:23: [AMXX] Displaying debug trace (plugin "lasermine.amxx", version "0.3.4")
L 10/27/2019 - 14:25:23: [AMXX] Run time error 4: index out of bounds
L 10/27/2019 - 14:25:23: [AMXX] [0] lasermine.sma::TripMine_Plant (line 447)
L 10/27/2019 - 14:25:23: [AMXX] [1] lasermine.sma::Player_PostThink (line 248)
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5249 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Jun 19 2019 13:31:53
Built from: https://github.com/alliedmodders/amxmodx/commit/6cecb34
Build ID: 5249:6cecb34
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.692-dev
Build date: 18:58:01 Sep 21 2019 (1988)
Build from: https://github.com/dreamstalker/rehlds/commit/e7232be
ReGamedll
ReGameDLL version: 5.11.0.420-dev+m
Build date: 12:57:16 Oct 9 2019
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/4996564
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
[ 1] Reunion               RUN   -    reunion_mm_i386.so          v0.1.0.92        ini  Start Never
[ 2] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 3] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 4] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 5] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC3 ini ANY ANY
[ 6] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5249 ini Start ANY
[ 7] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 8] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 9] Ultimate Unprecacher RUN - unprecacher_i386.so vBeta 2.5 ini Chlvl Chlvl
[10] MySQL RUN - mysql_amxx_i386.so v1.9.0.5249 pl6 ANY ANY
[11] Fun RUN - fun_amxx_i386.so v1.9.0.5249 pl6 ANY ANY
[12] Engine RUN - engine_amxx_i386.so v1.9.0.5249 pl6 ANY ANY
[13] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5249 pl6 ANY ANY
[14] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5249 pl6 ANY ANY
[15] CSX RUN - csx_amxx_i386.so v1.9.0.5249 pl6 ANY ANY
[16] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5249 pl6 ANY ANY
[17] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl6 ANY Never
[18] ReAPI RUN - reapi_amxx_i386.so v5.10.0.188-dev pl6 ANY Never
[19] CSSB RUN - cssb_amxx_i386.so v5.0.0 pl6 ANY ANY
[20] ReCSDM RUN - csdm_amxx_i386.so v3.6 pl6 ANY ANY
Список плагинов
[  1] GameCMS_API             5.2.5       zhorzh78          gamecms_api_5.2  running  
[ 2] WebHS 0.1 kanagava fb_web_online.a running
[ 3] FreshBans 1.3.8b kanagava fresh_bans_138_ running
[ 4] Aliases checker 0.8.2 kanagava alias_detector0 running
[ 5] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 6] Admin Commands 1.9.0.5249 AMXX Dev Team admincmd.amxx running
[ 7] Slots Reservation 1.9.0.5249 AMXX Dev Team adminslots.amxx running
[ 8] Menus Front-End 1.5 neugomon menufront.amxx running
[ 9] Commands Menu 1.9.0.5249 AMXX Dev Team cmdmenu.amxx running
[ 10] GameCMS_GagManager 2.2.3 zhorzh78 gamecms_gagmana running
[ 11] New Kick Menu 1.4.2 Radius newkickmenu.amx running
[ 12] Players Menu 1.7 neugomon players_menu.am running
[ 13] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 14] Admin Chat 1.9.0.5249 AMXX Dev Team adminchat.amxx running
[ 15] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 16] [183] NextMap 18.09.25 SKAJIbnEJIb & AM nextmap.amxx running
[ 17] [183] MapChooser RBS 18.10.05 SKAJIbnEJIb & UF mapchooser_rbs. running
[ 18] [183] TimeLeft 18.09.25 SKAJIbnEJIb & AM timeleft.amxx running
[ 19] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 20] AES: StatsX 0.5+1 serfreeman1337 aes_stats.amxx running
[ 21] Stats Configuration 1.9.0.5249 AMXX Dev Team statscfg.amxx running
[ 22] Walls Creator 1.1 d3m37r4 walls_creator.a running
[ 23] Level System by CSStat 1.5.9 Radius level_system.am running
[ 24] Auto Team Balance Adva 1.5.1 Radius team_balans.amx running
[ 25] Main Marvel Menu 1.0 Author menu.amxx running
[ 26] Main Marvel Menu 1.0 Author menu_n.amxx running
[ 27] SF MultiJump 0.2 serfreeman1337 2_jump.amxx running
[ 28] ShopGuns 1.0 Author shop_guns.amxx running
[ 29] Golden Deagle 1.1 AlejandroSk / di wc3_goldendgl.a running
[ 30] Golden m4 1.0 AlejandroSk wc3_Goldenm4.am running
[ 31] Golden Ak 47 1.0 AlejandroSk wc3_goldenak.am running
[ 32] Golden Awp 1.1 Davidoff wc3_extra_golde running
[ 33] AK LONG 1.0 Author wc3_ak47_long.a running
[ 34] Extra: HK416 1.0 Crock / =) (Popr wc3_hk416.amxx running
[ 35] Bajie Minigun 1.0 Author wc3_minigun.amx running
[ 36] ShopGuns 0.1 Author cso_shop.amxx running
[ 37] Cyber Skull-2 1.0 Author skull2.amxx running
[ 38] unknown unknown unknown blaster_extra.a running
[ 39] Cyber AkPaladin 1.0 Author buff_ak.amxx running
[ 40] Cyber M4Dark 1.0 Author buff_m4.amxx running
[ 41] Cyber Newcomen Expert 1.0 Author cso_ne.amxx running
[ 42] Desperado 2.0 Authoor desperado.amxx running
[ 43] Cyber Ethereal 1.0 Author ethereal.amxx running
[ 44] Cyber LionPistol 1.0 Author lion_pistol.amx running
[ 45] Cyber M249Phoenix 1.0 Author m249_phoenix_zp running
[ 46] Cyber RailCannon 1.0 Author normal_railcann running
[ 47] PlasmaGun 1.0 Sokrat PlasmaGun.amxx running
[ 48] Cyber tornado 1.0 Author tornado.amxx running
[ 49] Star Chaser AR 1.0 Author starchaserar.am running
[ 50] unknown unknown unknown scar.amxx running
[ 51] CSSB Dispenser 15.10.2018 SMaster cssbDispenser.a running
[ 52] CSSB Tesla Coil 15.10.2018 SMaster cssbTeslaCoil.a running
[ 53] CSSB Goliath Sentry Gu 23.03.2019 SMaster cssbSentryGuns. running
[ 54] SF TripMine 0.3.4 serfreeman1337 lasermine.amxx debug
[ 55] Laser MInes 1.0 Author h_laser.amxx debug
[ 56] DDM BUILD SHIELD 1.0 Dimax_Lee shit.amxx debug
[ 57] Grenade: Molotov 1.1 xUnicorn grenade_molotov running
[ 58] NDA Tesla Nades 1.3a OT grenade_tesla.a running
[ 59] PumpkinGrenade 4.0 Author grenade_pumpkin running
[ 60] Teleport Smoke Grenade 0.2 \ grenade_telepor running
[ 61] Ultimited Ammo 2.0 Author ultimited_clip. running
[ 62] Hats shop 1.1 R-2 ShopHats.amxx running
[ 63] Adverts 1.0 pUzzlik adverts_message running
[ 64] HUD HP-AP 1.0 Error hp_ap.amxx running
[ 65] Damager 1.0 Prayer damager_guns.am running
[ 66] Hook 1.0 Hook hook.amxx running
[ 67] [ReAPI] Custom Models 1.6.1 neugomon models.amxx running
[ 68] Custom Knife Model 0.1 Safety1st custom_knife.am running
[ 69] Remove Dropped Weapons Alpha WPMG PRoSToTeM@ remove.amxx running
[ 70] Custom Radio Commands 0.6 KaLoSZyFeR custom_radio.am running
[ 71] Admin ESP 0.2 Kost & miRror admin_esp_mini. running
[ 72] ZM Buy Bhop 1.0 Author bhop_admin.amxx running
[ 73] VIP Informer 1.0 fl0wer vip.amxx running
[ 74] [183] Afk Time 17.10.30 Sanlerus afk_time.amxx running
[ 75] Parachute for ALL [ReA 3.0 Leo_[BH] parachute.amxx running
[ 76] New_MoneyBonus & Sokra 1.0 NewGame_PL bonus.amxx running
[ 77] Damager 1.0 Prayer damager.amxx running
[ 78] Demo Recorder 2.4.0 F@nt0M demo_recorder.a running
[ 79] Money Limiter 1.0 fl0wer money_limiter.a running
[ 80] Vampire 1.0c Shalfey vampire.amxx running
[ 81] Donate money 0.1 Sanlerus \ di.al transfer_money. running
[ 82] resetscore(ReAPI) 1.0 Phantom resetscore.amxx running
[ 83] Knife Steal Money 0.1 mx?! knife_reward.am running
[ 84] Translate 2.1 OverGame Translate.amxx running
[ 85] Show Motd 0.1 Author vipka.amxx running
[ 86] ReCSDM Main 3.6 ReCSDM Team csdm_main.amxx running
[ 87] ReCSDM Equip 3.6 ReCSDM Team csdm_equip.amxx running
[ 88] ReCSDM Spawns 3.6 ReCSDM Team csdm_spawn_pres running
[ 89] ReCSDM Misc 3.6 ReCSDM Team csdm_misc.amxx running
[ 90] ReCSDM Stripper 3.6 KWo csdm_stripper.a running
[ 91] ReCSDM Protection 3.6 BAILOPAN csdm_protection running
91 плагинов, 91 работают
Автор плагина
Нет информации
Версия плагина
1.0
Исходный код
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <beams>
#include <fun>

#define TASK_PLANT 15100

new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0

#define PLUGIN "Laser MInes"
#define VERSION "1.0"
#define AUTHOR "Author"

#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

#define print_team_default DontChange
#define print_team_grey Grey
#define print_team_red Red
#define print_team_blue Blue


#define SND_STOP (1<<5)

#define TRIPMINE_CLASSNAME "monster_tripmine" // tripmine classname

#define TRIPMINE_MODEL "models/v_lasermine.mdl"

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

#define TRIPMINE_PLANTSOUND "csdm/laser_beta/mine_deploy.wav" // plant sound
#define TRIPMINE_CHARGESOUND "csdm/laser_beta/weapons/mine_charge.wav" // charge sound
#define TRIPMINE_ACTIVESOUND "csdm/laser_beta/weapons/mine_activate.wav" // active sound
#define TRIPMINE_HITSOUND "csdm/laser_beta/ambience/beamstart9.wav" // hit sound

#define PLANTWAITTIME 0.1
#define POWERUPTIME 2.0
#define BEAM_WIDTH 15.0
#define BEAM_BRIGHT 255.0

#define PLANT_TIME 1.0 // tripmine plant time
#define PLANT_RADIUS 170.0 // Растояние до стены, при котором может ставиться лазер
#define LASER_LENGTH 8128.0 // Растояние лазерного луча вроде как

#define EV_TM_hOwner EV_ENT_euser4
#define EV_TM_pBeam3 EV_ENT_euser3
#define EV_TM_pBeam2 EV_ENT_euser2
#define EV_TM_pBeam EV_ENT_euser1
#define EV_TM_team EV_INT_iuser4
#define EV_TM_plantTime EV_FL_fuser4
#define EV_TM_mVecDir EV_VEC_vuser4
#define EV_TM_mVecEnd3 EV_VEC_vuser3
#define EV_TM_mVecEnd2 EV_VEC_vuser2
#define EV_TM_mVecEnd EV_VEC_vuser1

#define EV_TM_mineId EV_INT_iuser3

#define VIP_FLAG ADMIN_LEVEL_H // Флаг для VIP
#define HEALTH 800.0 // Жизни мины
#define COST 700 // Цена за установку
#define MAX_MINE 2 // Сколько мин может ставить простои игрок
#define VIP_MAX_MINE 3 // Сколько мин может ставить VIP игрок
#define MINE_DMG 1000.0 // Дамаг от мины
#define MINE_MODE 1.0 // Mетод обновления мины( 1 - лазер нельзя прокачивать, 2 - лазер могут прокачивать только админы, 3 - игроки могут прокачивать мины тимейтов)
#define NAGRADA 2000 // Награда за разрушение
#define REWARD 700 // Возврат денег за уничтожение свои мины.

new Float: g_laser_dwig[300]
new g_laser_stor[300]
new g_level[300]
new g_Metod_abgreid[300]
new g_Laser_kill[300]
new g_laser_dwig_is[300]
new g_laser_gr_mera_id[33]
new g_laser_gr_mera_ent[300]

new Float: g_menu_open[33]

#define ENTITY_REFERENCE "func_breakable"

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

new maxPlayers,expSpr
new playerData[33][playerDataStruct]
new HamHook:playerPostThink,thinkHooks

new BarTime

new g_IDEniti[33]

public plugin_precache()
{
precache_model(TRIPMINE_MODEL)

precache_sound(TRIPMINE_PLANTSOUND)
precache_sound(TRIPMINE_CHARGESOUND)
precache_sound(TRIPMINE_ACTIVESOUND)
precache_sound(TRIPMINE_HITSOUND)
precache_sound("debris/bustglass1.wav")
precache_model(BEAM_SPRITERED)
precache_model(BEAM_SPRITEBLUE)
expSpr = precache_model("sprites/zerogxplode.spr")
}
new g_tm_menu[5]
public plugin_init(){
register_plugin(PLUGIN,VERSION,AUTHOR)

BarTime = get_user_msgid("BarTime")
maxPlayers = get_maxplayers()
register_menu("Menu_1", keys, "func_menu")

// Команда установки мины
register_clcmd("laser_mine_build","SetLaser_CMD")
register_clcmd("laser_mine_delete","SetLaser_DropCMD")

register_forward(FM_CmdStart,"fm_cmdstart");
register_think(TRIPMINE_CLASSNAME,"TripMine_Think")
RegisterHam(Ham_TakeDamage,ENTITY_REFERENCE,"TripMine_Damage")
RegisterHam(Ham_Killed,ENTITY_REFERENCE,"TripMine_Killed")
register_touch("monster_tripmine", "player", "touch_player")


register_logevent("RoundEnd",2,"1=Round_End")
register_logevent("RoundEnd",2,"1=Round_Start")

register_think("beam","Beam_Think")
}

new Float:g_fTime[33]

public fm_cmdstart(id, uc_handle, seed)
{
if(!is_user_alive(id)) return
fw_TraceLine_Post (id)
new buttons = get_uc(uc_handle,UC_Buttons)

if(g_fTime[id]>get_gametime()) return
if(buttons & IN_USE){
new target, body
get_user_aiming(id, target, body, 128)

static ClassName[32]
pev(target, pev_classname, ClassName, charsmax(ClassName))
if (equal(ClassName, TRIPMINE_CLASSNAME)){
if( id != entity_get_edict(target,EV_TM_hOwner)) return

g_fTime[id]=get_gametime()+0.5

if(g_laser_dwig_is[target] == 0){
g_laser_dwig_is[target] = 1
return
}
if(g_laser_dwig_is[target] == 1){
g_laser_dwig_is[target] = 0
return
}
}
}
}

public client_connect( id )
{
g_laser_gr_mera_id[id] = get_pcvar_num(g_tm_menu[0])
}

public touch_player(ent, id)
{
if(MINE_MODE == 1 || g_menu_open[id] > get_gametime() || g_level[ent] == 2 || get_user_team(id) != entity_get_int(ent,EV_TM_team)) return

if(MINE_MODE == 2)
{
if(!(get_user_flags(id) & ADMIN_LEVEL_H)) return
}

g_menu_open[id] = get_gametime() + 1.0

new planterId
planterId = entity_get_edict(ent,EV_TM_hOwner)

if(id == planterId){
if(get_user_flags(id) & get_user_flags(id) & ADMIN_LEVEL_H){
g_IDEniti[id] = ent
}
}else{
g_IDEniti[id] = ent
}
}


public Beam_Think(ent){
new mine = entity_get_edict(ent,EV_ENT_owner)

if(!is_valid_ent(ent))
UTIL_Remove(ent)

if(is_valid_ent(mine) && entity_get_int(ent,EV_TM_mineId) != entity_get_int(mine,EV_TM_mineId))
UTIL_Remove(ent)

entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.05)
}

public RoundEnd(){
new ent

while((ent = find_ent_by_class(ent,TRIPMINE_CLASSNAME))){
new beam = entity_get_edict(ent,EV_TM_pBeam)
if(is_valid_ent(beam))
remove_entity(beam)

beam = entity_get_edict(ent,EV_TM_pBeam2)
if(is_valid_ent(beam))
remove_entity(beam)

beam = entity_get_edict(ent,EV_TM_pBeam3)
if(is_valid_ent(beam))
remove_entity(beam)

remove_entity(ent)
}
}

public CreateLaserMine(PID[])
{
new id = PID[0]

remove_task(TASK_PLANT + id)

SetLaser_DropCMD(id)
}

// Вставить бы сюда сразу прокачку до 2 лвл
public SetLaser_CMD(id)
{
if(get_user_flags(id) & VIP_FLAG){
if(GetPlayer_Mines(id) >= VIP_MAX_MINE){
playerData[id][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME)
ColorChat(id, "^3[^4Инфо^3] ^1Максимальное количество устанавливаемых лазерных мин ^4%d", VIP_MAX_MINE)
return PLUGIN_HANDLED;
}
}else{
if(GetPlayer_Mines(id) >= MAX_MINE){
playerData[id][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME)
ColorChat(id,"^3[^4Инфо^3] ^1Максимальное количество устанавливаемых лазерных мин ^4%d", MAX_MINE)
return PLUGIN_HANDLED;
}
}


playerData[id][PD_START_SET] = true

thinkHooks++

new PID[1]
PID[0] = id
set_task(2.0, "CreateLaserMine", (TASK_PLANT + id), PID, 1)

if(thinkHooks == 1){
if(!playerPostThink)

playerPostThink = RegisterHam(Ham_Player_PostThink,"player","Player_PostThink",true)

else
EnableHamForward(playerPostThink)
}

return PLUGIN_HANDLED
}


public SetLaser_DropCMD(id){
if(!playerData[id][PD_START_SET])
return PLUGIN_HANDLED

thinkHooks--

if(thinkHooks <= 0)
DisableHamForward(playerPostThink)

playerData[id][PD_START_SET] = false

remove_task(TASK_PLANT + id)

if(is_valid_ent(playerData[id][PD_MINE_ENT])){
remove_entity(playerData[id][PD_MINE_ENT])
Send_BarTime(id,0.0)
playerData[id][PD_MINE_ENT] = FM_NULLENT
playerData[id][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME)
}

return PLUGIN_HANDLED
}

public Player_PostThink(id){
if(playerData[id][PD_START_SET])
if(TripMine_PlantThink(id))
TripMine_Plant(id,playerData[id][PD_MINE_ENT]) // plant mine
}

TripMine_Spawn(){
new tm = create_entity(ENTITY_REFERENCE)

entity_set_string(tm,EV_SZ_classname,TRIPMINE_CLASSNAME)

// motor
entity_set_int(tm,EV_INT_movetype,MOVETYPE_FLY)
entity_set_int(tm,EV_INT_solid,SOLID_NOT)

entity_set_model(tm,TRIPMINE_MODEL)
entity_set_float(tm,EV_FL_frame,0.0)
entity_set_int(tm,EV_INT_body,3)
entity_set_int(tm,EV_INT_sequence,7) // TRIPMINE_WORLD
entity_set_float(tm,EV_FL_framerate,0.0)

entity_set_size(tm,Float:{-4.0,-4.0,-4.0},Float:{4.0,4.0,4.0})

return tm
}

GetPlayer_Mines(id){
new ent,cnt

while((ent = find_ent_by_class(ent,TRIPMINE_CLASSNAME))){
if(id == entity_get_edict(ent,EV_TM_hOwner))
cnt ++
}

return cnt
}

//
// Visual planting for tripmine
// id - planter id
// reset - stop planting
//
TripMine_PlantThink(id,bool:reset = false){
if(playerData[id][PD_NEXTPLANT_TIME] > get_gametime())
return false

new ent = playerData[id][PD_MINE_ENT]

if(!is_user_alive(id) || cs_get_user_money(id) - COST < 0)
{ // don't allow planting while running or dead
if(is_valid_ent(ent)){
remove_entity(ent)
Send_BarTime(id,0.0)
}

ColorChat(id, "^3[^4Инфо^3] ^1Недостаточно денег! Необходимо ^4%d $", COST)

playerData[id][PD_MINE_ENT] = FM_NULLENT;
SetLaser_DropCMD(id)

return false
}

if(reset){
if(is_valid_ent(ent)){
remove_entity(ent)
Send_BarTime(id,0.0)
playerData[id][PD_MINE_ENT] = FM_NULLENT

return true
}

return false
}

// make trace origin
new Float:vecSrc[3],Float:vecAiming[3]
entity_get_vector(id,EV_VEC_v_angle,vecSrc)
engfunc(EngFunc_MakeVectors,vecSrc)

entity_get_vector(id,EV_VEC_origin,vecSrc)
entity_get_vector(id,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,id,0)

get_tr2(0,TR_flFraction,flFraction)

if(flFraction < 1.0){ // valid trace
new pHit

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

while((pHit = find_ent_in_sphere(pHit,vecEnd,8.0))){ // don't allow plant mine close together with others
if(pHit <= maxPlayers || pHit == ent)
continue

new classname[32]
entity_get_string(pHit,EV_SZ_classname,classname,charsmax(classname))

if(strcmp(classname,TRIPMINE_CLASSNAME) == 0){
noUpdate = true

if(!is_valid_ent(ent))
return false
}
}

if(!is_valid_ent(ent)){ // create visal object
ent =TripMine_Spawn()

// set transparency
entity_set_int(ent,EV_INT_rendermode,kRenderTransAdd)
entity_set_float(ent,EV_FL_renderamt,255.0)

new Float:plantTime = PLANT_TIME

// set plant time
entity_set_float(ent,EV_TM_plantTime,get_gametime() + plantTime)
entity_set_float(id,EV_FL_maxspeed,1.0)

// show plant progress
Send_BarTime(id,plantTime)

playerData[id][PD_MINE_ENT] = ent
}

if(!noUpdate){
new Float:vecPlaneNormal[3],Float:angles[3]
get_tr2(0,TR_vecPlaneNormal,vecPlaneNormal)
vector_to_angle(vecPlaneNormal,angles)

// calc ideal end pos
xs_vec_mul_scalar(vecPlaneNormal,8.0,vecPlaneNormal)
xs_vec_add(vecEnd,vecPlaneNormal,vecEnd)

// set origin and angles
entity_set_origin(ent,vecEnd)
entity_set_vector(ent,EV_VEC_angles,angles)
}

if(entity_get_float(ent,EV_TM_plantTime) < get_gametime()){
new Float:m_vecDir[3],Float:angles[3]

entity_get_vector(ent,EV_VEC_angles,angles)
engfunc(EngFunc_MakeVectors,angles)
get_global_vector(GL_v_forward,m_vecDir)

m_vecDir[2] = -m_vecDir[2] // ???????????? ???- ???

entity_set_vector(ent,EV_TM_mVecDir,m_vecDir)

return true
}
}else{ // wrong origin
if(is_valid_ent(ent)){
remove_entity(ent)
Send_BarTime(id,0.0)
playerData[id][PD_MINE_ENT] = FM_NULLENT
}
}

return false
}

//
// Plant mine
//
TripMine_Plant(id,ent){
playerData[id][PD_MINE_ENT] = FM_NULLENT
playerData[id][PD_NEXTPLANT_TIME] = _:(get_gametime() + PLANTWAITTIME)

entity_set_int(ent,EV_INT_rendermode,kRenderNormal)
entity_set_float(ent,EV_FL_renderamt,0.0)

entity_set_edict(ent,EV_TM_hOwner,id)
entity_set_int(ent,EV_TM_team,get_user_team(id))

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

entity_set_float(ent,EV_TM_plantTime,get_gametime() + POWERUPTIME)
entity_set_float(ent,EV_FL_nextthink,get_gametime() + POWERUPTIME)

ExecuteHamB(Ham_CS_Player_ResetMaxSpeed,id)

cs_set_user_money(id,cs_get_user_money(id) - COST)

cs_set_user_money(id,cs_get_user_money(id) - COST)


g_laser_dwig[ent] = 0.0
g_laser_stor[ent] = 1
g_level[ent] = 2
g_laser_dwig_is[ent] = 0
g_Metod_abgreid[ent] = 0
g_Laser_kill[ent] = 0
g_laser_gr_mera_ent[ent] = 0


SetLaser_DropCMD(id)

return true
}


public TripMine_Think(ent){
if(entity_get_float(ent,EV_TM_plantTime)){ // check the possibility to activate
new Float:m_vecDir[3]
entity_get_vector(ent,EV_TM_mVecDir,m_vecDir)

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

entity_get_vector(ent,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(ent,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,ent,0)

new Float:flFraction

get_tr2(0,TR_flFraction,flFraction)

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

new f
// make sure that player will not stuck on mine
while((f = find_ent_in_sphere(f,vecSrc,12.0))){
if(f > maxPlayers)
break

entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.1)
return
}

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

entity_set_int(ent,EV_TM_mineId,random(1337))

entity_set_int(ent,EV_INT_solid,SOLID_BBOX)
entity_set_float(ent,EV_TM_plantTime,0.0)

entity_set_float(ent,EV_FL_takedamage,DAMAGE_YES)
entity_set_float(ent,EV_FL_dmg,100.0)
entity_set_float(ent,EV_FL_health,HEALTH)
}
}

new beam = entity_get_edict(ent,EV_TM_pBeam3)

if(entity_get_float(ent,EV_FL_health) <= 0.0 && is_valid_ent(beam)){
ExecuteHamB(Ham_Killed,ent,0,0)
return
}

new id = entity_get_edict(ent,EV_TM_hOwner)

if(!is_user_alive(id) || get_user_team(id) != entity_get_int(ent,EV_TM_team)){
beam = entity_get_edict(ent,EV_TM_pBeam)
if(is_valid_ent(beam))
UTIL_Remove(beam)

beam = entity_get_edict(ent,EV_TM_pBeam2)
if(is_valid_ent(beam))
UTIL_Remove(beam)
beam = entity_get_edict(ent,EV_TM_pBeam3)
if(is_valid_ent(beam))
UTIL_Remove(beam)


remove_entity(ent)

return
}
if(is_valid_ent(beam)){
new Float:vecSrc[3],Float:vecEnd[3], Float:vecEnd2[3]
static Float:vAngle[3], Float:vForward[3]
pev(ent,pev_angles,vAngle)

entity_get_vector(ent,EV_VEC_origin,vecSrc)

angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward)


vecEnd[0] = vecSrc[0] + vForward[0] * 9999
vecEnd[1] = vecSrc[1] + vForward[1] * 9999
vecEnd[2] = vecSrc[2] - vForward[2] * 9999

new pHit,tr = create_tr2()
engfunc(EngFunc_TraceLine,vecSrc,vecEnd,DONT_IGNORE_MONSTERS,ent,tr)

pHit = get_tr2(tr,TR_pHit)
get_tr2(tr,TR_vecEndPos,vecEnd2)

Beam_SetStartPos(beam,vecEnd2)

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

if(0 < pHit <= maxPlayers){
new team = entity_get_int(ent,EV_TM_team)

if(get_user_team(pHit) != team && entity_get_float(pHit,EV_FL_takedamage) != 0.0 && !IsInSphere (pHit)){
if(get_user_health(pHit) <= MINE_DMG){
g_Laser_kill[ent]++
}
if(ExecuteHamB(Ham_TakeDamage,pHit,ent,entity_get_edict(ent,EV_TM_hOwner),MINE_DMG,16777216)){
ExecuteHamB(Ham_TraceBleed,pHit,1337.0,Float:{0.0,0.0,0.0},tr,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(tr)
}

beam = entity_get_edict(ent,EV_TM_pBeam)

if(g_level[ent] == 2)
{
if(is_valid_ent(beam)){
new Float:vecSrc[3],Float:vecEnd[3], Float:vecEnd2[3]
static Float:vAngle[3], Float:vForward[3]
pev(ent,pev_angles,vAngle)
if(g_laser_dwig_is[ent] == 1)
{
if(g_laser_stor[ent] == 1){
if(g_laser_dwig[ent] <= g_laser_gr_mera_ent[ent]){
g_laser_dwig[ent]+= 0.5
}else{
g_laser_stor[ent] = 2
}
}else if(g_laser_stor[ent] == 2){
if(g_laser_dwig[ent] >= -g_laser_gr_mera_ent[ent]){
g_laser_dwig[ent]-=0.5
}else{
g_laser_stor[ent] = 1
}
}
}
if(g_Metod_abgreid[ent] == 2){
vAngle[0]+=g_laser_dwig[ent]
}else if(g_Metod_abgreid[ent] == 1){
vAngle[1]+=g_laser_dwig[ent]
}
entity_get_vector(ent,EV_VEC_origin,vecSrc)
angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward)
vecEnd[0] = vecSrc[0] + vForward[0] * 9999
vecEnd[1] = vecSrc[1] + vForward[1] * 9999
vecEnd[2] = vecSrc[2] - vForward[2] * 9999

new pHit,tr = create_tr2()
engfunc(EngFunc_TraceLine,vecSrc,vecEnd,DONT_IGNORE_MONSTERS,ent,tr)

pHit = get_tr2(tr,TR_pHit)
get_tr2(tr,TR_vecEndPos,vecEnd2)

Beam_SetStartPos(beam,vecEnd2)

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

if(0 < pHit <= maxPlayers){
new team = entity_get_int(ent,EV_TM_team)

if(get_user_team(pHit) != team && entity_get_float(pHit,EV_FL_takedamage) != 0.0 && !IsInSphere (pHit)){
if(get_user_health(pHit) <= MINE_DMG){
g_Laser_kill[ent]++
}
if(ExecuteHamB(Ham_TakeDamage,pHit,ent,entity_get_edict(ent,EV_TM_hOwner),MINE_DMG,16777216)){
ExecuteHamB(Ham_TraceBleed,pHit,1337.0,Float:{0.0,0.0,0.0},tr,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(tr)
}
beam = entity_get_edict(ent,EV_TM_pBeam2)
if(is_valid_ent(beam)){
new Float:vecSrc[3],Float:vecEnd[3], Float:vecEnd2[3]
static Float:vAngle[3], Float:vForward[3]
pev(ent,pev_angles,vAngle)

entity_get_vector(ent,EV_VEC_origin,vecSrc)
entity_get_vector(ent,EV_TM_mVecEnd2,vecEnd)

entity_get_vector(ent,EV_VEC_origin,vecSrc)
if(g_Metod_abgreid[ent] == 2){
vAngle[0]-=g_laser_dwig[ent]
}else if(g_Metod_abgreid[ent] == 1){
vAngle[1]-=g_laser_dwig[ent]
}
angle_vector(vAngle, ANGLEVECTOR_FORWARD, vForward)
vecEnd[0] = vecSrc[0] + vForward[0] * 9999
vecEnd[1] = vecSrc[1] + vForward[1] * 9999
vecEnd[2] = vecSrc[2] - vForward[2] * 9999


new pHit,tr = create_tr2()
engfunc(EngFunc_TraceLine,vecSrc,vecEnd,DONT_IGNORE_MONSTERS,ent,tr)

pHit = get_tr2(tr,TR_pHit)
get_tr2(tr,TR_vecEndPos,vecEnd2)

Beam_SetStartPos(beam,vecEnd2)

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

if(0 < pHit <= maxPlayers){
new team = entity_get_int(ent,EV_TM_team)

if(get_user_team(pHit) != team && entity_get_float(pHit,EV_FL_takedamage) != 0.0 && !IsInSphere (pHit)){
if(get_user_health(pHit) <= MINE_DMG){
g_Laser_kill[ent]++
}
if(ExecuteHamB(Ham_TakeDamage,pHit,ent,entity_get_edict(ent,EV_TM_hOwner),MINE_DMG,16777216)){
ExecuteHamB(Ham_TraceBleed,pHit,1337.0,Float:{0.0,0.0,0.0},tr,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(tr)
}
}
if(is_valid_ent(ent)){
entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.05)
}
}
new Float:taget_tim[33]
public fw_TraceLine_Post ( id )
{
if(taget_tim[id]<get_gametime())
{
taget_tim[id]=get_gametime()+0.5

new ent, body
get_user_aiming(id, ent, body, 128)
static ClassName[32]
pev(ent, pev_classname, ClassName, charsmax(ClassName))
if (equal(ClassName, TRIPMINE_CLASSNAME))
{
if(is_valid_ent(ent))
{
if(get_user_team(id) == entity_get_int(ent,EV_TM_team))
{
new planterId,planterName[32],team = entity_get_int(ent,EV_TM_team)

planterId = entity_get_edict(ent,EV_TM_hOwner)
get_user_name(planterId,planterName,charsmax(planterName))

new Float: Helath_max
if(g_level[ent] == 1){
Helath_max = HEALTH
} else if(g_level[ent] == 2){
Helath_max = HEALTH
}

set_dhudmessage(team == 1 ? 255 : 0, 50, team == 2 ? 255 : 0, -1.0, 0.35, 0, 0.0, 0.55, 0.0, 0.0)
show_dhudmessage(id,"Установил: %s^nЗдоровье: %.0f/%.0f^n^nУбийств: %d",planterName,entity_get_float(ent,EV_FL_health),Helath_max, g_Laser_kill[ent])
if(g_level[ent] == 2){
if(id == planterId){
set_dhudmessage(team == 1 ? 255 : 0, 50, team == 2 ? 255 : 0, -1.0, 0.35, 0, 0.0, 0.55, 0.0, 0.0)
show_dhudmessage(id,"^n^n^n^n Для запуска лучей нажмите [E]")
}
}
}
}
}
}
}


//
// Tripmine damage
//
public TripMine_Damage(ent,inflictor,attacker){
new classname[32]
entity_get_string(ent,EV_SZ_classname,classname,charsmax(classname))

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

entity_set_edict(ent,EV_ENT_dmg_inflictor,attacker)

if(!(0 < attacker <= maxPlayers))
return HAM_IGNORED

if(entity_get_int(ent,EV_TM_team) == get_user_team(attacker) && entity_get_edict(ent,EV_TM_hOwner) != attacker) // block friendly fire
return HAM_SUPERCEDE

return HAM_IGNORED
}

//
// Tripmine detonate
//
public TripMine_Killed(ent){
new classname[32]
entity_get_string(ent,EV_SZ_classname,classname,charsmax(classname))

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

new beam = entity_get_edict(ent,EV_TM_pBeam)
if(is_valid_ent(beam))
UTIL_Remove(beam)

beam = entity_get_edict(ent,EV_TM_pBeam2)
if(is_valid_ent(beam))
UTIL_Remove(beam)

beam = entity_get_edict(ent,EV_TM_pBeam3)
if(is_valid_ent(beam))
UTIL_Remove(beam)

new Float:origin[3],Float:m_vecDir[3]
entity_get_vector(ent,EV_VEC_origin,origin)
entity_get_vector(ent,EV_TM_mVecDir,m_vecDir)

xs_vec_mul_scalar(m_vecDir,8.0,m_vecDir)
xs_vec_add(origin,m_vecDir,origin)

message_begin_f(MSG_PVS,SVC_TEMPENTITY,origin,0)
write_byte(TE_EXPLOSION)
write_coord_f(origin[0])
write_coord_f(origin[1])
write_coord_f(origin[2])
write_short(expSpr)
write_byte(20)
write_byte(15)
write_byte(0)
message_end()

new killer = entity_get_edict(ent,EV_ENT_dmg_inflictor)
new hOwner = entity_get_edict(ent,EV_TM_hOwner)

if(!(0 < killer <= maxPlayers) || killer == entity_get_edict(ent,EV_TM_hOwner))
{
ColorChat(hOwner, "^3[^4Лазер^3] ^1Ваша лазерная мина удалена! Деньги за установку возвращены, в размере !g%d $", REWARD)
cs_set_user_money ( hOwner, min ( cs_get_user_money ( hOwner ) + REWARD, 20000 ) )
}
else
{
new exploderName[32]
get_user_name(killer,exploderName,charsmax(exploderName))

ColorChat(hOwner, "^3[^4Лазер^3] ^1Вашу лазерную мину, уничтожил !t%s",exploderName)
ColorChat(killer, "^3[^4Лазер^3] ^1За уничтожение мины вы получили, + %d", NAGRADA)
cs_set_user_money ( killer, min ( cs_get_user_money ( killer ) + NAGRADA, 20000 ) )
}

return HAM_IGNORED
}

Send_BarTime(player,Float:duration){
if(duration == 0.0){
ExecuteHamB(Ham_CS_Player_ResetMaxSpeed,player)
}

message_begin(MSG_ONE,BarTime,.player = player)
write_short(floatround(duration))
message_end()
}


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

entity_set_int(pEntity,EV_INT_flags,entity_get_int(pEntity,EV_INT_flags) | FL_KILLME)
//entity_set_string(pEntity,EV_SZ_targetname,"")
}


bool:IsInSphere ( id )
{
if ( !is_user_alive ( id ) )
return false

new ent = -1
while ( ( ent = engfunc ( EngFunc_FindEntityByString, ent, "classname", "campo_grenade_forze" ) ) > 0 )
{
new iOwner = pev ( ent, pev_owner )

if ( cs_get_user_team ( id ) != cs_get_user_team ( iOwner ) )
continue

new Float:fOrigin[3]
pev ( ent, pev_origin, fOrigin )
new iPlayer = -1
while ( ( iPlayer = engfunc ( EngFunc_FindEntityInSphere, iPlayer, fOrigin, 68.0 ) ) != 0 )
{
if ( iPlayer == id )
return true
}
}
return false
}

stock ColorChat(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
Понять не могу что эта ошибка означает, вроде при установке мины возникает данная ошибка, и при работе мины вроде как.
Помогите исправить.
 

Вложения

Сообщения
3,582
Реакции
1,570
Помог
137 раз(а)
DEVCS, исходник не соответствует ошибкам.
 
Сообщения
38
Реакции
-1
Помог
1 раз(а)
sbelov020, щас я перепроверю, ибо я использую этот плагин для мин.
 
Сообщения
38
Реакции
-1
Помог
1 раз(а)
sbelov020, извиняюсь, запутался в этих минах....

Вот исходник данного плагина, так же я его выше перезалил.

Код:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <xs>
#include <beams>
#include <fun>
 
#define PLUGIN "SF TripMine"
#define VERSION "0.3.4"
#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>
        #include <colorchat>
      
        #define print_team_default DontChange
        #define print_team_grey Grey
        #define print_team_red Red
        #define print_team_blue Blue
#endif

 
#define SND_STOP                (1<<5)
 
#define TRIPMINE_MODEL          "models/v_lasermine.mdl"                // tripmine model
#define TRIPMINE_CLASSNAME      "lasermines"                             // tripmine classname
 
#define BEAM_SPRITERED          "sprites/laserr.spr"
#define BEAM_SPRITEBLUE         "sprites/laserb.spr"
 
#define TRIPMINE_PLANTSOUND     "csdm/laser_beta/mine_deploy.wav"       // plant sound
#define TRIPMINE_CHARGESOUND    "csdm/laser_beta/mine_charge.wav"       // charge sound
#define TRIPMINE_ACTIVESOUND    "csdm/laser_beta/mine_activate.wav"     // active sound
#define TRIPMINE_HITSOUND       "csdm/laser_beta/beamstart9.wav"        // hit sound
 
#define PLANTWAITTIME           0.1
#define POWERUPTIME             2.0
#define BEAM_WIDTH              15.0
#define BEAM_BRIGHT             255.0
// за разрушение мины
#define REWARD_MONEY             500
#define REWARD_MONEY_ME         700

#define PLANT_TIME              0.3                             // tripmine plant time
#define MINE_HEALTH             800.0                           // tripmine health

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define MAX_COUNT               2                               // макс количество мин для обычного игрока
#define MAX_COUNT_V             3                               // макс количество мин для випа
#define MAX_COUNT_SV            3                               // макс количество мин для супер випа
#define MAX_COUNT_B             3                               // макс количество мин для босса
#define MAX_COUNT_A             3                               // макс количество мин для админа


#define FLAG_V                    ADMIN_LEVEL_H
#define FLAG_SV                    ADMIN_LEVEL_H
#define FLAG_B                    ADMIN_LEVEL_H
#define FLAG_A                    ADMIN_LEVEL_H

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define MINE_DAMAGE             1000.0                            // laser damage
#define MINE_COST               700                             // tripmine cost
#define PLANT_RADIUS            170.0                            // default plant radius
#define LASER_LENGTH            8128.0                          // maximum laser length
 
#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"
 
// -- DATAS -- //
enum _:playerDataStruct {
        PD_MINE_ENT,
        Float:PD_NEXTPLANT_TIME,
        bool:PD_START_SET
}

new g_Laser_kill[300]

new maxPlayers,expSpr
new playerData[33][playerDataStruct]
new HamHook:playerPostThink,thinkHooks
 
new BarTime
 
public plugin_precache(){
        precache_model(TRIPMINE_MODEL)
      
        precache_sound(TRIPMINE_PLANTSOUND)
        precache_sound(TRIPMINE_CHARGESOUND)
        precache_sound(TRIPMINE_ACTIVESOUND)
        precache_sound(TRIPMINE_HITSOUND)
      
        precache_model(BEAM_SPRITERED)
        precache_model(BEAM_SPRITEBLUE)
      
        expSpr = precache_model("sprites/csdm_explode.spr")
    precache_sound("dmsentries/fail_update_2.wav")
}
 
public plugin_init(){
        register_plugin(PLUGIN,VERSION,AUTHOR)
 
        BarTime = get_user_msgid("BarTime")
        maxPlayers = get_maxplayers()
      
        register_clcmd("laser_mine_build","SetLaser_CMD")
        register_clcmd("-laser_mine_build","SetLaser_DropCMD")
      
        register_think(TRIPMINE_CLASSNAME,"TripMine_Think")
        RegisterHam(Ham_TakeDamage,ENTITY_REFERENCE,"TripMine_Damage")
        RegisterHam(Ham_Killed,ENTITY_REFERENCE,"TripMine_Killed")
      
        register_logevent("RoundEnd",2,"1=Round_End")
        register_logevent("RoundEnd",2,"1=Round_Start")
      
    register_think("beam","Beam_Think")
}
//
// random beams fix attempt
//
public Beam_Think(ent){
        new mine = entity_get_edict(ent,EV_ENT_owner)
      
        if(!is_valid_ent(ent))
                UTIL_Remove(ent)
      
        if(entity_get_int(ent,EV_TM_mineId) != entity_get_int(mine,EV_TM_mineId))
                UTIL_Remove(ent)
      
        entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.05)
}
 
public RoundEnd(){
        new ent
      
        while((ent = find_ent_by_class(ent,TRIPMINE_CLASSNAME))){
                new beam = entity_get_edict(ent,EV_TM_pBeam)
              
                if(is_valid_ent(beam))
                        remove_entity(beam)
                      
                remove_entity(ent)
        }
}
 
public SetLaser_CMD(id){
        if(get_user_flags(id) & FLAG_A){
                if(GetPlayer_Mines(id) >= MAX_COUNT_A){ // Для админа
                    playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
                    color_chat(id, "!y[!gИнфо!y] !tУстановлено максимальное количество мин! Вам доступно !g%d мин(ы)", MAX_COUNT_A)
                    emit_sound(id, CHAN_AUTO, "dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return PLUGIN_HANDLED
                }
        }
        
        else if(get_user_flags(id) & FLAG_B){ // Для босса
            if(GetPlayer_Mines(id) >= MAX_COUNT_B){
                    playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
                    color_chat(id, "!y[!gИнфо!y] !tУстановлено максимальное количество мин! Вам доступно !g%d мин(ы)", MAX_COUNT_A)
                    emit_sound(id, CHAN_AUTO, "dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return PLUGIN_HANDLED
                }
        }
        
        else if(get_user_flags(id) & FLAG_SV){ // Для для супер випа
            if(GetPlayer_Mines(id) >= MAX_COUNT_SV){
                    playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
                    color_chat(id, "!y[!gИнфо!y] !tУстановлено максимальное количество мин! Вам доступно !g%d мин(ы)", MAX_COUNT_A)
                    emit_sound(id, CHAN_AUTO, "dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return PLUGIN_HANDLED
                }
        }
        
        else if(get_user_flags(id) & FLAG_V){ // Для випа
            if(GetPlayer_Mines(id) >= MAX_COUNT_V){
                    playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
                    color_chat(id, "!y[!gИнфо!y] !tУстановлено максимальное количество мин! Вам доступно !g%d мин(ы)", MAX_COUNT_A)
                    emit_sound(id, CHAN_AUTO, "dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                    return PLUGIN_HANDLED
                }
        }
    
        else if(GetPlayer_Mines(id) >= MAX_COUNT){ // Для обычного игрока
            playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
            color_chat(id, "!y[!gИнфо!y] !tУстановлено максимальное количество мин! Вам доступно !g%d мин(ы)", MAX_COUNT)
            emit_sound(id, CHAN_AUTO, "dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            return PLUGIN_HANDLED
        }

        playerData[id][PD_START_SET] = true
      
        thinkHooks++
      
        if(thinkHooks == 1){
            if(!playerPostThink)
                        #if AMXX_VERSION_NUM >= 183
                        playerPostThink = RegisterHamPlayer(Ham_Player_PostThink,"Player_PostThink",true)
                        #else
                        playerPostThink = RegisterHam(Ham_Player_PostThink,"player","Player_PostThink",true)
                        #endif
            else
                        EnableHamForward(playerPostThink)
        }
      
        return PLUGIN_HANDLED
}
 
public SetLaser_DropCMD(id){
        if(!playerData[id][PD_START_SET])
                return PLUGIN_HANDLED
              
        thinkHooks--
      
        if(thinkHooks <= 0)
                DisableHamForward(playerPostThink)
              
        playerData[id][PD_START_SET] = false
      
        if(is_valid_ent(playerData[id][PD_MINE_ENT])){
                remove_entity(playerData[id][PD_MINE_ENT])
                Send_BarTime(id,0.0)
                playerData[id][PD_MINE_ENT] = FM_NULLENT
                playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
        }
              
        return PLUGIN_HANDLED
}
 
public Player_PostThink(id){
        if(playerData[id][PD_START_SET])
                if(TripMine_PlantThink(id))
                        TripMine_Plant(id,playerData[id][PD_MINE_ENT]) // plant mine
}
 
//
// Spawn tripmine entity
//
TripMine_Spawn(){
        new tm = create_entity(ENTITY_REFERENCE)
      
        entity_set_string(tm,EV_SZ_classname,TRIPMINE_CLASSNAME)
      
        // motor
        entity_set_int(tm,EV_INT_movetype,MOVETYPE_FLY)
        entity_set_int(tm,EV_INT_solid,SOLID_NOT)
      
        entity_set_model(tm,TRIPMINE_MODEL)
        entity_set_float(tm,EV_FL_frame,0.0)
        entity_set_int(tm,EV_INT_body,3)
        entity_set_int(tm,EV_INT_sequence,7)    // TRIPMINE_WORLD
        entity_set_float(tm,EV_FL_framerate,0.0)
      
        entity_set_size(tm,Float:{-8.0,-8.0,-8.0},Float:{8.0,8.0,8.0})
      
        return tm
}
 
GetPlayer_Mines(id){
        new ent,cnt
      
        while((ent = find_ent_by_class(ent,TRIPMINE_CLASSNAME))){
                if(id == entity_get_edict(ent,EV_TM_hOwner))
                        cnt ++
        }
      
        return cnt
}
 
//
// Visual planting for tripmine
//      id - planter id
//      reset - stop planting
//
TripMine_PlantThink(id,bool:reset = false){
        if(playerData[id][PD_NEXTPLANT_TIME] > get_gametime())
                return false
              
        new ent = playerData[id][PD_MINE_ENT]
      
        if(!is_user_alive(id) ||
                cs_get_user_money(id) - MINE_COST < 0
        ){ // don't allow planting while running or dead
            if(is_valid_ent(ent)){
                    remove_entity(ent)
                    Send_BarTime(id,0.0)
            }
            color_chat(id, "!y[!gИнфо!y] !tУ тебя не хватает денег! !g(!nнужно !t%d!g)", MINE_COST)
            emit_sound(id, CHAN_AUTO, "dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
            playerData[id][PD_MINE_ENT] = FM_NULLENT
            SetLaser_DropCMD(id)
            //playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
  
            return false
        }
      
        if(reset){ // destroy visal object
                if(is_valid_ent(ent)){
                        remove_entity(ent)
                        Send_BarTime(id,0.0)
                        playerData[id][PD_MINE_ENT] = FM_NULLENT
                      
                        return true
                }
              
                return false
        }
      
        // make trace origin
        new Float:vecSrc[3],Float:vecAiming[3]
        entity_get_vector(id,EV_VEC_v_angle,vecSrc)
        engfunc(EngFunc_MakeVectors,vecSrc)
      
        entity_get_vector(id,EV_VEC_origin,vecSrc)
        entity_get_vector(id,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,id,0)
      
        get_tr2(0,TR_flFraction,flFraction)
      
        if(flFraction < 1.0){ // valid trace
                new pHit
              
                new Float:vecEnd[3],bool:noUpdate
                get_tr2(0,TR_vecEndPos,vecEnd)
              
                while((pHit = find_ent_in_sphere(pHit,vecEnd,8.0))){ // don't allow plant mine close together with others
                        if(pHit <= maxPlayers || pHit == ent)
                                continue
                              
                        new classname[32]
                        entity_get_string(pHit,EV_SZ_classname,classname,charsmax(classname)) 
                      
                        if(strcmp(classname,TRIPMINE_CLASSNAME) == 0){
                                noUpdate = true
                              
                                if(!is_valid_ent(ent))
                                        return false
                        }
                }
              
                if(!is_valid_ent(ent)){ // create visal object
                        ent =TripMine_Spawn()
              
                        // set transparency
                        entity_set_int(ent,EV_INT_rendermode,kRenderTransAdd)
                        entity_set_float(ent,EV_FL_renderamt,255.0)
                      
                        new Float:plantTime = PLANT_TIME
                      
                        // set plant time
                        entity_set_float(ent,EV_TM_plantTime,get_gametime() + plantTime)
                        entity_set_float(id,EV_FL_maxspeed,1.0)
                      
                        // show plant progress
                        Send_BarTime(id,plantTime)
                      
                        playerData[id][PD_MINE_ENT] = ent
                }
              
                if(!noUpdate){
                        new Float:vecPlaneNormal[3],Float:angles[3]
                        get_tr2(0,TR_vecPlaneNormal,vecPlaneNormal)
                        vector_to_angle(vecPlaneNormal,angles)
                      
                        // calc ideal end pos
                        xs_vec_mul_scalar(vecPlaneNormal,8.0,vecPlaneNormal)
                        xs_vec_add(vecEnd,vecPlaneNormal,vecEnd)
                      
                        // set origin and angles
                        entity_set_origin(ent,vecEnd)
                        entity_set_vector(ent,EV_VEC_angles,angles)
                }
              
                if(entity_get_float(ent,EV_TM_plantTime) < get_gametime()){
                        new Float:m_vecDir[3],Float:angles[3]
                      
                        entity_get_vector(ent,EV_VEC_angles,angles)
                        engfunc(EngFunc_MakeVectors,angles)
                        get_global_vector(GL_v_forward,m_vecDir)
                      
                        m_vecDir[2] = -m_vecDir[2] // только в России верх - это низ, а низ - это верх
 
                        entity_set_vector(ent,EV_TM_mVecDir,m_vecDir)
                      
                        return true
                }
        }else{ // wrong origin
                if(is_valid_ent(ent)){
                        remove_entity(ent)
                        Send_BarTime(id,0.0)
                        playerData[id][PD_MINE_ENT] = FM_NULLENT
                }
        }
              
        return false
}
 
//
// Plant mine
//
TripMine_Plant(id,ent){
        playerData[id][PD_MINE_ENT] = FM_NULLENT
        playerData[id][PD_NEXTPLANT_TIME] =  _:(get_gametime() + PLANTWAITTIME)
      
        entity_set_int(ent,EV_INT_rendermode,kRenderNormal)
        entity_set_float(ent,EV_FL_renderamt,0.0)
      
        entity_set_edict(ent,EV_TM_hOwner,id)
        entity_set_int(ent,EV_TM_team,get_user_team(id))
      
        emit_sound(ent,CHAN_VOICE,TRIPMINE_PLANTSOUND,1.0,ATTN_NORM,0,PITCH_NORM)
        emit_sound(ent,CHAN_BODY,TRIPMINE_CHARGESOUND,0.2,ATTN_NORM,0,PITCH_NORM)
      
        entity_set_float(ent,EV_TM_plantTime,get_gametime() + POWERUPTIME)
        entity_set_float(ent,EV_FL_nextthink,get_gametime() + POWERUPTIME)
      
        ExecuteHamB(Ham_CS_Player_ResetMaxSpeed,id)
      
        cs_set_user_money(id,cs_get_user_money(id) - MINE_COST)
      
        //if(GetPlayer_Mines(id) >= MAX_COUNT) // stop
        SetLaser_DropCMD(id)
      
        g_Laser_kill[ent] = 0
        
        return true
}
 
//
// Tripmine think
//
public TripMine_Think(ent){
        if(entity_get_float(ent,EV_TM_plantTime)){ // check the possibility to activate
                new Float:m_vecDir[3]
                entity_get_vector(ent,EV_TM_mVecDir,m_vecDir)
      
                new Float:vecSrc[3],Float:vecEnd[3]
              
                entity_get_vector(ent,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(ent,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,ent,0)
              
                new Float:flFraction
              
                get_tr2(0,TR_flFraction,flFraction)
              
                if(flFraction == 1.0){
                        get_tr2(0,TR_vecEndPos,vecEnd)
                      
                        new f
                        // make sure that player will not stuck on mine
                        while((f = find_ent_in_sphere(f,vecSrc,12.0))){
                                if(f > maxPlayers)
                                        break
                                      
                                entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.1)
                                return
                        }
                      
                        emit_sound(ent,CHAN_BODY,TRIPMINE_CHARGESOUND,0.0,ATTN_NORM,SND_STOP,0)
                        emit_sound(ent,CHAN_VOICE,TRIPMINE_ACTIVESOUND,0.5,ATTN_NORM,1,75)
                      
                        entity_set_int(ent,EV_TM_mineId,random(1337))
                        TripMine_MakeBeam(ent)
                      
                        entity_set_int(ent,EV_INT_solid,SOLID_BBOX)
                        entity_set_float(ent,EV_TM_plantTime,0.0)
                      
                        entity_set_float(ent,EV_FL_takedamage,DAMAGE_YES)
                        entity_set_float(ent,EV_FL_dmg,100.0)
                        entity_set_float(ent,EV_FL_health,MINE_HEALTH)
                }
        }
      
        new beam = entity_get_edict(ent,EV_TM_pBeam)
      
        if(entity_get_float(ent,EV_FL_health) <= 0.0 && is_valid_ent(beam)){
                ExecuteHamB(Ham_Killed,ent,0,0)
                return
        }
      
        new id = entity_get_edict(ent,EV_TM_hOwner)
      
        if(!is_user_alive(id) || get_user_team(id) != entity_get_int(ent,EV_TM_team)){ // explode mine on disconnect or team change
                new beam = entity_get_edict(ent,EV_TM_pBeam)
                if(is_valid_ent(beam))
                        UTIL_Remove(beam)
              
                remove_entity(ent)
              
                //ExecuteHamB(Ham_TakeDamage,ent,0,0,9999.0,DMG_BLAST)
                return
        }
      
        if(is_valid_ent(beam)){
                new Float:vecSrc[3],Float:vecEnd[3]
              
                entity_get_vector(ent,EV_VEC_origin,vecSrc)
                entity_get_vector(ent,EV_TM_mVecEnd,vecEnd)
              
                new pHit,tr = create_tr2()
                engfunc(EngFunc_TraceLine,vecSrc,vecEnd,DONT_IGNORE_MONSTERS,ent,tr)
              
                pHit = get_tr2(tr,TR_pHit)
                get_tr2(tr,TR_vecEndPos,vecEnd)
              
                Beam_SetStartPos(beam,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 <= maxPlayers){
                        new team = entity_get_int(ent,EV_TM_team)
                        if(get_user_team(pHit) != team && entity_get_float(pHit,EV_FL_takedamage) != 0.0){
                                if(ExecuteHamB(Ham_TakeDamage,pHit,ent,entity_get_edict(ent,EV_TM_hOwner),MINE_DAMAGE,16777216)){
                        g_Laser_kill[ent]++
                        ExecuteHamB(Ham_TraceBleed,pHit,1337.0,Float:{0.0,0.0,0.0},tr,DMG_ENERGYBEAM)
                                        //client_print(0,print_chat,"Атака")
                                }else{
                                        //client_print(0,print_chat,"Убил")
                                        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(tr)
        }
      
        if(is_valid_ent(ent)){
                TripMine_StatusInfo(ent)
                entity_set_float(ent,EV_FL_nextthink,get_gametime() + 0.1)
        }
}
 
TripMine_StatusInfo(ent){
        if(!is_valid_ent(ent))
                return
      
        new player,Float:origin[3],hitEnt,bh
        entity_get_vector(ent,EV_VEC_origin,origin)
      
        while((player = find_ent_in_sphere(player,origin,1024.0))){
                if(player > maxPlayers)
                        break
                      
                if(get_user_team(player) != entity_get_int(ent,EV_TM_team))
                        continue
                      
                get_user_aiming(player,hitEnt,bh)
              
                if(hitEnt != ent)
                        continue
              
                new planterId,planterName[32],team = entity_get_int(ent,EV_TM_team)
              
                planterId = entity_get_edict(ent,EV_TM_hOwner)
                get_user_name(planterId,planterName,charsmax(planterName))
              
                set_dhudmessage(team == 1 ? 150 : 0, 0, team == 2 ? 150 : 0, -1.0, 0.35, 0, 0.0, 0.6, 0.0, 0.0)
                show_dhudmessage(player,"Установил: %s^nУбийств: %d^nЗдоровье: %.0f", planterName, g_Laser_kill[ent], entity_get_float(ent,EV_FL_health))
        }
}
 
//
// Tripmine damage
//
public TripMine_Damage(ent,inflictor,attacker){
        new classname[32]
        entity_get_string(ent,EV_SZ_classname,classname,charsmax(classname))
      
        if(strcmp(classname,TRIPMINE_CLASSNAME) != 0)
                return HAM_IGNORED
              
        entity_set_edict(ent,EV_ENT_dmg_inflictor,attacker)
      
        if(!(0 < attacker <= maxPlayers))
                return HAM_IGNORED
      
        if(entity_get_int(ent,EV_TM_team) == get_user_team(attacker) && entity_get_edict(ent,EV_TM_hOwner) != attacker) // block friendly fire
                return HAM_SUPERCEDE
              
        return HAM_IGNORED
}
 
//
// Tripmine detonate
//
public TripMine_Killed(ent,idattacker){
        new classname[32]
        entity_get_string(ent,EV_SZ_classname,classname,charsmax(classname))
      
        if(strcmp(classname,TRIPMINE_CLASSNAME) != 0)
                return HAM_IGNORED
              
        new beam = entity_get_edict(ent,EV_TM_pBeam)
      
        // remove beam
        if(is_valid_ent(beam))
                UTIL_Remove(beam)
              
        new Float:origin[3],Float:m_vecDir[3]
        entity_get_vector(ent,EV_VEC_origin,origin)
        entity_get_vector(ent,EV_TM_mVecDir,m_vecDir)
        //client_print(0,print_chat,"Kill")
        xs_vec_mul_scalar(m_vecDir,8.0,m_vecDir)
        xs_vec_add(origin,m_vecDir,origin)
      
        message_begin_f(MSG_PVS,SVC_TEMPENTITY,origin,0)
        write_byte(TE_EXPLOSION)
        write_coord_f(origin[0])
        write_coord_f(origin[1])
        write_coord_f(origin[2])
        write_short(expSpr)
        write_byte(20)
        write_byte(15)
        write_byte(0)
        message_end()
      
        new killer = entity_get_edict(ent,EV_ENT_dmg_inflictor)
        new hOwner = entity_get_edict(ent,EV_TM_hOwner)

      
        if(!(0 < killer <= maxPlayers) || killer == entity_get_edict(ent,EV_TM_hOwner))
        {
        color_chat(hOwner, "!y[!gИнфо!y] !tВаша мина была уничтожена!!", MINE_COST)
        color_chat(hOwner, "!y[!gИнфо!y] !tВы получили !g%d$ !tза ликвидацию своей мины!", REWARD_MONEY_ME)
        cs_set_user_money ( hOwner, min ( cs_get_user_money ( hOwner ) + REWARD_MONEY_ME, 20000 ) )
        }
        else{
                new exploderName[32]
                get_user_name(killer,exploderName,charsmax(exploderName))
              
                color_chat(hOwner, "!y[!gИнфо!y] !t%s уничтожил вашу мину!", exploderName)
                
                color_chat(killer, "!y[!gИнфо!y] !tВы получили !g%d$ !tза уничтожение мины!", REWARD_MONEY)
                cs_set_user_money ( killer, min ( cs_get_user_money ( killer ) + REWARD_MONEY, 20000 ) )
        }
      
        return HAM_IGNORED
}
 
//
// Create beam for tripmine
//
TripMine_MakeBeam(ent){
        new beam = Beam_Create(entity_get_int(ent,EV_TM_team) == 1 ? BEAM_SPRITERED : BEAM_SPRITEBLUE,BEAM_WIDTH)
      
        new Float:m_vecDir[3],Float:vecSrc[3],Float:vecOrigin[3]
        entity_get_vector(ent,EV_TM_mVecDir,m_vecDir)
        entity_get_vector(ent,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(beam,vecSrc,vecOrigin)
        Beam_SetScrollRate(beam,255.0)
        Beam_SetBrightness(beam,BEAM_BRIGHT)
      
        entity_set_edict(ent,EV_TM_pBeam,beam)
        entity_set_vector(ent,EV_TM_mVecEnd,vecSrc)
        entity_set_edict(beam,EV_ENT_owner,ent)
      
        entity_set_int(beam,EV_TM_mineId,entity_get_int(ent,EV_TM_mineId))
      
        entity_set_float(beam,EV_FL_nextthink,get_gametime() + 0.1)
}
 
Send_BarTime(player,Float:duration){
        if(duration == 0.0){
                ExecuteHamB(Ham_CS_Player_ResetMaxSpeed,player)
        }
      
        message_begin(MSG_ONE,BarTime,.player = player)
        write_short(floatround(duration))
        message_end()
}
 
 
UTIL_Remove( pEntity )
{
        if ( !pEntity )
                return;
              
        entity_set_int(pEntity,EV_INT_flags,entity_get_int(pEntity,EV_INT_flags) | FL_KILLME)
        //entity_set_string(pEntity,EV_SZ_targetname,"")
}

stock color_chat(const id, const input[], any:...)
{
    new count = 1, players[32]
    static msg[191]
    vformat(msg, 190, input, 3)
    
    replace_all(msg, 190, "!g", "^4")
    replace_all(msg, 190, "!y", "^1")
    replace_all(msg, 190, "!t", "^3")
    
    if(id) players[0] = id; else get_players(players, count, "ch")
    {
        for(new i = 0; i < count; i++)
        {
            if(is_user_connected(players[i]))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
 
Сообщения
3,582
Реакции
1,570
Помог
137 раз(а)
DEVCS, очевидно, что индекс энтити выходит за пределы массива g_Laser_kill
 
Сообщения
38
Реакции
-1
Помог
1 раз(а)
sbelov020, ну он мне по идее не нужен, думаю удалю его. Ибо мне не зачем знать сколько киллов сделала мина.
 

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

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