- Ошибка
-
L 06/16/2021 - 20:54:37: [FAKEMETA] Invalid entity 0
L 06/16/2021 - 20:54:37: [AMXX] Displaying debug trace (plugin "m32_venom_zp.amxx", version "1.0")
L 06/16/2021 - 20:54:37: [AMXX] Run time error 10: native error (native "get_pdata_int")
L 06/16/2021 - 20:54:37: [AMXX] [0] m32_venom_zp.sma::fw_CmdStart (line 302)
- ОС
- Linux
- Amx Mod X
-
1.9.0.5249
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.9.0.752-dev
Build date: 20:13:15 Jun 14 2021 (2620)
Build from: https://github.com/dreamstalker/rehlds/commit/39b4410
- ReGamedll
-
Not using
- Версия Metamod
-
Metamod-r v1.3.0.128
- Список метамодулей
-
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.137 ini Start Never
[ 3] NetBufExtender RUN - nbex.so v1.0 ini ANY Never
[ 4] UserInfoNetOptimizer RUN - uino.so v1.0 ini ANY Never
[ 5] LocalizeBug Fix RUN - localizebugfix_mm_i386.so v2.4 ini Start Never
[ 6] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 7] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5249 ini Start ANY
[ 8] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 9] MySQL RUN - mysql_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[10] Fun RUN - fun_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[11] Engine RUN - engine_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[12] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[13] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[14] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[15] CSX RUN - csx_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[16] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[17] ReAPI RUN - reapi_amxx_i386.so v5.19.0.211-dev pl7 ANY Never
[18] SxGeo RUN - sxgeo_amxx_i386.so v2.2 pl7 ANY Never
18 plugins, 18 running
- Список плагинов
-
[106] m32_venom 1.0 Dias Remade Mell m32_venom_zp.am debug
- Автор плагина
- Mellowzy
- Версия плагина
- 1.0
- Исходный код
-
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <xs>
#include <cstrike>
#include <zombieplague>
#define M32_CLIP 6
#define M32_BPAMMO 156
#define M32_DAMAGE_EXPLOSION 1000.0
#define M32_DAMAGE_POISON 250.0
#define M32_RANGE 120.0
#define MODEL_V "models/v_m32venom.mdl"
#define MODEL_P "models/p_m32venom.mdl"
#define MODEL_W "models/w_m32venom.mdl"
#define GRENADE_MODEL "models/grenade.mdl"
#define ENG_NULLENT -1
#define EV_INT_WEAPONKEY EV_INT_impulse
#define M32_WEAPONKEY 10921831
#define weapon_m32venom "weapon_m3"
#define weapon_event "events/m3.sc"
#define weapon_old "models/w_m3.mdl"
#define CSW_BASE CSW_M3
// Attachment
#define MAX_CHANNEL 4
#define ATTACHMENT_CLASSNAME "venom_hit"
#define TASK_RELOADING 1335+19
const pev_user = pev_iuser1
const pev_livetime = pev_fuser1
const pev_totalframe = pev_fuser2
new g_MyAttachment[33][MAX_CHANNEL+1]
new const FIRE_SOUND[][] = { "weapons/m32venom-1.wav" }
new const GRENADE_TRAIL[] = "sprites/laserbeam.spr"
new const GRENADE_EXPLOSION[] = "sprites/ef_m32_poison.spr"
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_P90)|(1<<CSW_P90)|(1<<CSW_P90)|(1<<CSW_SG550)|(1<<CSW_P90)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_P90)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_M3)|(1<<CSW_P90)|(1<<CSW_AK47)|(1<<CSW_P90)
new M32_Venom
new in_zoom[33], g_reload[33], sTrail, sExplo, g_has_M32[33], getzoom[33]
new g_MsgWeaponList, g_MaxPlayers, g_orig_event_M32
public plugin_init()
{
register_plugin("m32_venom", "1.0", "Dias Remade Mellowzy")
register_event("CurWeapon","CurrentWeapon","be","1=1")
register_forward(FM_CmdStart, "fw_CmdStart")
register_forward(FM_SetModel, "fw_SetModel")
register_forward(FM_UpdateClientData, "fw_UpdateClientData_Post", 1)
register_forward(FM_PlaybackEvent, "fw_PlaybackEvent")
register_think("venom_poison", "PoisonThink")
register_think(ATTACHMENT_CLASSNAME, "fw_Think")
RegisterHam(Ham_Item_AddToPlayer, weapon_m32venom, "fw_AddToPlayer", 1)
RegisterHam(Ham_Item_Deploy,weapon_m32venom, "fw_Item_Deploy_Post", 1)
RegisterHam(Ham_Weapon_Reload, weapon_m32venom, "fw_r")
RegisterHam(Ham_Weapon_Reload, weapon_m32venom, "fw_reload")
register_message(get_user_msgid("DeathMsg"), "Message_DeathMsg")
M32_Venom = zp_register_extra_item("M32 MGL Venom", 30, ZP_TEAM_HUMAN)
g_MsgWeaponList = get_user_msgid("WeaponList")
g_MaxPlayers = get_maxplayers()
register_clcmd("weapon_m32venom", "Hook_Select")
}
public plugin_precache()
{
precache_model(MODEL_V)
precache_model(MODEL_P)
precache_model(MODEL_W)
precache_model(GRENADE_MODEL)
precache_sound(FIRE_SOUND[0])
sTrail = precache_model(GRENADE_TRAIL)
sExplo = precache_model(GRENADE_EXPLOSION)
precache_model("sprites/ef_smoke_poison.spr")
precache_model("sprites/head_poison.spr")
// Extra Sound
precache_sound("weapons/M32_after_reload.wav")
precache_sound("weapons/M32_insert.wav")
precache_sound("weapons/M32_start_reload.wav")
precache_sound("weapons/m32venom_exp.wav")
// WeaponList
precache_generic("sprites/weapon_m32venom.txt")
precache_generic("sprites/640hud177.spr")
precache_generic("sprites/640hud18.spr")
register_forward(FM_PrecacheEvent, "fwPrecacheEvent_Post", 1)
}
public Hook_Select(id)
{
engclient_cmd(id, weapon_m32venom)
return PLUGIN_HANDLED
}
public fwPrecacheEvent_Post(type, const name[])
{
if (equal(weapon_event, name))
{
g_orig_event_M32 = get_orig_retval()
return FMRES_HANDLED
}
return FMRES_IGNORED
}
public plugin_natives()
{
register_native("get_m32venom", "Get_M32_Venom", 1)
register_native("refill", "Refill_M32_Venom", 1)
register_native("remove_m32venom", "Remove_M32_Venom", 1)
}
public zp_extra_item_selected(id, itemid)
{
if(itemid != M32_Venom)
return
Get_M32_Venom(id)
}
public zp_user_infected_post(id)Remove_M32_Venom(id)
public zp_user_humanized_post(id)Remove_M32_Venom(id)
public Get_M32_Venom(id)
{
if(!is_user_alive(id))return
drop_weapons(id, 1)
new iWep2 = give_item(id,weapon_m32venom)
if(iWep2 > 0)
{
cs_set_weapon_ammo(iWep2, M32_CLIP)
cs_set_user_bpammo(id, CSW_BASE, M32_BPAMMO)
}
if(in_zoom[id])
{
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)
in_zoom[id] = 0
}
message_begin(MSG_ONE_UNRELIABLE, g_MsgWeaponList, {0,0,0}, id)
write_string("weapon_m32venom")
write_byte(5)
write_byte(32)
write_byte(-1)
write_byte(-1)
write_byte(0)
write_byte(5)
write_byte(21)
write_byte(0)
message_end()
Set_Player_Zoom(id, 0)
getzoom[id] = 0
g_reload[id] = 0
g_has_M32[id] = true
}
public Refill_M32_Venom(id)
{
if(!is_user_alive(id)) return
if(cs_get_user_bpammo(id, CSW_BASE) < M32_BPAMMO)
cs_set_user_bpammo(id, CSW_BASE, M32_BPAMMO)
else return
}
public Remove_M32_Venom(id)
{
g_has_M32[id] = false
Set_Player_Zoom(id, 0)
getzoom[id] = 0
remove_task(id+TASK_RELOADING)
}
public fw_AddToPlayer(M32, id)
{
if(!pev_valid(M32) || !is_user_alive(id)) return
if(pev(M32, pev_impulse) == M32_WEAPONKEY)
{
g_has_M32[id] = true
g_reload[id] = 0
Set_Player_Zoom(id, 0)
set_pev(M32, pev_impulse, 0)
message_begin(MSG_ONE_UNRELIABLE, g_MsgWeaponList, {0,0,0}, id)
write_string(g_has_M32[id] == 1 ? "weapon_m32venom" : weapon_m32venom)
write_byte(5)
write_byte(32)
write_byte(-1)
write_byte(-1)
write_byte(0)
write_byte(5)
write_byte(21)
write_byte(0)
message_end()
}
}
public fw_SetModel(ent, const model[])
{
if(!pev_valid(ent))
return FMRES_IGNORED
static szClassName[33]
entity_get_string(ent, EV_SZ_classname, szClassName, charsmax(szClassName))
if(!equal(szClassName, "weaponbox"))
return FMRES_IGNORED
static id
id = pev(ent, pev_owner)
if(equal(model, weapon_old))
{
static Wpn
Wpn = find_ent_by_owner(-1, weapon_m32venom, ent)
if(!pev_valid(Wpn))
return FMRES_IGNORED;
if(g_has_M32[id])
{
set_pev(Wpn, pev_impulse, M32_WEAPONKEY)
engfunc(EngFunc_SetModel, ent, MODEL_W)
g_has_M32[id] = false
g_reload[id] = 0
getzoom[id] = 0
Set_Player_Zoom(id, 0)
return FMRES_SUPERCEDE
}
}
return FMRES_IGNORED
}
public fw_Item_Deploy_Post(weapon_ent)
{
new owner = pev(weapon_ent,pev_owner)
if(is_user_alive(owner) && get_user_weapon(owner) == CSW_BASE)
Set_Player_Zoom(owner, 0)
static weaponid; weaponid = cs_get_weapon_id(weapon_ent)
if(is_user_alive(owner)) replace_weapon_models(owner, weaponid)
}
public CurrentWeapon(id)
{
if(read_data(2) != CSW_BASE)
{
if(g_reload[id])
{
g_reload[id] = false
remove_task(id + TASK_RELOADING)
}
}
replace_weapon_models(id, read_data(2))
remove_task(id)
}
replace_weapon_models(id, weaponid)
{
switch(weaponid)
{
case CSW_BASE:
{
if(g_has_M32[id] && is_user_alive(id))
{
set_pev(id, pev_viewmodel2, MODEL_V)
set_pev(id, pev_weaponmodel2, MODEL_P)
}
}
}
}
public fw_UpdateClientData_Post(Player, SendWeapons, CD_Handle)
{
if(!is_user_alive(Player) || (get_user_weapon(Player) != CSW_BASE) || !g_has_M32[Player]) return FMRES_IGNORED
set_cd(CD_Handle, CD_flNextAttack, halflife_time () + 0.00001)
return FMRES_HANDLED
}
public fw_CmdStart(id)
{
static Ent; Ent = fm_get_user_weapon_entity(id, CSW_BASE)
static iClip; iClip = get_pdata_int(Ent, 51, 4)
new ammo, clip, weapon = get_user_weapon(id, clip, ammo)
if (!g_has_M32[id] || weapon != CSW_BASE || !is_user_alive(id))return
if(get_pdata_float(Ent, 46, 4) > 0.0 || !iClip)return
if(pev(id, pev_button) & IN_ATTACK)
{
if(g_reload[id])
{
UTIL_PlayWeaponAnimation(id, 4)
set_pdata_float(id, 83, 1.0)
remove_task(id + TASK_RELOADING)
g_reload[id] = false
return
}
UTIL_PlayWeaponAnimation(id,random_num(1,2))
emit_sound(id, CHAN_WEAPON, FIRE_SOUND[0], 1.0, ATTN_NORM, 0, PITCH_NORM)
FireGrenade(id)
MakeRecoil(id)
set_pdata_int(Ent, 51, iClip - 1, 4)
set_pdata_float(Ent, 46, 1.0, 4)
set_pdata_float(Ent, 48, 1.0, 4)
}
if((pev(id, pev_button) & IN_ATTACK2))
{
if(!getzoom[id])
Set_Player_Zoom(id, 1)
else Set_Player_Zoom(id, 0)
set_pdata_float(Ent, 46, 0.5, 4)
set_pdata_float(Ent, 48, 0.5, 4)
}
}
public Remove_Entity(Ent)
{
if(pev_valid(Ent)) remove_entity(Ent)
}
public MakeRecoil(id)
{
if(!is_user_alive(id))
return
if(!g_has_M32[id])
return;
static Float:punchAngle[3];
punchAngle[0] = float(random_num(-1 * 400, 400)) / 100.0;
punchAngle[1] = float(random_num(-1 * 700, 700)) / 100.0;
punchAngle[2] = 0.0;
set_pev(id, pev_punchangle, punchAngle);
}
public FireGrenade(id)
{
new Float:origin[3],Float:velocity[3],Float:angles[3]
engfunc(EngFunc_GetAttachment, id, 0, origin,angles)
pev(id,pev_angles,angles)
new ent = create_entity("info_target")
set_pev(ent, pev_classname, "M32_grenade")
set_pev(ent, pev_solid, SOLID_BBOX)
set_pev(ent, pev_movetype, MOVETYPE_TOSS)
set_pev(ent, pev_mins, { -0.1, -0.1, -0.1 })
set_pev(ent, pev_maxs, { 0.1, 0.1, 0.1 })
entity_set_model(ent, GRENADE_MODEL)
set_pev(ent, pev_origin, origin)
set_pev(ent, pev_angles, angles)
set_pev(ent, pev_owner, id)
velocity_by_aim(id, getzoom[id]? 1400 : 1000 , velocity)
set_pev(ent, pev_velocity, velocity)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // Temporary entity ID
write_short(ent) // Entity
write_short(sTrail) // Sprite index
write_byte(10) // Life
write_byte(2) // Line width
write_byte(255) // Red
write_byte(255) // Green
write_byte(255) // Blue
write_byte(255) // Alpha
message_end()
return PLUGIN_CONTINUE
}
// We hit something!!!
public pfn_touch(ptr, ptd)
{
// If ent is valid
if (pev_valid(ptr))
{
// Get classnames
static classname[32]
pev(ptr, pev_classname, classname, 31)
// Our ent
if(equal(classname, "M32_grenade"))
{
// Get it's origin
new Float:originF[3]
pev(ptr, pev_origin, originF)
// Draw explosion
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_EXPLOSION) // Temporary entity ID
engfunc(EngFunc_WriteCoord, originF[0]) // engfunc because float
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2]+30.0)
write_short(sExplo) // Sprite index
write_byte(20) // Scale
write_byte(25) // Framerate
write_byte(TE_EXPLFLAG_NODLIGHTS | TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES) // Flags
message_end()
emit_sound(ptd, CHAN_BODY, "weapons/m32venom_exp.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
Create_Poison(ptr)
// Get owner
new pevAttacker = pev(ptr, pev_owner)
Stock_DamageRadius(pevAttacker, CSW_BASE, originF, M32_RANGE, M32_DAMAGE_EXPLOSION, DMG_BULLET)
set_pev(ptr, pev_flags, pev(ptr, pev_flags) | FL_KILLME)
}
}
}
public Create_Poison(iEnt)
{
if(!pev_valid(iEnt))return
static Float:Origin[3]; pev(iEnt, pev_origin, Origin)
Create_Poison_Onground(Origin, iEnt)
}
public Create_Poison_Onground(Float:Origin[3], iEnt)
{
static id; id = pev(iEnt, pev_owner)
static Ent; Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
if(!pev_valid(Ent)) return
// Set info for ent
set_pev(Ent, pev_movetype, MOVETYPE_PUSHSTEP)
set_pev(Ent, pev_rendermode, kRenderTransAdd)
set_pev(Ent, pev_renderamt, 100.0)
set_pev(Ent, pev_scale, 3.0)
set_pev(Ent, pev_nextthink, get_gametime() + 0.05)
set_pev(Ent, pev_owner, id)
set_pev(Ent, pev_classname, "venom_poison")
engfunc(EngFunc_SetModel, Ent, "sprites/ef_smoke_poison.spr")
set_pev(Ent, pev_mins, Float:{-16.0, -16.0, -6.0})
set_pev(Ent, pev_maxs, Float:{16.0, 16.0, 36.0})
set_pev(Ent, pev_origin, Origin)
set_pev(Ent, pev_iuser2, pev(iEnt, pev_iuser2))
set_pev(Ent, pev_gravity, 1.0)
set_pev(Ent, pev_solid, SOLID_TRIGGER)
set_pev(Ent, pev_frame, 0.0)
}
public PoisonThink(iEnt)
{
static Float:fFrame; pev(iEnt, pev_frame, fFrame)
new pevAttacker = pev(iEnt, pev_owner);
if(!is_user_connected(pevAttacker) || !is_user_alive(pevAttacker) || !g_has_M32[pevAttacker])
{
set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)
return
}
if(!pev_valid(iEnt)) return;
if(pev(iEnt, pev_flags) & FL_KILLME) return;
fFrame += 0.5
if(fFrame >= 38.0)
set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)
set_pev(iEnt, pev_frame, fFrame)
set_pev(iEnt, pev_nextthink, halflife_time() + 0.05)
if(get_gametime() >= pev(iEnt, pev_livetime))
{
static Float:Origin[3]
pev(iEnt, pev_origin, Origin)
Stock_DamageRadius(pevAttacker, CSW_BASE, Origin, M32_RANGE, M32_DAMAGE_POISON, DMG_POISON)
set_pev(iEnt, pev_livetime, get_gametime())
set_pev(iEnt, pev_owner, pevAttacker)
}
}
public fw_Think(Ent)
{
if(!pev_valid(Ent))
return
static Owner; Owner = pev(Ent, pev_user)
if(!is_user_alive(Owner))
{
engfunc(EngFunc_RemoveEntity, Ent)
return
}
if(get_gametime() >= pev(Ent, pev_livetime))
{
if(pev(Ent, pev_renderamt) > 0.0)
{
static Float:AMT; pev(Ent, pev_renderamt, AMT)
static Float:RealAMT;
AMT -= 10.0
RealAMT = float(max(floatround(AMT), 0))
set_pev(Ent, pev_renderamt, RealAMT)
} else {
engfunc(EngFunc_RemoveEntity, Ent)
return
}
}
if(pev(Ent, pev_frame) >= pev(Ent, pev_totalframe))
set_pev(Ent, pev_frame, 0.0)
// Set Attachment
static Float:Origin[3]; pev(Owner, pev_origin, Origin)
if(!(pev(Owner, pev_flags) & FL_DUCKING)) Origin[2] += 36.0
else Origin[2] += 26.0
engfunc(EngFunc_SetOrigin, Ent, Origin)
// Force Think
set_pev(Ent, pev_nextthink, get_gametime() + 0.05)
}
public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2)
{
if ((eventid != g_orig_event_M32)) return FMRES_IGNORED
if (!(1 <= invoker <= g_MaxPlayers)) return FMRES_IGNORED
playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2)
return FMRES_SUPERCEDE
}
public Message_DeathMsg(msg_id, msg_dest, id)
{
static szTruncatedWeapon[33], iAttacker, iVictim
get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
iAttacker = get_msg_arg_int(1)
iVictim = get_msg_arg_int(2)
if(!is_user_connected(iAttacker) || iAttacker == iVictim) return PLUGIN_CONTINUE
if(get_user_weapon(iAttacker) == CSW_BASE)
{
if(g_has_M32[iAttacker])
set_msg_arg_string(4, "m32")
}
return PLUGIN_CONTINUE
}
stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
{
set_pev(Player, pev_weaponanim, Sequence)
message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
write_byte(Sequence)
write_byte(2)
message_end()
}
public fw_r(wpn) {
if(g_has_M32[ pev(wpn, pev_owner) ]) {
fw_reload(wpn)
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public fw_reload(weapon) {
new id = pev(weapon, pev_owner)
new clip, bpammo
get_user_weapon(id, clip, bpammo)
if(g_has_M32[ id ] && clip < 6 && bpammo > 0) {
if(!task_exists(id+TASK_RELOADING)) set_task(0.1, "reload", id+TASK_RELOADING)
}
if(in_zoom[id])
{
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)
in_zoom[id] = 0
}
return HAM_IGNORED
}
public reload(id) {
id -= TASK_RELOADING
new clip, bpammo, weapon = find_ent_by_owner(-1, "weapon_m3", id)
get_user_weapon(id, clip, bpammo)
Set_Player_Zoom(id, 0)
if(!g_reload[id]) {
Set_Player_Zoom(id, 0)
UTIL_PlayWeaponAnimation(id, 5)
g_reload[ id ] = 1
set_pdata_float(id, 83, 1.0, 5)
set_task(0.7, "reload", id+TASK_RELOADING)
return
}
if(in_zoom[id])
{
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)
in_zoom[id] = 0
}
if(clip > 5 || bpammo < 1) {
UTIL_PlayWeaponAnimation(id, 4)
g_reload[ id ] = 0
set_pdata_float(id, 83, 1.5, 5)
return
}
cs_set_user_bpammo(id, CSW_BASE, bpammo - 1)
cs_set_weapon_ammo(weapon, clip + 1)
set_pdata_float(id, 83, 1.0, 5)
UTIL_PlayWeaponAnimation(id, 3)
set_task(0.7, "reload", id+TASK_RELOADING)
}
stock drop_weapons(id, dropwhat)
{
static weapons[32], num, i, weaponid
num = 0
get_user_weapons(id, weapons, num)
for (i = 0; i < num; i++)
{
weaponid = weapons[i]
if (dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM))
{
static wname[32]
get_weaponname(weaponid, wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
stock Set_Player_Zoom(id, type = 0)
{
if(!is_user_alive(id))return
if(type == 0 && getzoom[id] == 1)
{
cs_set_user_zoom(id, CS_RESET_ZOOM, 1)
getzoom[id] = 0
}
if(type == 1 && getzoom[id] == 0)
{
cs_set_user_zoom(id, CS_SET_AUGSG552_ZOOM, 1)
getzoom[id] = 1
}
emit_sound(id, CHAN_ITEM, "weapons/zoom.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
stock Stock_DamageRadius(iPlayer, CSWID, Float:vOrigin[3], Float:fRadius, Float:fDamage, iDamageType = DMG_BULLET)
{
new iCount, iVictim = FM_NULLENT
new iEnt = fm_get_user_weapon_entity(iPlayer, CSWID)
while((iVictim = find_ent_in_sphere(iVictim, vOrigin, fRadius)) != 0)
{
if(iVictim == iPlayer) continue
if(pev(iVictim, pev_takedamage) == DAMAGE_NO) continue
if(pev(iVictim, pev_spawnflags) & SF_BREAK_TRIGGER_ONLY) continue
if(is_user_alive(iVictim))
if(get_user_team(iVictim) == get_user_team(iPlayer)) continue
iCount ++
ExecuteHamB(Ham_TakeDamage, iVictim, iEnt, iPlayer, fDamage, iDamageType)
Show_Attachment(iVictim, "sprites/head_poison.spr", 3.0, 1.0, 1.0, 6)
}
return iCount
}
stock Show_Attachment(id, const Sprite[], Float:Time, Float:Scale, Float:FrameRate, TotalFrame)
{
if(!is_user_alive(id))
return
static channel; channel = 0
for(new i = 0; i < MAX_CHANNEL; i++)
{
if(pev_valid(g_MyAttachment[id][i])) channel++
else {
channel = i
break
}
}
if(channel >= MAX_CHANNEL) return
if(!pev_valid(g_MyAttachment[id][channel]))
g_MyAttachment[id][channel] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite"))
if(!pev_valid(g_MyAttachment[id][channel]))
return
// Set Properties
set_pev(g_MyAttachment[id][channel], pev_takedamage, DAMAGE_NO)
set_pev(g_MyAttachment[id][channel], pev_solid, SOLID_NOT)
set_pev(g_MyAttachment[id][channel], pev_movetype, MOVETYPE_FOLLOW)
// Set Sprite
set_pev(g_MyAttachment[id][channel], pev_classname, ATTACHMENT_CLASSNAME)
engfunc(EngFunc_SetModel, g_MyAttachment[id][channel], Sprite)
// Set Rendering
set_pev(g_MyAttachment[id][channel], pev_renderfx, kRenderFxNone)
set_pev(g_MyAttachment[id][channel], pev_rendermode, kRenderTransAdd)
set_pev(g_MyAttachment[id][channel], pev_renderamt, 150.0)
// Set other
set_pev(g_MyAttachment[id][channel], pev_user, id)
set_pev(g_MyAttachment[id][channel], pev_scale, Scale)
set_pev(g_MyAttachment[id][channel], pev_livetime, get_gametime() + Time)
set_pev(g_MyAttachment[id][channel], pev_totalframe, float(TotalFrame))
// Set Origin
static Float:Origin[3]; pev(id, pev_origin, Origin)
if(!(pev(id, pev_flags) & FL_DUCKING)) Origin[2] += 25.0
else Origin[2] += 20.0
engfunc(EngFunc_SetOrigin, g_MyAttachment[id][channel], Origin)
// Allow animation of sprite ?
if(TotalFrame && FrameRate > 0.0)
{
set_pev(g_MyAttachment[id][channel], pev_animtime, get_gametime())
set_pev(g_MyAttachment[id][channel], pev_framerate, FrameRate + 9.0)
set_pev(g_MyAttachment[id][channel], pev_spawnflags, SF_SPRITE_STARTON)
dllfunc(DLLFunc_Spawn, g_MyAttachment[id][channel])
}
// Force Think
set_pev(g_MyAttachment[id][channel], pev_nextthink, get_gametime() + 0.05)
}
/*stock FakeTakeDamage(victim, attacker, Float:flDamage, type) // Error
{
new Float:health, Float:armorvalue;
pev(victim, pev_health, health);
pev(victim, pev_armorvalue, armorvalue);
if (armorvalue > 0)
{
flDamage *= 0.5;
armorvalue -= flDamage;
}
health -= flDamage;
set_pev(victim, pev_health, health);
set_pev(victim, pev_armorvalue, armorvalue);
if (health < 0.0)
death_message(attacker, victim, 1, type)
}
stock death_message(Killer, Victim, ScoreBoard, type)
{
// Block death msg
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
ExecuteHamB(Ham_Killed, Victim, Killer, type)
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
// Death
make_deathmsg(Killer, Victim, 0, "m32")
// Update score board
if (ScoreBoard)
{
message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
write_byte(Killer) // id
write_short(pev(Killer, pev_frags)) // frags
write_short(cs_get_user_deaths(Killer)) // deaths
write_short(0) // class?
write_short(get_user_team(Killer)) // team
message_end()
message_begin(MSG_BROADCAST, get_user_msgid("ScoreInfo"))
write_byte(Victim) // id
write_short(pev(Victim, pev_frags)) // frags
write_short(cs_get_user_deaths(Victim)) // deaths
write_short(0) // class?
write_short(get_user_team(Victim)) // team
message_end()
}
}*/
SOLVED
В этой теме было размещено решение! Перейти к решению.
Последнее редактирование: