Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
- Ошибка
-
предупреждение
scripting\reapi_sillyc4.sma(157) : warning 213: tag mismatch
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <reapi>
#include <xs>
#define FEATURE_SPEED // walking speed while planting/defusing the bomb
#define FEATURE_WALL // Allows plant on walls
#define FEATURE_NUMBERS // random numbers while defusing
#if defined FEATURE_NUMBERS
const MAX_NUMBERS_NUM = 11;
new const DEFUSING_SOUND[] = "weapons/c4_click.wav";
#endif
#if defined FEATURE_SPEED
new HamHook:FwdC4PrimaryAttack;
#endif
#if defined FEATURE_NUMBERS
new HookChain:FwdPlayerPreThink;
new Number, Numbers[MAX_NUMBERS_NUM], Float:NextDelay, HudSync;
#endif
#if defined FEATURE_NUMBERS
public plugin_precache() {
precache_sound(DEFUSING_SOUND)
}
#endif
public plugin_init() {
register_plugin("[ReAPI] Silly C4", "2.0", "F@ntoM & Cheap_Suit");
#if defined FEATURE_SPEED
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_c4", "CWeapon_PrimaryAttack_Pre", false);
FwdC4PrimaryAttack = RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_c4", "CWeapon_PrimaryAttack_Post", true);
DisableHamForward(FwdC4PrimaryAttack);
#endif
#if defined FEATURE_WALL
RegisterHookChain(RG_PlantBomb, "PlantBomb", true);
#endif
#if defined FEATURE_WALL || defined FEATURE_NUMBERS
RegisterHookChain(RG_CGrenade_DefuseBombStart, "CGrenade_DefuseBombStart", true);
#endif
#if defined FEATURE_NUMBERS
RegisterHookChain(RG_CGrenade_DefuseBombEnd, "CGrenade_DefuseBombEnd", true);
FwdPlayerPreThink = RegisterHookChain(RG_CBasePlayer_PreThink, "CBasePlayer_PreThink", true);
DisableHookChain(FwdPlayerPreThink);
HudSync = CreateHudSyncObj();
#endif
}
#if defined FEATURE_SPEED
public CWeapon_PrimaryAttack_Pre(const weapon) {
new id = get_member(weapon, m_pPlayer);
if (
is_user_alive(id)
&& !get_member(weapon, m_C4_bStartedArming)
&& inBombZone(id)
&& (get_entvar(id, var_flags) & FL_ONGROUND) == FL_ONGROUND
) {
EnableHamForward(FwdC4PrimaryAttack);
}
}
public CWeapon_PrimaryAttack_Post(const weapon) {
DisableHamForward(FwdC4PrimaryAttack);
set_entvar(get_member(weapon, m_pPlayer), var_maxspeed, 250.0);
}
#endif
#if defined FEATURE_WALL
public PlantBomb(const id, const Float:vecStart[3]) {
new ent = GetHookChainReturn(ATYPE_INTEGER);
if (is_nullent(ent)) {
return HC_CONTINUE;
}
new Float:velocity[3];
velocity_by_aim(id, 54, velocity);
if (velocity[2] < -28.0) {
return HC_CONTINUE;
}
new Float:traceEnd[3];
xs_vec_add(velocity, vecStart, traceEnd);
new Float:traceResult[3];
trace_line(id, vecStart, traceEnd, traceResult)
new Float:normal[3]
if (trace_normal(id, vecStart, traceEnd, normal) < 1) {
return HC_CONTINUE;
}
new Float:newVecStart[3];
newVecStart[0] = traceResult[0] + (normal[0] * -0.01);
newVecStart[1] = traceResult[1] + (normal[1] * -0.01);
newVecStart[2] = traceResult[2] + normal[2] + 8.000;
set_entvar(ent, var_origin, newVecStart);
new Float:angles[3]
vector_to_angle(normal, angles);
angles[0] -= 180.0;
angles[1] -= 90.0;
angles[2] -= 90.0;
set_entvar(ent, var_angles, angles);
set_entvar(ent, var_movetype, MOVETYPE_FLY);
return HC_CONTINUE;
}
#endif
public CGrenade_DefuseBombStart(const ent, const id) {
#if defined FEATURE_SPEED
if (is_user_alive(id)) {
set_entvar(id, var_maxspeed, 250.0);
}
#endif
#if defined FEATURE_NUMBERS
Number = 0;
NextDelay = get_gametime();
for (new i = 0; i < MAX_NUMBERS_NUM; i++) {
Numbers[i] = random_num(0, 9);
}
EnableHookChain(FwdPlayerPreThink);
#endif
}
#if defined FEATURE_NUMBERS
public CGrenade_DefuseBombEnd() {
DisableHookChain(FwdPlayerPreThink);
}
public CBasePlayer_PreThink(const id) {
if (!is_user_alive(id) || !get_member(id, m_bIsDefusing)) {
return HC_CONTINUE;
}
new Float:gameTime = get_gametime();
if (NextDelay + getDelay(id) < gameTime) {
rg_send_audio(id, DEFUSING_SOUND);
Number = min(Number + 1, MAX_NUMBERS_NUM - 1);
NextDelay = gameTime;
}
new message[MAX_NUMBERS_NUM], i = 0;
for (i = 0; i <= Number; i++) {
message[i] = Numbers[i] + '0';
}
for (i = Number + 1; i < MAX_NUMBERS_NUM; i++) {
message[i] = random_num(0, 9) + '0';
}
message[MAX_NUMBERS_NUM - 1] = EOS;
set_hudmessage(255, 255, 255, -1.0, 0.4, 0, 0.0, 10.0, 0.0, 0.0, 2);
ShowSyncHudMsg(id, HudSync, message);
return HC_CONTINUE;
}
#endif
stock bool:inBombZone(const id){
new signals[UnifiedSignals];
get_member(id, m_signals, signals);
return bool:(SignalState:signals[US_State] & SIGNAL_BOMB);
}
stock Float:getDelay(const id) {
return get_member(id, m_bHasDefuser) ? 0.4999 : 0.9999;
}
ребят помогите убрать предупреждение тега