Участник
Пользователь
- Сообщения
- 78
- Реакции
- 7
- Ошибка
-
Не срабатывает физика выкидывания оружия.
- ОС
- Windows
- Amx Mod X
-
AMX Mod X 1.9.0.5294
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.13.0.788-dev
Build date: 07:37:36 Jul 12 2023 (3378)
- ReGamedll
-
ReGameDLL version: 5.22.0.593-dev
Build date: 03:10:24 Jul 11 2023
- Версия Metamod
-
Metamod-r v1.3.0.131, API (5:13)
Metamod-r build: 18:51:28 Jul 11 2022
- Список метамодулей
-
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm.dll v0.1.0.137 ini Start Never
[ 2] AMX Mod X RUN - amxmodx_mm.dll v1.9.0.5294 ini Start ANY
[ 3] ReAuthCheck RUN - reauthcheck_mm.dll v0.1.6 ini Start Never
[ 4] Revoice RUN - revoice_plus_mm.dll v2.0.5 ini ANY Never
[ 5] Rechecker RUN - rechecker_mm.dll v2.7 ini Chlvl ANY
[ 6] HitBox Fix RUN - hitbox_fix_mm.dll v1.1.2 ini Start ANY
[ 7] ReAimDetector RUN - reaimdetector_amxx.dll v0.2.2 pl2 ANY Never
[ 8] ReInfoZone RUN - reinfozone_amxx.dll v0.8 pl2 ANY ANY
[ 9] Ham Sandwich RUN - hamsandwich_amxx.dll v1.9.0.5294 pl2 ANY ANY
[10] CSX RUN - csx_amxx.dll v1.9.0.5294 pl2 ANY ANY
10 plugins, 10 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.9.0.5294 AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.9.0.5294 AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.9.0.5294 AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.9.0.5294 AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.9.0.5294 AMXX Dev Team multilingual.am running
[ 6] Menus Front-End 1.9.0.5294 AMXX Dev Team menufront.amxx running
[ 7] Commands Menu 1.9.0.5294 AMXX Dev Team cmdmenu.amxx running
[ 8] Players Menu 1.9.0.5294 AMXX Dev Team plmenu.amxx running
[ 9] Maps Menu 1.9.0.5294 AMXX Dev Team mapsmenu.amxx running
[ 10] Plugin Menu 1.9.0.5294 AMXX Dev Team pluginmenu.amxx running
[ 11] Admin Chat 1.9.0.5294 AMXX Dev Team adminchat.amxx running
[ 12] Anti Flood 1.9.0.5294 AMXX Dev Team antiflood.amxx running
[ 13] Scrolling Message 1.9.0.5294 AMXX Dev Team scrollmsg.amxx running
[ 14] Info. Messages 1.9.0.5294 AMXX Dev Team imessage.amxx running
[ 15] Admin Votes 1.9.0.5294 AMXX Dev Team adminvote.amxx running
[ 16] NextMap 1.9.0.5294 AMXX Dev Team nextmap.amxx running
[ 17] Nextmap Chooser 1.9.0.5294 AMXX Dev Team mapchooser.amxx running
[ 18] TimeLeft 1.9.0.5294 AMXX Dev Team timeleft.amxx running
[ 19] Pause Plugins 1.9.0.5294 AMXX Dev Team pausecfg.amxx running
[ 20] Stats Configuration 1.9.0.5294 AMXX Dev Team statscfg.amxx running
[ 21] StatsX 1.9.0.5294 AMXX Dev Team statsx.amxx running
[ 22] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
22 plugins, 22 running
- Автор плагина
- Numb
- Версия плагина
- 2.3
- Исходный код
-
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#define PLUGIN_NAME "Real Weapon Drop"
#define PLUGIN_VERSION "2.3"
#define PLUGIN_AUTHOR "Numb"
#define AMMO_MODEL "models/w_357ammobox.mdl"
#define AMMO_SOUND "items/9mmclip2.wav"
#define SetPlayerBit(%1,%2) ( %1 |= ( 1 << ( %2 & 31 ) ) )
#define ClearPlayerBit(%1,%2) ( %1 &= ~( 1 << ( %2 & 31 ) ) )
#define CheckPlayerBit(%1,%2) ( %1 & ( 1 << ( %2 & 31 ) ) )
// "weapon_" entity
#define m_flStartThrow 30
#define m_pPlayer 41
#define m_iId 43
#define m_flTimeWeaponIdle 48
// "player" entity
#define m_bIsVIP 209
#define m_pActiveItem 373
#define m_rgAmmo_player 376
#define FLAG_VIP (1<<8)
// "weaponbox" entity
#define m_rgpPlayerItems 34
#define m_rgiszAmmo 41
#define m_rgAmmo 73
#define AMMO_FLASHBANG 11
#define AMMO_HEGRENADE 12
#define AMMO_SMOKENADE 13
new g_iBulletsDropped[33][15];
new g_iMaxPlayers;
new g_iConnected;
new g_iAlive;
new g_iMsgId_AmmoPickup;
new g_iMsgId_WeapPickup;
new g_iCvar_AimDrop;
new g_iCvar_GrenadeDrop;
new g_iCvar_DeathDrop;
new g_iCvar_DisconnectDrop;
new g_iCvar_ModelAngleFix;
new g_bInAutoDrop;
new HamHook:g_iHamHook_Think;
new g_iHamHook_Active;
new g_iDeathDrops[33][29];
new g_iDeathDropsNum[33];
new Float:g_fPlayerAngle[33];
new bool:g_bVipDrop;
new bool:g_bChangingMap;
new g_iAmmoNames[15][] = {
"",
"338Magnum", // awp
"762Nato", // ak47 scout g3sg1
"556NatoBox", // m249
"556Nato", // aug m4a1 sgg550 sgg552 galil famas
"buckshot", // m3 xm1014
"45ACP", // mac10 usp ump45
"57mm", // p90 fiveseven
"50AE", // deagle
"357SIG", // p228
"9mm", // glock elites mp5navy tmp
"Flashbang",
"HEGrenade",
"SmokeGrenade",
"C4"
};
new g_iAmmoEntityNames[15][] = {
"",
"ammo_338magnum", // awp
"ammo_762nato", // ak47 scout g3sg1
"ammo_556natobox", // m249
"ammo_556nato", // aug m4a1 sgg550 sgg552 galil famas
"ammo_buckshot", // m3 xm1014
"ammo_45acp", // mac10 usp ump45
"ammo_57mm", // p90 fiveseven
"ammo_50ae", // deagle
"ammo_357sig", // p228
"ammo_9mm", // glock elites mp5navy tmp
"weapon_flashbang",
"weapon_hegrenade",
"weapon_smokegenade",
"weapon_c4"
};
new g_iMaxAmmo[15] = {
0,
30,
90,
200,
90,
32,
100,
100,
35,
52,
120,
2,
1,
1,
1
};
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_event("30", "Event_MapChangeScoreboard", "a");
register_forward(FM_ClientDisconnect, "FM_ClientDisconnect_Pre", 0);
register_forward(FM_SetModel, "FM_SetModel_Pre", 0);
RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Player_Post", 1);
RegisterHam(Ham_Killed, "player", "Ham_Killed_player_Pre", 0);
RegisterHam(Ham_Killed, "player", "Ham_Killed_player_Post", 1);
RegisterHam(Ham_CS_Item_CanDrop, "weapon_hegrenade", "Ham_Item_CanDrop_Pre", 0);
RegisterHam(Ham_CS_Item_CanDrop, "weapon_flashbang", "Ham_Item_CanDrop_Pre", 0);
RegisterHam(Ham_CS_Item_CanDrop, "weapon_smokegrenade", "Ham_Item_CanDrop_Pre", 0);
RegisterHam(Ham_CS_Item_CanDrop, "weapon_knife", "Ham_Item_CanDrop_Pre", 0);
RegisterHam(Ham_Touch, "weaponbox", "Ham_Touch_wpnbox_Pre", 0);
RegisterHam(Ham_Touch, "func_vip_safetyzone", "Ham_Touch_safezone_Pre", 0);
g_iHamHook_Think = RegisterHam(Ham_Think, "player", "Ham_Think_player_Pre", 0);
DisableHamForward(g_iHamHook_Think);
g_iCvar_AimDrop = register_cvar("rwd_aimdrop", "1");
g_iCvar_GrenadeDrop = register_cvar("rwd_grenadedrop", "1");
g_iCvar_DeathDrop = register_cvar("rwd_deathdrop", "1");
g_iCvar_DisconnectDrop = register_cvar("rwd_disconnectdrop", "1");
g_iCvar_ModelAngleFix = register_cvar("rwd_modelanglefix", "1");
g_iMaxPlayers = clamp(get_maxplayers(), 1, 32);
g_iMsgId_AmmoPickup = get_user_msgid("AmmoPickup");
g_iMsgId_WeapPickup = get_user_msgid("WeapPickup");
}
public plugin_precache()
{
precache_model(AMMO_MODEL);
precache_sound(AMMO_SOUND);
}
public client_connect(iPlrId)
{
ClearPlayerBit(g_iAlive, iPlrId);
ClearPlayerBit(g_iConnected, iPlrId);
}
public client_putinserver(iPlrId)
SetPlayerBit(g_iConnected, iPlrId);
public Event_MapChangeScoreboard()
g_bChangingMap = true;
public Message_AmmoPickup(iMsgId, iMsgType, iPlrId) // modify given ammo on hud when needed
{
static s_iAmmoNum;
s_iAmmoNum = g_iBulletsDropped[iPlrId][get_msg_arg_int(1)];
if( s_iAmmoNum )
set_msg_arg_int(2, ARG_BYTE, s_iAmmoNum);
}
public Message_Block(iMsgId, iMsgType, iPlrId) // block ammo and weaponpickup hud update when needed
return PLUGIN_HANDLED;
public FM_ClientDisconnect_Pre(iPlrId)
{
ClearPlayerBit(g_iConnected, iPlrId);
ClearPlayerBit(g_iAlive, iPlrId);
ClearPlayerBit(g_iHamHook_Active, iPlrId);
if( get_pcvar_num(g_iCvar_DisconnectDrop) )
{
static s_iVip;
s_iVip = get_pdata_int(iPlrId, m_bIsVIP, 5);
set_pdata_int(iPlrId, m_bIsVIP, (s_iVip&~FLAG_VIP), 5);
force_weapon_drop(iPlrId, 0, 0);
set_pdata_int(iPlrId, m_bIsVIP, s_iVip, 5);
}
}
public FM_SetModel_Pre(iEnt, iModel[])
{
if( !equal(iModel, "models/w_", 9) )
return FMRES_IGNORED;
if( equal(iModel[9], "weaponbox.mdl") ) // this weaponbox isn't yet ready to be worked with
return FMRES_IGNORED;
static s_iClassName[11];
pev(iEnt, pev_classname, s_iClassName, 10);
if( equal(s_iClassName, "weaponbox") ) // is this a weaponbox with what we can work
{
static s_iOwner, Float:s_fVelocity[3], s_bAlive, Float:s_fAngle[3];
s_iOwner = pev(iEnt, pev_owner);
if( 0<s_iOwner<=g_iMaxPlayers )
s_bAlive = (CheckPlayerBit(g_iAlive, s_iOwner)?true:false);
else
s_bAlive = false;
if( s_bAlive && !g_bVipDrop ) // alive user dropped weapons
{
if( get_pcvar_num(g_iCvar_AimDrop) ) // should we change drop direction via player by aim
{
static Float:s_fOrigin[3], Float:s_fResult[3];
pev(s_iOwner, pev_origin, s_fOrigin);
pev(s_iOwner, pev_v_angle, s_fAngle);
SphereToCartesian(s_fResult, s_fOrigin, s_fAngle, Float:{0.0, 0.0, 200.0}); // some extraterrestrial math by eDark
pev(s_iOwner, pev_velocity, s_fVelocity);
s_fVelocity[0] += (s_fResult[0]-s_fOrigin[0]);
s_fVelocity[1] += (s_fResult[1]-s_fOrigin[1]);
s_fVelocity[2] -= (s_fResult[2]-s_fOrigin[2]);
set_pev(iEnt, pev_velocity, s_fVelocity);
}
}
else if( is_player_connected(s_iOwner) ) // weapon is dropped due to death
{
if( get_pcvar_num(g_iCvar_DeathDrop) )
{
if( CheckPlayerBit(g_iHamHook_Active, s_iOwner) && 0<=g_iDeathDropsNum[s_iOwner] && g_iDeathDropsNum[s_iOwner]<29 )
{
g_iDeathDrops[s_iOwner][g_iDeathDropsNum[s_iOwner]] = iEnt; // sometimes not all the weapons have speed set right,
g_iDeathDropsNum[s_iOwner]++; // therefor we'll set their speed to again, when we'll be sure it's right
s_fVelocity = Float:{0.0, 0.0, 0.0};
}
else
pev(s_iOwner, pev_velocity, s_fVelocity);
s_fVelocity[0] += random_float(-10.0, 10.0);
s_fVelocity[1] += random_float(-10.0, 10.0);
s_fVelocity[2] += random_float(-5.0, 5.0);
set_pev(iEnt, pev_velocity, s_fVelocity);
}
}
else if( get_pcvar_num(g_iCvar_DisconnectDrop) ) // weapon is dropped due to disconnect
{
s_fVelocity = Float:{0.0, 0.0, 0.0};
s_fVelocity[0] = random_float(-10.0, 10.0);
s_fVelocity[1] = random_float(-10.0, 10.0);
s_fVelocity[2] = random_float(-5.0, 5.0);
set_pev(iEnt, pev_velocity, s_fVelocity);
}
if( 0<s_iOwner<=g_iMaxPlayers ) // should we work a bit more with the weaponbox
{
if( !s_bAlive )
{
pev(iEnt, pev_angles, s_fAngle);
s_fAngle[1] = g_fPlayerAngle[s_iOwner];
set_pev(iEnt, pev_angles, s_fAngle);
}
if( equal(iModel[9], "flashbang.mdl") ) // this weaponbox includes information about flash grenade
{
set_pdata_int(iEnt, (m_rgiszAmmo+AMMO_FLASHBANG), engfunc(EngFunc_AllocString, g_iAmmoNames[AMMO_FLASHBANG]), 4);
if( s_bAlive )
{
set_pdata_int(iEnt, (m_rgAmmo+AMMO_FLASHBANG), 1, 4); // not working (glitch with grenades)
if( g_iBulletsDropped[s_iOwner][AMMO_FLASHBANG]>0 )
{
static s_iFwdMsg_AmmoPickup, s_iFwdMsg_WeapPickup;
s_iFwdMsg_AmmoPickup = register_message(g_iMsgId_AmmoPickup, "Message_Block");
s_iFwdMsg_WeapPickup = register_message(g_iMsgId_WeapPickup, "Message_Block");
ham_give_item(s_iOwner, "weapon_flashbang");
set_pdata_int(s_iOwner, (m_rgAmmo_player+AMMO_FLASHBANG), g_iBulletsDropped[s_iOwner][AMMO_FLASHBANG], 5);
engclient_cmd(s_iOwner, "weapon_flashbang");
unregister_message(g_iMsgId_AmmoPickup, s_iFwdMsg_AmmoPickup);
unregister_message(g_iMsgId_WeapPickup, s_iFwdMsg_WeapPickup);
}
}
else
set_pdata_int(iEnt, (m_rgAmmo+AMMO_FLASHBANG), g_iBulletsDropped[s_iOwner][AMMO_FLASHBANG], 4); // not working (glitch with grenades)
message_begin(MSG_ALL, SVC_TEMPENTITY, _, _); // yep, lets include support for grenade trail plugin
write_byte(TE_KILLBEAM);
write_short(iEnt);
message_end();
}
else if( equal(iModel[9], "hegrenade.mdl") ) // this weaponbox includes information about he grenade
{
message_begin(MSG_ALL, SVC_TEMPENTITY, _, _); // yep, lets include support for grenade trail plugin
write_byte(TE_KILLBEAM);
write_short(iEnt);
message_end();
pev(iEnt, pev_angles, s_fAngle);
s_fAngle[1] += 90.0;
set_pev(iEnt, pev_angles, s_fAngle);
}
else if( equal(iModel[9], "smokegrenade.mdl") ) // this weaponbox includes information about smoke grenade
{
message_begin(MSG_ALL, SVC_TEMPENTITY, _, _); // yep, lets include support for grenade trail plugin
write_byte(TE_KILLBEAM);
write_short(iEnt);
message_end();
pev(iEnt, pev_angles, s_fAngle);
s_fAngle[1] += 45.0;
set_pev(iEnt, pev_angles, s_fAngle);
}
else if( equal(iModel[9], "knife.mdl") ) // dropped knife - lets set bullets info into it
{
pev(iEnt, pev_angles, s_fAngle);
s_fAngle[1] += 180.0;
set_pev(iEnt, pev_angles, s_fAngle);
static s_iLoop;
for( s_iLoop=1; s_iLoop<11; s_iLoop++ )
{
set_pdata_int(iEnt, (m_rgiszAmmo+s_iLoop), engfunc(EngFunc_AllocString, g_iAmmoNames[s_iLoop]), 4);
set_pdata_int(iEnt, (m_rgAmmo+s_iLoop), g_iBulletsDropped[s_iOwner][s_iLoop], 4);
}
engfunc(EngFunc_SetModel, iEnt, AMMO_MODEL); // and change model to custom one of course
return FMRES_SUPERCEDE;
}
else if( get_pcvar_num(g_iCvar_ModelAngleFix) ) // lets fix angle of the weaponbox model
{
pev(iEnt, pev_angles, s_fAngle);
if( equal(iModel[9], "glock18.mdl") )
s_fAngle[1] -= 110.0;
else if( equal(iModel[9], "usp.mdl") )
s_fAngle[1] -= 65.0;
else if( equal(iModel[9], "deagle.mdl") )
s_fAngle[1] -= 110.0;
else if( equal(iModel[9], "p228.mdl") )
s_fAngle[1] -= 60.0;
else if( equal(iModel[9], "elite.mdl") )
s_fAngle[1] -= 180.0;
else if( equal(iModel[9], "fiveseven.mdl") )
s_fAngle[1] -= 50.0;
else if( equal(iModel[9], "m3.mdl") )
s_fAngle[1] -= 125.0;
else if( equal(iModel[9], "xm1014.mdl") )
s_fAngle[1] -= 5.0;
else if( equal(iModel[9], "mp5.mdl") )
s_fAngle[1] += 10.0;
else if( equal(iModel[9], "tmp.mdl") ) // mac10 has a perfect angle - no need to fix
s_fAngle[1] -= 135.0;
else if( equal(iModel[9], "p90.mdl") )
s_fAngle[1] -= 125.0;
else if( equal(iModel[9], "ump45.mdl") )
s_fAngle[1] -= 70.0;
else if( equal(iModel[9], "galil.mdl") )
s_fAngle[1] += 15.0;
else if( equal(iModel[9], "famas.mdl") )
s_fAngle[1] -= 30.0;
else if( equal(iModel[9], "ak47.mdl") )
s_fAngle[1] -= 105.0;
else if( equal(iModel[9], "m4a1.mdl") )
s_fAngle[1] -= 60.0;
else if( equal(iModel[9], "sg552.mdl") )
s_fAngle[1] -= 130.0;
else if( equal(iModel[9], "aug.mdl") )
s_fAngle[1] -= 125.0;
else if( equal(iModel[9], "scout.mdl") )
s_fAngle[1] -= 70.0;
else if( equal(iModel[9], "awp.mdl") )
s_fAngle[1] -= 110.0;
else if( equal(iModel[9], "g3sg1.mdl") )
s_fAngle[1] -= 110.0;
else if( equal(iModel[9], "sg550.mdl") )
s_fAngle[1] -= 115.0;
else if( equal(iModel[9], "m249.mdl") )
s_fAngle[1] -= 95.0;
set_pev(iEnt, pev_angles, s_fAngle);
}
}
}
return FMRES_IGNORED;
}
public Ham_Spawn_Player_Post(iPlrId)
{
if( is_user_alive(iPlrId) )
SetPlayerBit(g_iAlive, iPlrId);
else
ClearPlayerBit(g_iAlive, iPlrId);
}
public Ham_Killed_player_Pre(iPlrId, iAttackerId, iShouldGib)
{
g_iDeathDropsNum[iPlrId] = 0;
if( !g_iHamHook_Active )
EnableHamForward(g_iHamHook_Think);
SetPlayerBit(g_iHamHook_Active, iPlrId);
if( get_pcvar_num(g_iCvar_DeathDrop) )
{
static s_iArmedGrenade, s_iWeaponType;
s_iArmedGrenade = get_pdata_cbase(iPlrId, m_pActiveItem, 5);
if( s_iArmedGrenade>0 && pev_valid(s_iArmedGrenade) )
{
s_iWeaponType = get_pdata_int(s_iArmedGrenade, m_iId, 4);
if( s_iWeaponType==CSW_FLASHBANG || s_iWeaponType==CSW_HEGRENADE || s_iWeaponType==CSW_SMOKEGRENADE )
{
if( get_pdata_float(s_iArmedGrenade, m_flStartThrow, 3) && get_pdata_float(s_iArmedGrenade, m_flTimeWeaponIdle, 4)<=0.0 )
s_iArmedGrenade = s_iWeaponType; // a grenade is ready to explode - save information what grenade it is
else
s_iArmedGrenade = 0;
}
else
s_iArmedGrenade = 0;
}
else
{
s_iWeaponType = 0;
s_iArmedGrenade = 0;
}
static s_iVip;
s_iVip = get_pdata_int(iPlrId, m_bIsVIP, 5);
set_pdata_int(iPlrId, m_bIsVIP, (s_iVip&~FLAG_VIP), 5);
force_weapon_drop(iPlrId, s_iArmedGrenade, s_iWeaponType);
set_pdata_int(iPlrId, m_bIsVIP, s_iVip, 5);
}
}
public Ham_Killed_player_Post(iPlrId, iAttackerId, iShouldGib)
{
if( is_user_alive(iPlrId) )
SetPlayerBit(g_iAlive, iPlrId);
else
ClearPlayerBit(g_iAlive, iPlrId);
}
public Ham_Think_player_Pre(iPlrId)
{
if( g_iDeathDropsNum[iPlrId] )
{
static Float:s_fVelocity[3];
pev(iPlrId, pev_velocity, s_fVelocity);
static s_iDeathDrops, s_iEnt;
for( s_iDeathDrops=0; s_iDeathDrops<g_iDeathDropsNum[iPlrId]; s_iDeathDrops++ )
{
s_iEnt = g_iDeathDrops[iPlrId][s_iDeathDrops];
if( s_iEnt>0 && pev_valid(s_iEnt) )
set_pev(s_iEnt, pev_velocity, s_fVelocity);
}
}
ClearPlayerBit(g_iHamHook_Active, iPlrId);
if( !g_iHamHook_Active )
DisableHamForward(g_iHamHook_Think);
}
public Ham_Touch_safezone_Pre(iEnt, iPlrId)
{
if( iPlrId>0 && iPlrId<=g_iMaxPlayers )
{
static s_iVip;
s_iVip = get_pdata_int(iPlrId, m_bIsVIP, 5);
if( s_iVip&FLAG_VIP )
{
g_bVipDrop = true;
set_pdata_int(iPlrId, m_bIsVIP, (s_iVip&~FLAG_VIP), 5);
force_weapon_drop(iPlrId, 0, 0);
set_pdata_int(iPlrId, m_bIsVIP, s_iVip, 5);
g_bVipDrop = false;
}
}
}
public Ham_Item_CanDrop_Pre(iEnt) // allow drop of various items when needed
{
if( g_bInAutoDrop )
SetHamReturnInteger(1);
else if( get_pcvar_num(g_iCvar_GrenadeDrop) )
{
static s_iOwner;
s_iOwner = get_pdata_cbase(iEnt, m_pPlayer, 4);
if( 0<s_iOwner<=g_iMaxPlayers )
{
if( get_pdata_int(s_iOwner, m_bIsVIP, 5)&FLAG_VIP ) // yep, if somehow VIP gets a grenade, don't allow it to be dropped
return HAM_IGNORED;
static s_iWeaponType;
s_iWeaponType = get_pdata_int(iEnt, m_iId, 4);
if( s_iWeaponType==CSW_KNIFE )
return HAM_IGNORED; // yep, don't allow manual drop of knife
else if( s_iWeaponType==CSW_FLASHBANG )
g_iBulletsDropped[s_iOwner][AMMO_FLASHBANG] = (clamp(get_pdata_int(s_iOwner, (m_rgAmmo_player+AMMO_FLASHBANG), 5), 1, 2)-1);
SetHamReturnInteger(1);
}
else
return HAM_IGNORED;
}
else
return HAM_IGNORED;
return HAM_OVERRIDE;
}
public Ham_Touch_wpnbox_Pre(iEnt, iPlrId) // when weaponbox is touched
{
if( 0<iPlrId<=g_iMaxPlayers )
{
if( get_pdata_int(iPlrId, m_bIsVIP, 5)&FLAG_VIP || ~pev(iEnt, pev_flags)&FL_ONGROUND ) // weaponbox can have an effect on the player
return HAM_SUPERCEDE;
static s_iBoxAmmo, s_iUserAmmo;
if( (s_iBoxAmmo=get_pdata_int(iEnt, (m_rgAmmo+AMMO_FLASHBANG), 4))>0 ) // weaponbox has flashbang information inside
{
if( (s_iUserAmmo=get_pdata_int(iPlrId, (m_rgAmmo_player+AMMO_FLASHBANG), 5))>=2 )
return HAM_SUPERCEDE;
else if( (s_iUserAmmo<=0 && s_iBoxAmmo>=2) )
{
ham_give_item(iPlrId, "weapon_flashbang");
ham_give_item(iPlrId, "weapon_flashbang");
emit_sound(iPlrId, CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
emit_sound(iPlrId, CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
set_pev(iEnt, pev_solid, SOLID_NOT);
set_pev(iEnt, pev_effects, EF_NODRAW);
dllfunc(DLLFunc_Think, iEnt);
return HAM_SUPERCEDE;
}
else if( (s_iUserAmmo==1 && s_iBoxAmmo==1) )
{
ham_give_item(iPlrId, "weapon_flashbang");
emit_sound(iPlrId, CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
set_pev(iEnt, pev_solid, SOLID_NOT);
set_pev(iEnt, pev_effects, EF_NODRAW);
dllfunc(DLLFunc_Think, iEnt);
return HAM_SUPERCEDE;
}
else if( s_iUserAmmo==1 && s_iBoxAmmo>=2 )
{
set_pdata_int(iEnt, (m_rgAmmo+AMMO_FLASHBANG), (s_iBoxAmmo-1), 4);
ham_give_item(iPlrId, "weapon_flashbang");
emit_sound(iPlrId, CHAN_ITEM, "items/9mmclip1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
return HAM_SUPERCEDE;
}
else if( s_iUserAmmo<=0 && ham_give_item(iPlrId, "weapon_flashbang")>0 )
{
emit_sound(iPlrId, CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
set_pev(iEnt, pev_solid, SOLID_NOT);
set_pev(iEnt, pev_effects, EF_NODRAW);
dllfunc(DLLFunc_Think, iEnt);
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
else // now check for actual bullets
{
static s_iTemp;
s_iTemp = get_pdata_cbase(iEnt, (m_rgpPlayerItems+3), 4);
if( s_iTemp>0 && pev_valid(s_iTemp) )
{
if( get_pdata_int(s_iTemp, m_iId, 4)==CSW_KNIFE ) // check passed - this weaponbox should include information about the bullets
{
static s_iFwdMsg_AmmoPickup;
s_iFwdMsg_AmmoPickup = register_message(g_iMsgId_AmmoPickup, "Message_AmmoPickup"); // yes, we'll have to edit hud value
g_iBulletsDropped[0][0] = g_iBulletsDropped[iPlrId][0] = 0;
for( s_iTemp=1; s_iTemp<11; s_iTemp++ )
{
if( (s_iBoxAmmo=get_pdata_int(iEnt, (m_rgAmmo+s_iTemp), 4))>0 )
{
if( (s_iUserAmmo=clamp(get_pdata_int(iPlrId, (m_rgAmmo_player+s_iTemp), 5), 0, g_iMaxAmmo[s_iTemp]))>=g_iMaxAmmo[s_iTemp] )
g_iBulletsDropped[0][0] = 1; // weaponbox still has ammo - don't remove the entity
else
{
if( (s_iUserAmmo+s_iBoxAmmo)<=g_iMaxAmmo[s_iTemp] )
{
g_iBulletsDropped[iPlrId][s_iTemp] = s_iBoxAmmo;
s_iUserAmmo += s_iBoxAmmo;
set_pdata_int(iEnt, (m_rgAmmo+s_iTemp), 0, 4);
}
else
{
g_iBulletsDropped[0][0] = 1; // weaponbox still has ammo - don't remove the entity
g_iBulletsDropped[iPlrId][s_iTemp] = (g_iMaxAmmo[s_iTemp]-s_iUserAmmo);
s_iUserAmmo = g_iMaxAmmo[s_iTemp];
set_pdata_int(iEnt, (m_rgAmmo+s_iTemp), (s_iBoxAmmo-g_iBulletsDropped[iPlrId][s_iTemp]), 4);
}
g_iBulletsDropped[iPlrId][0] += g_iBulletsDropped[iPlrId][s_iTemp]; // we need to save that some bullets were given
fm_give_item(iPlrId, g_iAmmoEntityNames[s_iTemp]); // we must give ammo this way, else weapon
set_pdata_int(iPlrId, (m_rgAmmo_player+s_iTemp), s_iUserAmmo, 5); // wont be able to reload
}
}
}
unregister_message(g_iMsgId_AmmoPickup, s_iFwdMsg_AmmoPickup);
if( g_iBulletsDropped[iPlrId][0] ) // bullets were given - emit bullet pick-up sound
emit_sound(iPlrId, CHAN_ITEM, AMMO_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
if( !g_iBulletsDropped[0][0] ) // weaponbox has no more ammo - remove it
{
set_pev(iEnt, pev_solid, SOLID_NOT);
set_pev(iEnt, pev_effects, EF_NODRAW);
dllfunc(DLLFunc_Think, iEnt);
}
return HAM_SUPERCEDE;
}
}
}
}
return HAM_IGNORED;
}
force_weapon_drop(iPlrId, iArmedGrenade, iWeaponType)
{
if( g_bChangingMap )
return;
g_bInAutoDrop = true; // allow death drop of grenades and knife
static s_iUserWeapons, Float:s_fAngle[3];
s_iUserWeapons = pev(iPlrId, pev_weapons);
pev(iPlrId, pev_v_angle, s_fAngle);
g_fPlayerAngle[iPlrId] = s_fAngle[1];
if( iArmedGrenade!=CSW_HEGRENADE && get_pdata_int(iPlrId, (m_rgAmmo_player+AMMO_HEGRENADE), 5)>0 )
engclient_cmd(iPlrId, "drop", "weapon_hegrenade");
if( (g_iBulletsDropped[iPlrId][AMMO_FLASHBANG]=(clamp(get_pdata_int(iPlrId, (m_rgAmmo_player+AMMO_FLASHBANG), 5), 0, 2)-((iArmedGrenade==CSW_FLASHBANG)?1:0)))>0 )
{
engclient_cmd(iPlrId, "drop", "weapon_flashbang");
if( iArmedGrenade==CSW_FLASHBANG ) // oh, ya, by dropping one flash, we disarm the other one, so we have to bypass it
{
set_pdata_int(iPlrId, (m_rgAmmo_player+AMMO_FLASHBANG), 1, 5); // just to be on the safe side, in case user had more than 2 flashes
iArmedGrenade = ham_give_item(iPlrId, "weapon_flashbang");
set_pdata_int(iPlrId, (m_rgAmmo_player+AMMO_FLASHBANG), 1, 5); // if magically user doesn't die, let him have one flash (not two)
if( iArmedGrenade>0 && pev_valid(iArmedGrenade) )
{
set_pdata_cbase(iPlrId, m_pActiveItem, iArmedGrenade, 5); // yep, lets set it to be the active item
set_pdata_float(iArmedGrenade, m_flStartThrow, 1.0, 3); // now arm the grenade, so at death it'll be dropped
set_pdata_float(iArmedGrenade, m_flTimeWeaponIdle, -0.001, 4);
}
iArmedGrenade = 0;
}
}
if( iArmedGrenade!=CSW_SMOKEGRENADE && get_pdata_int(iPlrId, (m_rgAmmo_player+AMMO_SMOKENADE), 5)>0 )
engclient_cmd(iPlrId, "drop", "weapon_smokegrenade");
static s_iLoop;
g_iBulletsDropped[iPlrId][0] = 0; // this will be higher, if player has any bullets at all
for( s_iLoop=1; s_iLoop<11; s_iLoop++ ) // yep, here we get information of specific bullet types
{
g_iBulletsDropped[iPlrId][s_iLoop] = clamp(get_pdata_int(iPlrId, (m_rgAmmo_player+s_iLoop), 5), 0, g_iMaxAmmo[s_iLoop]);
set_pdata_int(iPlrId, (m_rgAmmo_player+s_iLoop), 0, 5);
g_iBulletsDropped[iPlrId][0] += g_iBulletsDropped[iPlrId][s_iLoop];
}
if( g_iBulletsDropped[iPlrId][0] ) // if player has any bullets at all
{
if( ~s_iUserWeapons&(1<<CSW_KNIFE) ) // if user has no knife - give one
ham_give_item(iPlrId, "weapon_knife");
engclient_cmd(iPlrId, "drop", "weapon_knife");
ham_give_item(iPlrId, "weapon_knife"); // after dropping the knife, to be safe, lets give 1 knife back
}
g_bInAutoDrop = false; // disallow death drop of grenades and knife
if( s_iUserWeapons&(1<<CSW_P228) && iWeaponType!=CSW_P228 ) // just drop all the weapons
engclient_cmd(iPlrId, "drop", "weapon_p228");
if( s_iUserWeapons&(1<<CSW_SCOUT) && iWeaponType!=CSW_SCOUT )
engclient_cmd(iPlrId, "drop", "weapon_scout");
if( s_iUserWeapons&(1<<CSW_XM1014) && iWeaponType!=CSW_XM1014 )
engclient_cmd(iPlrId, "drop", "weapon_xm1014");
if( s_iUserWeapons&(1<<CSW_MAC10) && iWeaponType!=CSW_MAC10 )
engclient_cmd(iPlrId, "drop", "weapon_mac10");
if( s_iUserWeapons&(1<<CSW_AUG) && iWeaponType!=CSW_AUG )
engclient_cmd(iPlrId, "drop", "weapon_aug");
if( s_iUserWeapons&(1<<CSW_ELITE) && iWeaponType!=CSW_ELITE )
engclient_cmd(iPlrId, "drop", "weapon_elite");
if( s_iUserWeapons&(1<<CSW_FIVESEVEN) && iWeaponType!=CSW_FIVESEVEN )
engclient_cmd(iPlrId, "drop", "weapon_fiveseven");
if( s_iUserWeapons&(1<<CSW_UMP45) && iWeaponType!=CSW_UMP45 )
engclient_cmd(iPlrId, "drop", "weapon_ump45");
if( s_iUserWeapons&(1<<CSW_SG550) && iWeaponType!=CSW_SG550 )
engclient_cmd(iPlrId, "drop", "weapon_sg550");
if( s_iUserWeapons&(1<<CSW_GALIL) && iWeaponType!=CSW_GALIL )
engclient_cmd(iPlrId, "drop", "weapon_galil");
if( s_iUserWeapons&(1<<CSW_FAMAS) && iWeaponType!=CSW_FAMAS )
engclient_cmd(iPlrId, "drop", "weapon_famas");
if( s_iUserWeapons&(1<<CSW_USP) && iWeaponType!=CSW_USP )
engclient_cmd(iPlrId, "drop", "weapon_usp");
if( s_iUserWeapons&(1<<CSW_GLOCK18) && iWeaponType!=CSW_GLOCK18 )
engclient_cmd(iPlrId, "drop", "weapon_glock18");
if( s_iUserWeapons&(1<<CSW_AWP) && iWeaponType!=CSW_AWP )
engclient_cmd(iPlrId, "drop", "weapon_awp");
if( s_iUserWeapons&(1<<CSW_MP5NAVY) && iWeaponType!=CSW_MP5NAVY )
engclient_cmd(iPlrId, "drop", "weapon_mp5navy");
if( s_iUserWeapons&(1<<CSW_M249) && iWeaponType!=CSW_M249 )
engclient_cmd(iPlrId, "drop", "weapon_m249");
if( s_iUserWeapons&(1<<CSW_M3) && iWeaponType!=CSW_M3 )
engclient_cmd(iPlrId, "drop", "weapon_m3");
if( s_iUserWeapons&(1<<CSW_M4A1) && iWeaponType!=CSW_M4A1 )
engclient_cmd(iPlrId, "drop", "weapon_m4a1");
if( s_iUserWeapons&(1<<CSW_TMP) && iWeaponType!=CSW_TMP )
engclient_cmd(iPlrId, "drop", "weapon_tmp");
if( s_iUserWeapons&(1<<CSW_G3SG1) && iWeaponType!=CSW_G3SG1 )
engclient_cmd(iPlrId, "drop", "weapon_g3sg1");
if( s_iUserWeapons&(1<<CSW_DEAGLE) && iWeaponType!=CSW_DEAGLE )
engclient_cmd(iPlrId, "drop", "weapon_deagle");
if( s_iUserWeapons&(1<<CSW_SG552) && iWeaponType!=CSW_SG552 )
engclient_cmd(iPlrId, "drop", "weapon_sg552");
if( s_iUserWeapons&(1<<CSW_AK47) && iWeaponType!=CSW_AK47 )
engclient_cmd(iPlrId, "drop", "weapon_ak47");
if( s_iUserWeapons&(1<<CSW_P90) && iWeaponType!=CSW_P90 )
engclient_cmd(iPlrId, "drop", "weapon_p90");
if( s_iUserWeapons&(1<<CSW_C4) && iWeaponType!=CSW_C4 )
engclient_cmd(iPlrId, "drop", "weapon_c4");
}
ham_give_item(iPlrId, iClassName[]) // ham fowrad is useful, cause it doesn't emit no item sound
{
new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, iClassName));
if( iEnt<=0 || !pev_valid(iEnt) )
return 0;
set_pev(iEnt, pev_spawnflags, SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, iEnt);
if( ExecuteHamB(Ham_AddPlayerItem, iPlrId, iEnt) )
{
ExecuteHamB(Ham_Item_AttachToPlayer, iEnt, iPlrId);
return iEnt;
}
if( pev_valid(iEnt) )
set_pev(iEnt, pev_flags, (pev(iEnt, pev_flags)|FL_KILLME));
return -1;
}
fm_give_item(iPlrId, iClassName[]) // fakemeta forward is useful, cause it can be used with ammo_ items
{
new iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, iClassName));
if( !pev_valid(iEnt) )
return 0;
set_pev(iEnt, pev_spawnflags, (pev(iEnt, pev_spawnflags)|SF_NORESPAWN));
dllfunc(DLLFunc_Spawn, iEnt);
new iSolidType = pev(iEnt, pev_solid);
dllfunc(DLLFunc_Touch, iEnt, iPlrId);
if( pev(iEnt, pev_solid)!=iSolidType )
return iEnt;
set_pev(iEnt, pev_flags, (pev(iEnt, pev_flags)|FL_KILLME));
return -1;
}
bool:is_player_connected(iPlrId)
{
if( 0<iPlrId<=g_iMaxPlayers )
{
if( CheckPlayerBit(g_iConnected, iPlrId) )
return true;
}
return false;
}
bool:SphereToCartesian(Float:fDest[3], Float:fOrigin[3], Float:fView[3], Float:fAngle[3])
{
fView[1] *= (M_PI/180.0); // and now angle[0] and angle[1] has no effect?
fView[0] *= (M_PI/180.0); // yes, this code is eDarks, so I don't remember why I added that comment above
fAngle[0] *= (M_PI/-180.0);
fAngle[1] *= (M_PI/180.0);
static Float:s_fSin0, Float:s_fCos0, Float:s_fSin1, Float:s_fCos1;
s_fSin0 = floatsin((fAngle[0]+(M_PI*0.5)), radian);
fDest[0] = fAngle[2]*s_fSin0*floatcos(fAngle[1], radian);
fDest[1] = fAngle[2]*s_fSin0*floatsin(fAngle[1], radian);
fDest[2] = fAngle[2]*floatcos((fAngle[0]+(M_PI*0.5)), radian);
s_fSin0 = floatsin(fView[0], radian);
s_fCos0 = floatcos(fView[0], radian);
s_fSin1 = floatsin(fView[1], radian);
s_fCos1 = floatcos(fView[1], radian);
static Float:s_fTemp[3];
s_fTemp[0] = (fDest[0]*s_fCos0*s_fCos1)-(fDest[1]*s_fSin1)+(fDest[2]*s_fSin0*s_fCos1);
s_fTemp[1] = (fDest[0]*s_fCos0*s_fSin1)+(fDest[1]*s_fCos1)+(fDest[2]*s_fSin1*s_fSin0);
s_fTemp[2] = (fDest[2]*s_fCos0)-(fDest[0]*s_fSin0);
fDest[0] = (fOrigin[0]+s_fTemp[0]);
fDest[1] = (fOrigin[1]+s_fTemp[1]);
fDest[2] = (fOrigin[2]-s_fTemp[2]);
return true;
}
Здравствуйте, у меня проблема с плагином real weapon drop. Плагин выбрасывает отдельно патроны и пистолет с гранатами при смерти, также позволяет выбрасывать гранаты на g. Помимо этого он делает выбрасывание оружия более реалистичным, задавая ему вектор полета в сторону прицела. На старых версиях ReHLDS физика выкидывания работает исправно, однако, на новых она пропадает. Во всем остальном плагин продолжает корректно работать. При компиляции ошибок не выдает. Прошу подсказать: в чем проблема?
В этой теме было размещено решение! Перейти к решению.