WeaponMod

Материал из HLDM Wiki
Версия от 12:58, 14 июня 2013; Nikita (обсуждение | вклад) (Новая страница: «== hl_wpnmod.inc == === wpnmod_register_weapon === Регистрация нового оружия. Возвращает ID зарегистрированно…»)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к навигации Перейти к поиску

hl_wpnmod.inc

wpnmod_register_weapon

Регистрация нового оружия. Возвращает ID зарегистрированного оружия или -1 в случае ошибки.


native wpnmod_register_weapon(const szName[], const iSlot, const iPosition, const szAmmo1[], const iMaxAmmo1, const szAmmo2[], const,  iMaxAmmo2, const iMaxClip, const iFlags, const iWeight);
szName Имя оружия
iSlot ID слота от 1 до 5
iPosition Позиция в слоте от 1 до 5
szAmmo1 Тип патронов основной атаки ("9mm", "uranium", "MY_AMMO" и т.д.).
iMaxAmmo1 Максимальное количество патронов в обойме для основной атаки
szAmmo2 Тип патронов вторичной атаки
iMaxAmmo2 Максимальное количество патронов в обойме для вторичной атаки
iMaxClip Максимальное количество переносимых игроком патронов (в обойме не считается)
iFlags Флаги оружия (смотри константы).
iWeight Вес оружия (для автопереключения

wpnmod_register_weapon_forward

Регистрирует форвард оружия.

native wpnmod_register_weapon_forward(const iWeaponID, const e_WpnFwds: iForward, const szCallBack[]);

@param iWeaponID The ID of registered weapon. @param iForward Forward type to register. @param szCallBack The forward to call.

wpnmod_get_weapon_info

Returns any ItemInfo variable for weapon. Use the e_ItemInfo_* enum.

native wpnmod_get_weapon_info(const iId, const e_ItemInfo: iInfoType, any:...);

@param iId The ID of registered weapon or weapon entity Id. @param iInfoType ItemInfo type. @return Weapon's ItemInfo variable.


wpnmod_get_weapon_count

Возвращает количество зарегистрированного оружия.

native wpnmod_get_weapon_count();


wpnmod_register_ammobox

Регистрация нового аммобокса в модуле.

native wpnmod_register_ammobox(const szClassname[]);
szName Название аммобокса ("uranium", "9mm", "my_ammo" и т.д.)


wpnmod_register_ammobox_forward

Регистрирует форвард аммобокса

native wpnmod_register_ammobox_forward(const iWeaponID, const e_AmmoFwds: iForward, const szCallBack[]);
  • @param iAmmoboxID The ID of registered ammobox.
  • @param iForward Forward type to register.
  • @param szCallBack The forward to call.


wpnmod_get_ammobox_info

Returns any AmmoInfo variable for ammobox. Use the e_AmmoInfo_* enum.

native wpnmod_get_ammobox_info(const iId, const e_AmmoInfo: iInfoType, any:...);
  • @param iId The ID of registered ammobox or ammobox entity Id.
  • @param iInfoType e_AmmoInfo_* type.
  • @return Ammobox's AmmoInfo variable.

wpnmod_get_ammobox_count

Возвращает количество зарегистрированных аммобоксов.

native wpnmod_get_ammobox_count();

wpnmod_set_think

Sets weapon's think function. Analogue of set_task native.

native wpnmod_set_think(const iItem, const szCallBack[]);
  • @param iItem Weapon's entity index.
  • @param szCallBack The forward to call.

wpnmod_set_touch

Sets entity's touch function.

native wpnmod_set_touch(const iEntity, const szCallBack[]);
  • @param iEntity Entity index.
  • @param szCallBack The forward to call.

wpnmod_send_weapon_anim

Играть анимацию оружия.

native wpnmod_send_weapon_anim(const iItem, const iAnim);
  • @param iItem Weapon's entity index.
  • @param iAnim Sequence number.

wpnmod_set_player_anim

Sets the activity for player based on an event or current state.

native wpnmod_set_player_anim(const iPlayer, const PLAYER_ANIM: iPlayerAnim);
  • @param iPlayer Player index.
  • @param iPlayerAnim Animation (see PLAYER_ANIM constants).

wpnmod_set_anim_ext

Set animation extension for player.

native wpnmod_set_anim_ext(const iPlayer, const szAnimExt[]);
  • @param iPlayer Player id.
  • @param szAnimExt[] Animation extension prefix.

wpnmod_get_anim_ext

Get animation extension for player.

native wpnmod_get_anim_ext(const iPlayer, szDest[], iMaxLen);
  • @param iPlayer Player id.
  • @param szDest[] Buffer.
  • @param iMaxLen Max buffer size.

wpnmod_set_offset_int

Sets an integer from private data.

native wpnmod_set_offset_int(const iEntity, const e_Offsets: iOffset, const iValue);
  • @param iEntity Entity index.
  • @param iOffset Offset (see e_Offsets constants).
  • @param iValue Value.

wpnmod_get_offset_int

Returns an integer from private data.

native wpnmod_get_offset_int(const iEntity, const e_Offsets: iOffset);
  • @param iEntity Entity index.
  • @param iOffset Offset (see e_Offsets constants).
  • @return Value from private data. (integer)

wpnmod_set_offset_float

Sets a float from private data.

native wpnmod_set_offset_float(const iEntity, const e_Offsets: iOffset, const Float: flValue);
  • @param iEntity Entity index.
  • @param iOffset Offset (see e_Offsets constants).
  • @param flValue Value.

wpnmod_get_offset_float

Returns a float from private data.

native Float: wpnmod_get_offset_float(const iEntity, const e_Offsets: iOffset);
  • @param iEntity Entity index.
  • @param iOffset Offset (see e_Offsets constants).
  • @return Value from private data. (float)

wpnmod_set_offset_cbase

Set the corresponding cbase field in private data with the index.

native wpnmod_set_offset_cbase(const iEntity, const e_CBase: iOffset, const iValue, const iExtraOffset = 0);
  • @param iEntity The entity to examine the private data.
  • @param iOffset Offset (See e_CBase constants).
  • @param iValue The index to store.
  • @param iExtraOffset The extra offset.

wpnmod_get_offset_cbase

This will return an index of the corresponding cbase field in private data.

native wpnmod_get_offset_cbase(const iEntity, const e_CBase: iOffset, const iExtraOffset = 0);
  • @param iEntity The entity to examine the private data.
  • @param iOffset Offset (See e_CBase constants).
  • @param iExtraOffset The extra offset.
  • @return Value from private data. (integer)

wpnmod_default_deploy

Default deploy function.

native wpnmod_default_deploy(const iItem, const szViewModel[], const szWeaponModel[], const iAnim, const szAnimExt[]);
  • @param iItem Weapon's entity index.
  • @param szViewModel Weapon's view model (V).
  • @param szWeaponModel Weapon's player model (P).
  • @param iAnim Sequence number of deploy animation.
  • @param szAnimExt Animation extension.

wpnmod_default_reload

Default reload function.

native wpnmod_default_reload(const iItem, const iClipSize, const iAnim, const Float: flDelay);
  • @param iItem Weapon's entity index.
  • @param iClipSize Maximum weapon's clip size.
  • @param iAnim Sequence number of reload animation.
  • @param flDelay Reload delay time.

wpnmod_reset_empty_sound

Sets the weapon so that it can play empty sound again.

native wpnmod_reset_empty_sound(const iItem);
  • @param iItem Weapon's entity index.

wpnmod_play_empty_sound

Plays the weapon's empty sound.

native wpnmod_play_empty_sound(const iItem);
  • @param iItem Weapon's entity index.

wpnmod_fire_bullets

Выстрел из оружия.

native wpnmod_fire_bullets(const iPlayer, const iAttacker, const iShotsCount, const Float: vecSpread[3], const Float: flDistance, const Float: flDamage, const bitsDamageType, const iTracerFreq);
  • @param iPlayer Player index.
  • @param iAttacker Attacker index (usualy it equal to previous param).
  • @param iShotsCount Number of shots.
  • @param vecSpread Spread.
  • @param flDistance Max shot distance.
  • @param flDamage Damage amount.
  • @param bitsDamageType Damage type.
  • @param iTracerFreq Tracer frequancy.

wpnmod_fire_contact_grenade

Fire default contact grenade from player's weapon.

native wpnmod_fire_contact_grenade(const iPlayer, const Float: vecStart[3], const Float: vecVelocity[3], const szCallBack[] = "");
  • @param iPlayer Player index.
  • @param vecStart Start position.
  • @param vecVelocity Velocity.
  • @param szCallBack The forward to call on explode.
  • @return Contact grenade index or -1 on failure. (integer)

wpnmod_fire_timed_grenade

Fire default timed grenade from player's weapon.

native wpnmod_fire_timed_grenade(const iPlayer, const Float: vecStart[3], const Float: vecVelocity[3], const Float: flTime = 3.0, const szCallBack[] = "");
  • @param iPlayer Player index.
  • @param vecStart Start position.
  • @param vecVelocity Velocity.
  • @param flTime Time before detonate.
  • @param szCallBack The forward to call on explode.
  • @return Contact grenade index or -1 on failure. (integer)

wpnmod_radius_damage

Make damage upon entities within a certain range. Only damage ents that can clearly be seen by the explosion.

native wpnmod_radius_damage(const Float: vecSrc[3], const iInflictor, const iAttacker, const Float: flDamage, const Float: flRadius, const iClassIgnore, const bitsDamageType);
  • @param vecSrc Origin of explosion.
  • @param iInflictor Entity which causes the damage impact.
  • @param iAttacker Attacker index.
  • @param flDamage Damage amount.
  • @param flRadius Damage radius.
  • @param iClassIgnore Class to ignore.
  • @param bitsDamageType Damage type (DMG_BLAST and etc).

wpnmod_radius_damage2

Same as wpnmod_radius_damage, but blocks 'ghost mines' and 'ghost nades'.

native wpnmod_radius_damage2(const Float: vecSrc[3], const iInflictor, const iAttacker, const Float: flDamage, const Float: flRadius, const iClassIgnore, const bitsDamageType);
  • @param vecSrc Origin of explosion.
  • @param iInflictor Entity which causes the damage impact.
  • @param iAttacker Attacker index.
  • @param flDamage Damage amount.
  • @param flRadius Damage radius.
  • @param iClassIgnore Class to ignore.
  • @param bitsDamageType Damage type (DMG_BLAST and etc).

wpnmod_clear_multi_damage

Resets the global multi damage accumulator.

native wpnmod_clear_multi_damage();

wpnmod_apply_multi_damage

Inflicts contents of global multi damage register on entity.

native wpnmod_apply_multi_damage(const iInflictor, const iAttacker);
  • @param iInflictor Entity which causes the damage impact.
  • @param iAttacker Attacker index.

wpnmod_eject_brass

Eject a brass from player's weapon.

native wpnmod_eject_brass(const iPlayer, const iShellModelIndex, const iSoundtype, const Float: flForwardScale, const Float: flUpScale, const Float: flRightScale);
  • @param iPlayer Player index.
  • @param iShellModelIndex Index of precached shell's model.
  • @param iSoundtype Bounce sound type (see defines).
  • @param flForwardScale Forward scale value.
  • @param flUpScale Up scale value.
  • @param flRightScale Right scale value.

wpnmod_create_item

Spawn an item by name.

native wpnmod_create_item(const szName[], const Float: vecOrigin[3] = {0.0, 0.0, 0.0}, const Float: vecAngles[3] = {0.0, 0.0, 0.0});
  • @param szName Item's name.
  • @param vecOrigin Origin were to spawn.
  • @param vecAngles Angles.
  • @return Item entity index or -1 on failure. (integer)

wpnmod_get_player_ammo

Получает количество патронов заданного типа у игрока.

native wpnmod_get_player_ammo(const iPlayer, const szAmmoName[]);
  • @param iPlayer Player id.
  • @param szAmmoName Ammo type. ("9mm", "uranium", "MY_AMMO" etc..)
  • @return Amount of given ammo. (integer)

wpnmod_set_player_ammo

Set player's ammo inventory.

native wpnmod_set_player_ammo(const iPlayer, const szAmmoName[], const iAmount);
  • @param iPlayer Player id.
  • @param szAmmoName Ammo type. ("9mm", "uranium", "MY_AMMO" etc..)
  • @param iAmount Ammo amount.

wpnmod_get_damage_decal

Returns index of random damage decal for given entity.

native wpnmod_get_damage_decal(const iEntity);
  • @param iEntity Entity.
  • @return Index of damage decal. (integer)

wpnmod_get_gun_position

Get player's gun position. Result will set in vecResult.

native wpnmod_get_gun_position(const iPlayer, Float: vecResult[3], const Float: flForwardScale = 1.0, const Float: flRightScale = 1.0, const Float: flUpScale = 1.0);
  • @param iPlayer Player index.
  • @param vecResult Calculated gun position.
  • @param flForwardScale Forward scale value.
  • @param flUpScale Up scale value.
  • @param flRightScale Right scale value.

wpnmod_explode_entity

Explode and then remove entity.

native wpnmod_explode_entity(const iEntity, const bitsDamageType = 0, const szCallBack[] = "");

wpnmod_decal_trace

Draw decal by index or name on trace end.

native wpnmod_decal_trace(const iTrace, const iDecalIndex = -1, const szDecalName[] = "");
  • @param iTrace Trace handler.
  • @param iDecalIndex Decal index.
  • @param szDecalName Decal name.

wpnmod_trace_texture

Detects the texture of an entity from a direction.

native wpnmod_trace_texture(const iEntity, const Float: vecSrc[3], const Float: vecEnd[3], szTextureName[], const iLen);
  • @param iEntity Entity index that we want to get the texture.
  • @param vecSrc The point from where the trace starts.
  • @param vecEnd The point where the trace ends.
  • @param szTextureName Buffer to save the texture name.
  • @param iLen Buffer's length.