Падение Ящиков

Сообщения
1,549
Реакции
1,554
Помог
2 раз(а)
Ошибка
Ящики падают друг на друга.
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5263
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.695-dev-mpatch
Build date: 14:51:37 Apr 6 2020 (2186)
Build from: https://github.com/dreamstalker/rehlds/commit/7513e71
ReGamedll
ReGameDLL version: 5.16.0.460-dev
Build date: 10:11:49 May 2 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/4f72525
Версия 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
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.0.92c ini Start Never
[ 2] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 3] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 4] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 5] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 6] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 7] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 8] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 9] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5263 ini Start ANY
[10] ReAPI RUN - reapi_amxx_i386.so v5.12.0.192-dev pl9 ANY Never
[11] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl9 ANY ANY
[12] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl9 ANY ANY
[13] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl9 ANY ANY
[14] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5263 pl9 ANY ANY
[15] CSX Extended RUN - csx_amxx_i386.so v1.5 pl9 ANY ANY
[16] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl9 ANY ANY
[17] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl9 ANY Never
[18] AuthEmu RUN - authemu_amxx_i386.so v4.2.12.311-dev+m pl9 ANY Never
[19] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl9 ANY ANY
19 plugins, 19 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] MultiMod Manager 2.2 JoRoPiTo multimod.amxx running
[ 2] Box WC 3.1 Alexander.3 box_wc.amxx running
2 plugins, 2 running
Автор плагина
Alexander.3
Версия плагина
3.1
Исходный код
#include < amxmodx >
#include < cstrike >
#include < engine >
#include < fakemeta >
#include < hamsandwich >

#define NAME "Box WC"
#define VERSION "3.1"
#define AUTHOR "Alexander.3"

new box_sound[] = "box_wc/zvyk_zamka.wav"

new Array:mCoord
new Array:szWeaponID
new Array:szWeaponName

new Array:szBoxModel
new Array:szDecModel

new PlayerCount, woodGibs
new SupplyCount
new g_MaxPlayer
new Float:zl_fcvar, zl_cvar[6]
new i_shockwave
new zl_sky_name[32]
new zl_hat_ct[64], zl_hat_t[64], zl_hat_ent[33]
new zl_v_c4[64], zl_w_c4[64]

new g_msgScreenFade, fadeon

public plugin_init() {
register_plugin(NAME, VERSION, AUTHOR)

register_touch("npc_supply", "player", "supply_touch")
register_think("m_timer", "m_coord")
register_think("npc_supply", "think_supply")
g_msgScreenFade = get_user_msgid("ScreenFade")
fadeon = register_cvar("amx_moneyfade","1")

if (zl_cvar[4] > 0)
register_logevent("RoundStart", 2, "1=Round_Start")

if (strlen(zl_hat_ct) > 3 || strlen(zl_hat_t) > 3) {
RegisterHam(Ham_Spawn, "player", "Hook_Spawn", 1)
RegisterHam(Ham_Killed, "player", "Hook_Killed", 1)
}
if(zl_cvar[5] > 0) {
RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "Hook_Models", 1)
RegisterHam(Ham_Think, "grenade", "Hook_ThinkGrenade", 0)
register_touch("grenade", "*", "Hook_Touch")
register_think("snow_splash", "think_splash")
register_message(get_user_msgid("SendAudio"), "message_audio")
}
if(strlen(zl_v_c4) > 3)
RegisterHam(Ham_Item_Deploy, "weapon_c4", "Hook_Models", 1)

register_forward(FM_SetModel,"Forward_ChangeModel", 1)
RegisterHam(Ham_Killed, "info_target", "Hook_Killed", 0)

g_MaxPlayer = get_maxplayers()

new T = create_entity("info_target")
set_pev(T, pev_classname, "m_timer")
set_pev(T, pev_nextthink, get_gametime() + 10.0)

register_dictionary("box_wc.txt")

if(strlen(zl_sky_name) > 3) {
set_cvar_string("sv_skyname", zl_sky_name)
}
}

public m_coord( t ) {
if ( PlayerCount <= 0) {
set_pev(t, pev_nextthink, get_gametime() + 10.0)
return
}

if (ArraySize(mCoord) > zl_cvar[1])
ArrayClear(mCoord)

static step
switch( step ) {
case 0..1: {
for(new i = 1; i <= g_MaxPlayer; ++i ) {
if (!is_user_alive(i))
continue

new Float:Origin[3]
pev(i, pev_origin, Origin)
ArrayPushArray(mCoord, Origin)
}
step++
}
case 2: {
if(ArraySize(mCoord) > 0) m_spawn()
step = 0
}
}
set_pev(t, pev_nextthink, get_gametime() + (zl_fcvar / 2.0))
}

public client_putinserver(id) {
if (!is_user_connected(id))
return

PlayerCount++
}

public client_disconnect(id) {
if (pev_valid(zl_hat_ent[id])) {
zl_remove_entity(zl_hat_ent[id])
zl_hat_ent[id] = 0
}
PlayerCount--
}

public m_spawn() {
if(SupplyCount >= zl_cvar[0])
return

new Float:Origin[3]
new ArrayIndex = random(ArraySize(mCoord))

ArrayGetArray(mCoord, ArrayIndex, Origin)

Origin[2] += 5.0

/* Not spawning in entity */
new tr
engfunc(EngFunc_TraceHull, Origin, Origin, 0, HULL_POINT, 0, tr)
if (get_tr2(tr, TR_StartSolid) || get_tr2(tr, TR_AllSolid))
return


new szName[64]

new ent = create_entity("info_target")
engfunc(EngFunc_SetOrigin, ent, Origin)

ArrayGetString(szBoxModel, random(ArraySize(szBoxModel)), szName, 63)
set_pev(ent, pev_nextthink, get_gametime() + 3.0)
set_pev(ent, pev_classname, "npc_supply")

engfunc(EngFunc_SetModel, ent, szName)
engfunc(EngFunc_SetSize, ent, {-10.0, -10.0, -1.0}, {10.0, 10.0, 20.0})

set_pev(ent, pev_movetype, MOVETYPE_TOSS)
set_pev(ent, pev_solid, SOLID_TRIGGER)
ArrayDeleteItem(mCoord, ArrayIndex)
SupplyCount++

}

public supply_touch(s, p) {
if(!pev_valid(s) || !is_user_alive(p))
return

if(ArraySize(szWeaponID) == 0) {
} else {
switch(random(1)) {
case 0: {
new i, id[20], name[256]
i = random(ArraySize(szWeaponID))
ArrayGetString(szWeaponID, i, id, 14)
ArrayGetString(szWeaponName, i, name, 14)
if(get_pcvar_num(fadeon))
screen_fade(p)
format(id, charsmax(id), "weapon_%s", id)

new iWeaponId = get_weaponid(id);

if (user_has_weapon(p, iWeaponId))
cs_set_user_bpammo(p, iWeaponId, cs_get_user_bpammo(p, iWeaponId) + 1)
else
ham_give_item(p, id)
client_cmd(p,"spk %s",box_sound)
zl_colorchat(p, "!n%L", LANG_PLAYER, "SUPPLY_WEAPON", name)
client_print(p, print_center, "Вы забрали из Сундука %s", name)
}
}
}
zl_remove_entity(s)
SupplyCount--
}

public screen_fade(id) {
message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id)
write_short(1<<12)
write_short(1<<12)
write_short(1<<12)
write_byte(0)
write_byte(0)
write_byte(255)
write_byte(20)
message_end()
}

public m_reward(index, num) {
if (!is_user_alive(index) || pev_valid(index) != 2)
return 0

set_pdata_int(index, 115, get_pdata_int(index, 115) + num)

message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("Money"), _, index)
write_long(get_pdata_int(index, 115))
write_byte(1)
message_end()

return 1
}

public Hook_ThinkGrenade( ent ) {
static Float:dmgtime
pev(ent, pev_dmgtime, dmgtime)


if (dmgtime > get_gametime())
return HAM_IGNORED

static mdl[64]
pev(ent, pev_model, mdl, charsmax(mdl))

if (mdl[0] == 'm' && mdl[20] == 's')
return HAM_SUPERCEDE

return HAM_IGNORED
}


public Hook_Spawn( player ) {
if (!is_user_alive( player ) || pev_valid(player) != 2)
return HAM_IGNORED

if (get_pdata_int(player, 114, 5) == 2 && strlen(zl_hat_ct) > 3)
zl_hat_create(player, 2)

if (get_pdata_int(player, 114, 5) == 1 && strlen(zl_hat_t) > 3)
zl_hat_create(player, 1)

return HAM_IGNORED
}

public Hook_Killed(victim, attacker, corpse) {
if (pev_valid(victim) && victim > 32) {
static szName[32]
pev(victim, pev_classname, szName, charsmax(szName))
if(szName[0] == 'n' && szName[4] == 'd') {
new Float:origin[3]
pev(victim, pev_origin, origin)
engfunc(EngFunc_MessageBegin, MSG_PAS,SVC_TEMPENTITY, origin, 0)
write_byte(TE_BREAKMODEL);
engfunc(EngFunc_WriteCoord, origin[0]) // x
engfunc(EngFunc_WriteCoord, origin[1]) // y
engfunc(EngFunc_WriteCoord, origin[2] + 24.0) // z
write_coord(16) // size x
write_coord(16) // size y
write_coord(16) // size z
write_coord(random_num(-50,50)); // velocity x
write_coord(random_num(-50,50)); // velocity y
write_coord(25) // velocity z
write_byte(10); // random velocity
write_short(woodGibs); // model
write_byte(10); // count
write_byte(25); // life
write_byte(0x03); // flags
message_end();
SupplyCount--
return HAM_IGNORED
}
}

if (pev_valid(zl_hat_ent[victim])) {
zl_remove_entity(zl_hat_ent[victim])
zl_hat_ent[victim] = 0
}

return HAM_IGNORED
}

stock zl_hat_create(player, type) {
new ent = zl_hat_ent[player]
if(!pev_valid(ent)) {
zl_hat_ent[player] = ent = create_entity("info_target")
set_pev(ent, pev_movetype, MOVETYPE_FOLLOW)
set_pev(ent, pev_aiment, player)
engfunc(EngFunc_SetModel, ent, (type == 1) ? zl_hat_t : zl_hat_ct)
}
}

public plugin_precache() {
precache_sound("box_wc/zvyk_zamka.wav")
mCoord = ArrayCreate(3, 1)
szWeaponID = ArrayCreate(15)
szWeaponName = ArrayCreate(15)
szBoxModel = ArrayCreate(64)
szDecModel = ArrayCreate(64)

config_load()

new i, szName[64]
for(i = 0; i < ArraySize(szBoxModel); ++i) {
ArrayGetString(szBoxModel, i, szName, 63)
precache_model(szName)
}

for(i = 0; i < ArraySize(szDecModel); ++i) {
ArrayGetString(szDecModel, i, szName, 63)
precache_model(szName)
}

if (zl_cvar[5] > 0) {
precache_model("sprites/bhit.spr")
}
i_shockwave = precache_model("sprites/shockwave.spr")

if (zl_cvar[3] > 0)
engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_snow"))

if (strlen(zl_sky_name) > 3) {
new linedata[64]
formatex(linedata, charsmax(linedata), "gfx/env/%sbk.tga", zl_sky_name)
engfunc(EngFunc_PrecacheGeneric, linedata)
formatex(linedata, charsmax(linedata), "gfx/env/%sdn.tga", zl_sky_name)
engfunc(EngFunc_PrecacheGeneric, linedata)
formatex(linedata, charsmax(linedata), "gfx/env/%sft.tga", zl_sky_name)
engfunc(EngFunc_PrecacheGeneric, linedata)
formatex(linedata, charsmax(linedata), "gfx/env/%slf.tga", zl_sky_name)
engfunc(EngFunc_PrecacheGeneric, linedata)
formatex(linedata, charsmax(linedata), "gfx/env/%srt.tga", zl_sky_name)
engfunc(EngFunc_PrecacheGeneric, linedata)
formatex(linedata, charsmax(linedata), "gfx/env/%sup.tga", zl_sky_name)
engfunc(EngFunc_PrecacheGeneric, linedata)
}

if (strlen(zl_hat_ct) > 3)
precache_model(zl_hat_ct)

if (strlen(zl_hat_t) > 3)
precache_model(zl_hat_t)

if (strlen(zl_v_c4) > 3)
precache_model(zl_v_c4)

if (strlen(zl_w_c4) > 3)
precache_model(zl_w_c4)
}

config_load() {
static path[64]
get_localinfo("amxx_configsdir", path, charsmax(path))
format(path, charsmax(path), "%s/box_wc.ini", path)

if (!file_exists(path)) {
new error[100]
formatex(error, charsmax(error), "Cannot load customization file %s!", path)
set_fail_state(error)
return
}

static linedata[1024], key[64], value[960], section
new file = fopen(path, "rt")

while (file && !feof(file)) {
fgets(file, linedata, charsmax(linedata))
replace(linedata, charsmax(linedata), "^n", "")

trim(linedata)

if (!linedata[0] || linedata[0] == '/') continue;
if (linedata[0] == '[') { section++; continue; }

strtok(linedata, key, charsmax(key), value, charsmax(value), '=')
trim(key)
trim(value)

switch(section) {
case 1: { // Setting
if (equal(key, "S_MAX_BOX"))
zl_cvar[0] = str_to_num(value)
else if (equal(key, "S_MAX_COORD"))
zl_cvar[1] = str_to_num(value)
else if (equal(key, "S_TIME_CREATE"))
zl_fcvar = str_to_float(value)
else if (equal(key, "S_REWARD"))
zl_cvar[2] = str_to_num(value)
else if (equal(key, "S_SNOW"))
zl_cvar[3] = str_to_num(value)
else if (equal(key, "S_MSG"))
zl_cvar[4] = str_to_num(value)
else if (equal(key, "S_SKY"))
parse(value, zl_sky_name, charsmax(zl_sky_name))
else if (equal(key, "S_HAT_CT"))
parse(value, zl_hat_ct, charsmax(zl_hat_ct))
else if (equal(key, "S_HAT_T"))
parse(value, zl_hat_t, charsmax(zl_hat_t))
else if (equal(key, "S_SNOWBALL"))
zl_cvar[5] = str_to_num(value)
else if (equal(key, "S_V_C4"))
parse(value, zl_v_c4, charsmax(zl_v_c4))
else if (equal(key, "S_W_C4"))
parse(value, zl_w_c4, charsmax(zl_w_c4))

}
case 2: { // BoxModel
if (strlen(linedata) < 5) {
log_amx("[ERROR] Please setup box model in box_wc.ini")
pause("ad")
return
}
ArrayPushString(szBoxModel, linedata)
}
case 3: { // Weapon
if (!zl_weapon_check(key))
continue

ArrayPushString(szWeaponID, key)
ArrayPushString(szWeaponName, value)
}
}
}
if (file) fclose(file)
}

public think_supply(ent) {
if(!pev_valid(ent))
return

new Float:o[3]
pev(ent, pev_origin, o)

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, o, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, o[0]) // x
engfunc(EngFunc_WriteCoord, o[1]) // y
engfunc(EngFunc_WriteCoord, o[2] + 1.0) // z
engfunc(EngFunc_WriteCoord, o[0] + 500.0) // x axis
engfunc(EngFunc_WriteCoord, o[1] + 500.0) // y axis
engfunc(EngFunc_WriteCoord, o[2] + 50.0) // z axis
write_short(i_shockwave) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life (4)
write_byte(5) // width (20)
write_byte(0) // noise
write_byte(139) // red
write_byte(69) // green
write_byte(19) // blue
write_byte(255) // brightness
write_byte(0) // speed
message_end()

set_pev(ent, pev_nextthink, get_gametime() + 3.0)
}

public message_audio() {
static sample[20]

get_msg_arg_string(2, sample, charsmax(sample))

if(equal(sample[1], "!MRAD_FIREINHOLE"))
return PLUGIN_HANDLED

return PLUGIN_CONTINUE
}

stock ham_give_item(id, weapon[])
{
static ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, weapon))
if (!pev_valid(ent)) return;

new ItemSlot = ExecuteHamB(Ham_Item_ItemSlot, ent)

new iItem, szWeaponName[32]
iItem = get_pdata_cbase(id, 367 + ItemSlot, 5);

if (iItem > 0 && pev_valid(iItem) == 2) {
pev(iItem, pev_classname, szWeaponName, charsmax(szWeaponName))
engclient_cmd(id, "drop", szWeaponName)

}

ExecuteHamB(Ham_Item_AttachToPlayer, ent, id )

engclient_cmd(id, weapon)

static Float:originF[3]
pev(id, pev_origin, originF)
set_pev(ent, pev_origin, originF)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)

static save
save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, id)
if (pev(ent, pev_solid) != save)
return;

engfunc(EngFunc_RemoveEntity, ent)
}

stock zl_weapon_check(const weapon_name[]) {
static const WeaponName[][] = {
"shield",
"p228",
"scout",
"hegrenade",
"xm1014",
"mac10",
"aug",
"smokegrenade",
"elite",
"fiveseven",
"ump45",
"sg550",
"galil",
"famas",
"usp",
"glock18",
"awp",
"mp5navy",
"m249",
"m3",
"m4a1",
"tmp",
"g3sg1",
"flashbang",
"deagle",
"sg552",
"ak47",
"knife",
"p90"
}
new i
for(i = 0; i < sizeof WeaponName; ++i) {
if(equal(weapon_name, WeaponName[i]))
return 1
}
return 0
}

stock zl_colorchat( iPlayer, szMessage[ ], any:... ) {
static szBuffer[512]
vformat(szBuffer, charsmax( szBuffer ), szMessage, 3 );

replace_all(szBuffer, charsmax(szBuffer), "!t", "^3")
replace_all(szBuffer, charsmax(szBuffer), "!n", "^1")
replace_all(szBuffer, charsmax(szBuffer), "!g", "^4")

if( iPlayer ) {
message_begin( MSG_ONE, 76, _, iPlayer );
write_byte( iPlayer );
write_string( szBuffer );
message_end( );
} else {
for( new iPlayers = 33; iPlayers > 0; iPlayers-- ) {
if( !is_user_connected( iPlayers ) )
continue;

message_begin( MSG_ONE, 76, _, iPlayers );
write_byte( iPlayers );
write_string( szBuffer );
message_end( );
}
}
}

stock zl_screenshake(id, ampl, timer) {
if(id) if(!is_user_alive(id)) return

if (ampl > 15)
ampl = 15

message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, get_user_msgid("ScreenShake"), _, id ? id : 0);
write_short(ampl << 12)
write_short(timer << 12)
write_short(7 << 12)
message_end()
}

stock zl_remove_entity(e) {
if(!pev_valid(e))
return 0

set_pev(e, pev_flags, pev(e, pev_flags ) | FL_KILLME)
return 1
}

stock zl_screenfade(id, Timer = 1, FadeTime = 1, Colors[3] = {0, 0, 0}, Alpha = 0, type = 1) {
if(id) if(!is_user_connected(id)) return

if (Timer > 0xFFFF) Timer = 0xFFFF
if (FadeTime <= 0) FadeTime = 4

message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, get_user_msgid("ScreenFade"), _, id);
write_short(Timer * 1 << 12)
write_short(FadeTime * 1 << 12)
switch (type) {
case 1: write_short(0x0000) // IN ( FFADE_IN )
case 2: write_short(0x0001) // OUT ( FFADE_OUT )
case 3: write_short(0x0002) // MODULATE ( FFADE_MODULATE )
case 4: write_short(0x0004) // STAYOUT ( FFADE_STAYOUT )
default: write_short(0x0001)
}
write_byte(Colors[0])
write_byte(Colors[1])
write_byte(Colors[2])
write_byte(Alpha)
message_end()
}
Нужна помощь,что-бы ящики не падали друг на друга.
Знаю,что в не которых версиях это исправили.
Долго обьяснять но мне нужно сюда поставить.
Спасибо за любую помощь.

Может как-то поставить проверку,что-бы пока не забрал текущий ящик,на его место не падал новый?

По совету Leonidddd'а - сказал заменить это
Код:
    Origin[2] += 5.0
 
    /* Not spawning in entity */
    new tr
    engfunc(EngFunc_TraceHull, Origin, Origin, 0, HULL_POINT, 0, tr)
    if (get_tr2(tr, TR_StartSolid) || get_tr2(tr, TR_AllSolid))
        return
Вот этим
Код:
        new tr;
        engfunc(EngFunc_TraceHull, Origin, Origin, 0, HULL_HUMAN, 0, tr);
 
    if (get_tr2(tr, TR_StartSolid) || get_tr2(tr, TR_AllSolid) || !get_tr2(tr, TR_InOpen))
        return;
Но не сработало.Нужны ещё варианты

P.S.
Вдруг что,то вот при таком розкладе я понимаю,что уже розвязка где-то близко...
Ящик падает только в то место где стоит сейчас игрок,и при взятии сразу оружия,через секунду опять даёться оружие,тоесть падает ящик...
Осталось подправить,что-бы на землю падал,а не на игрока...
Код:
        static tr

        engfunc(EngFunc_TraceHull, Origin, Origin, 0, hull, id, tr)

        if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
            return;
 
Последнее редактирование модератором:

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

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