Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
точно твоё авторство?)
Créé
il y a 7 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
259 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
385 lignes
Copier tout
268 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
398 lignes
Copier tout
Copier
Copié
Copier
Copié
/**
* Copyright (C) Dev-CS Team, 2018
*
* This software is licensed under the GNU General Public License, version 3 or higher.
* Additional exceptions apply. For full license details, see LICENSE.txt or visit:
* https://alliedmods.net/amxmodx-license
*
* Description:
* This plugin add a new grenade item to game names as 'HealthNade'.
* The grenade will give additional health of allies (or all) nearby.
*
* Changelog:
* - 0.0.1 (20.11.17):
* - Init;
* - 0.0.2 (23.11.17):
* - FIX: AMXX 1.8.2 compilation;
* - Removed HamSandwich module.
* - 0.0.3 (25.12.17):
* - FIX: some bugs with 'emessage' flood; (Thanks to Mistrick)
* - Removed AMXX 1.8.2 support;
* - 0.0.4 (09.08.18):
* - FIX: The blinding effect is no longer reset;
* - Add: ScreenFade effect settings;
* - Add: Customisable models use (on/off);
* - Rework function for restrict item;
* - Simply API: SHN_S(G)etStatus (realy nned it?!);
*
* TODO:
* - Change the principle of the replacement Item (smart replacement).
*
* Credits: Arkshine, https://forums.alliedmods.net/showpost.php?p=1567176&postcount=16
*/
#include <amxmodx>
#include <amxmodx>
#include <fakemeta>
#include <fakemeta>
#include <engine>
#include <engine>
#include <fun>
#include <fun>
#include <csx>
#include <csx>
Copier
Copié
Copier
Copié
/* Settings */
#pragma semicolon 1
/* Enable action only for the privileged */
// #define ACCESS_FLAGS ( ADMIN_LEVEL_H )
Copier
Copié
Copier
Copié
/* Enable action only for teammates */
new const szPluginInfo[][] = {"Smoke HealthNade", "1.1", "medusa + ApXuTekToR"};
// #define ONLY_FOR_TEAMMATES
Copier
Copié
Copier
Copié
/* Enable Screenfade effect */
#define
SUPPORT_GAMECMS
#define
EFFECT_SCREENFADE
Copier
Copié
Copier
Copié
const
HEALTH_TO_HEAL = 50;
#if defined SUPPORT_GAMECMS
const
HEALTH_MAX
=
100;
native Array:cmsapi_get_user_services(
const
index,
const
szAuth[]
=
"",
const
szService[] = "", serviceID = 0, bool:part
=
false);
const
HEAL_RADIUS
=
300;
#endif
Copier
Copié
Copier
Copié
/* You can disable those models */
#define MODEL_V
"models/
health_nade/
v_he_mk_nade.mdl"
#define MODEL_V
"models/
v_he_mk_nade.mdl"
#define MODEL_P
"models/
health_nade/
p_he_mk_nade.mdl"
#define MODEL_P
"models/
p_he_mk_nade.mdl"
#define MODEL_W
"models/
health_nade/
w_he_mk_nade.mdl"
#define MODEL_W
"models/
w_he_mk_nade.mdl"
Copier
Copié
Copier
Copié
new const SPRITE_EXPLODE1[]
= "sprites/
heal_explode.spr";
new const SPRITE_EXPLODE1[]
= "sprites/
health_nade/
heal_explode.spr";
new const SPRITE_PROS[]
= "sprites/
heal_shape.spr";
new const SPRITE_PROS[]
= "sprites/
health_nade/
heal_shape.spr";
Copier
Copié
Copier
Copié
new const SOUND_HEAL[]
= "
woomen_expr.wav";
new const SOUND_HEAL[]
= "
health_nade/
woomen_expr.wav";
/* End of settings */
enum {
enum {
Copier
Copié
Copier
Copié
XO_WEAPON = 4,
XO_WEAPON = 4,
XO_CGRENADE
= 5,
XO_CGRENADE
= 5,
m_pPlayer = 41,
m_pPlayer = 41,
m_usEvent = 114
m_usEvent = 114
}
}
new const EXCLASS[] = "grenade";
new const EXCLASS[] = "grenade";
enum { STATUSICON_HIDE = 0, STATUSICON_FLASH = 2 };
enum { STATUSICON_HIDE = 0, STATUSICON_FLASH = 2 };
const flagSmokeEvent = (1 << 1);
const flagSmokeEvent = (1 << 1);
Copier
Copié
Copier
Copié
#define IsSgGrenade(%1)
(get_pdata_int(%1, m_usEvent, XO_CGRENADE) & flagSmokeEvent)
#define IsSgGrenade(%1)
(get_pdata_int(%1, m_usEvent, XO_CGRENADE) & flagSmokeEvent)
#define _GetEntOwner(%1) pev(%1, pev_owner)
#define _GetEntOwner(%1) pev(%1, pev_owner)
#define _GetEntOrigin(%1,%2) pev(%1, pev_origin, %2)
#define _GetEntOrigin(%1,%2) pev(%1, pev_origin, %2)
#define _SetViewModel(%1,%2) set_pev(%1, pev_viewmodel2, %2)
#define _SetViewModel(%1,%2) set_pev(%1, pev_viewmodel2, %2)
Copier
Copié
Copier
Copié
#define _SetWeaponModel(%1,%2)
set_pev(%1, pev_weaponmodel2, %2)
#define _SetWeaponModel(%1,%2)
set_pev(%1, pev_weaponmodel2, %2)
#define _SetWorldModel(%1,%2)
engfunc(EngFunc_SetModel, %1, %2)
#define _SetWorldModel(%1,%2)
engfunc(EngFunc_SetModel, %1, %2)
Copier
Copié
Copier
Copié
#define _RemoveEntity(%1)
engfunc(EngFunc_RemoveEntity, %1)
#define _RemoveEntity(%1)
engfunc(EngFunc_RemoveEntity, %1)
Copier
Copié
Copier
Copié
#define _get_blindStartTime(%1)
get_ent_data_float(%1, "CBasePlayer", "m_blindStartTime")
#define _get_blindStartTime(%1)
get_ent_data_float(%1, "CBasePlayer", "m_blindStartTime")
#define _get_blindFadeTime(%1)
get_ent_data_float(%1, "CBasePlayer", "m_blindFadeTime")
#define _get_blindFadeTime(%1)
get_ent_data_float(%1, "CBasePlayer", "m_blindFadeTime")
#if AMXX_VERSION_NUM < 183
#if AMXX_VERSION_NUM < 183
Copier
Copié
Copier
Copié
#error [ERROR]: AMXX 1.8.2 - not supported (cuz use new fakemeta natives)!
#error [ERROR]: AMXX 1.8.2 - not supported (cuz use new fakemeta natives)!
#endif
#endif
new g_MsgId_StatusIcon, g_MsgId_ScreenFade;
new g_MsgId_StatusIcon, g_MsgId_ScreenFade;
new g_pFirstExplosion,
new g_pFirstExplosion,
Copier
Copié
Copier
Copié
g_pPros,
g_pPros,
g_pCircle;
g_pCircle;
enum status_s { status_DISABLED = 0, status_ENABLED = 1 };
enum status_s { status_DISABLED = 0, status_ENABLED = 1 };
new status_s: g_bCanUseItem = status_ENABLED;
new status_s: g_bCanUseItem = status_ENABLED;
Copier
Copié
Copier
Copié
new const VERSION[] = "0.0.4"
;
enum e_cvars {
c_AccessUse_Nade,
c_AccessFlags[16],
c_AccessServices[32],
c_HealTeammates_Or_All,
c_GiveHealth_Num,
c_GiveHealth_Limite,
c_GiveHealth_Radius,
c_ScreenFade_Effects,
}
new cvars[e_cvars]
;
public plugin_natives()
public plugin_natives()
{
{
Copier
Copié
Copier
Copié
register_native("SHN_SetStatus", "native__SetStatus", .style = 0);
register_native("SHN_SetStatus", "native__SetStatus", .style = 0);
register_native("SHN_GetStatus", "native__GetStatus", .style = 0);
register_native("SHN_GetStatus", "native__GetStatus", .style = 0);
}
}
public plugin_init() {
public plugin_init() {
Copier
Copié
Copier
Copié
register_plugin("Smoke: HealthNade", VERSION
, "
wopox1337
");
g_MsgId_StatusIcon = get_user_msgid("StatusIcon");
g_MsgId_ScreenFade = get_user_msgid("ScreenFade");
register_touch(EXCLASS, "*", "CGrenade_ExplodeTouch");
register_event("CurWeapon", "Event_CurWeapon"
, "
be", "1=1
");
initCvars();
Copier
Copié
Copier
Copié
g_MsgId_StatusIcon = get_user_msgid("StatusIcon");
register_srvcmd("HealthNade_lockmap", "Check_LockMap");
g_MsgId_ScreenFade = get_user_msgid("ScreenFade");
Copier
Copié
Copier
Copié
register_touch(EXCLASS, "*", "CGrenade_ExplodeTouch");
new szConfigsDir[256];
get_localinfo("amxx_configsdir", szConfigsDir, charsmax(szConfigsDir));
server_cmd("exec %s/SevCorp/HelthNade.cfg", szConfigsDir);
server_exec();
}
Copier
Copié
Copier
Copié
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1");
#if defined SUPPORT_GAMECMS
public plugin_cfg() {
if(is_plugin_loaded("GameCMS_API") == INVALID_PLUGIN_ID)
{
log_amx("WARNING: gamecms_api.amxx isn't loaded! Plugin Stopped.");
pause("a");
return;
}
}
}
Copier
Copié
Copier
Copié
#endif
public plugin_precache() {
public plugin_precache() {
Copier
Copié
Copier
Copié
#if defined MODEL_V
register_plugin(szPluginInfo[0], szPluginInfo[1], szPluginInfo[2]);
precache_model(MODEL_V);
precache_model(MODEL_V);
#endif
precache_model(MODEL_P);
#if defined MODEL_P
precache_model(MODEL_W);
precache_model(MODEL_P);
g_pFirstExplosion = precache_model(SPRITE_EXPLODE1);
g_pPros = precache_model(SPRITE_PROS);
g_pCircle = precache_model("sprites/shockwave.spr");
precache_sound(SOUND_HEAL);
}
public initCvars() {
register_cvar("HelthGrenade_AccessUse_Nade", "0");
register_cvar("HelthGrenade_AccessFlags", "m");
#if defined SUPPORT_GAMECMS
register_cvar("HelthGrenade_AccessServices", "_healthnade");
#endif
#endif
Copier
Copié
Copier
Copié
#if defined MODEL_W
register_cvar("HelthGrenade_HealTeammates_Or_All", "0");
precache_model(MODEL_W);
register_cvar("HelthGrenade_GiveHealth_Num", "50");
register_cvar("HelthGrenade_GiveHealth_Limite", "110");
register_cvar("HelthGrenade_GiveHealth_Radius", "300");
register_cvar("HelthGrenade_ScreenFade_Effects", "1");
get_cvar_string("HelthGrenade_AccessFlags", cvars[c_AccessFlags], charsmax(cvars[c_AccessFlags]));
#if defined SUPPORT_GAMECMS
get_cvar_string("HelthGrenade_AccessServices", cvars[c_AccessServices], charsmax(cvars[c_AccessServices]));
#endif
#endif
Copier
Copié
Copier
Copié
cvars[c_AccessUse_Nade] = get_cvar_num("HelthGrenade_AccessUse_Nade");
g_pFirstExplosion = precache_model(SPRITE_EXPLODE1);
cvars[c_HealTeammates_Or_All] = get_cvar_num("HelthGrenade_HealTeammates_Or_All");
g_pPros = precache_model(SPRITE_PROS);
g_pCircle = precache_model("sprites/shockwave.spr");
Copier
Copié
Copier
Copié
precache_sound(SOUND_HEAL);
cvars[c_GiveHealth_Num] = get_cvar_num("HelthGrenade_GiveHealth_Num");
cvars[c_GiveHealth_Limite] = get_cvar_num("HelthGrenade_GiveHealth_Limite");
cvars[c_GiveHealth_Radius] = get_cvar_num("HelthGrenade_GiveHealth_Radius");
cvars[c_ScreenFade_Effects] = get_cvar_num("HelthGrenade_ScreenFade_Effects");
}
}
public Event_CurWeapon(pPlayer) {
public Event_CurWeapon(pPlayer) {
Copier
Copié
Copier
Copié
enum { WeaponID = 2 };
enum { WeaponID = 2 };
if(read_data(WeaponID) == CSW_SMOKEGRENADE)
{
if(read_data(WeaponID) == CSW_SMOKEGRENADE)
{
if(!IsAllowedToUse(pPlayer)) return;
if(!IsAllowedToUse(pPlayer)) return;
OnPlayer_SetViewModels(pPlayer);
#if defined MODEL_V
Send_StatusIcon__Cross(pPlayer);
OnPlayer_SetViewModels(pPlayer);
}
else Send_StatusIcon__Cross(pPlayer, .status = STATUSICON_HIDE);
#endif
Send_StatusIcon__Cross(pPlayer);
}
else Send_StatusIcon__Cross(pPlayer, .status = STATUSICON_HIDE);
}
}
public grenade_throw(pPlayer, pEnt, w_id) {
public grenade_throw(pPlayer, pEnt, w_id) {
Copier
Copié
Copier
Copié
if(w_id != CSW_SMOKEGRENADE)
if(w_id != CSW_SMOKEGRENADE)
return;
return;
Copier
Copié
Copier
Copié
if(!IsAllowedToUse(pPlayer))
if(!IsAllowedToUse(pPlayer))
return;
return;
Copier
Copié
Copier
Copié
#if defined MODEL_W
OnGrenade_SetWorldModel(pEnt);
OnGrenade_SetWorldModel(pEnt);
#endif
}
}
public CGrenade_ExplodeTouch(const pEnt, const pOther) {
public CGrenade_ExplodeTouch(const pEnt, const pOther) {
Copier
Copié
Copier
Copié
// Filter to another grenades type
if(!IsSgGrenade(pEnt))
if(!IsSgGrenade(pEnt))
return;
return;
static iOwner; iOwner = _GetEntOwner(pEnt);
if(!IsAllowedToUse(iOwner))
return;
static Float: fOrigin[3], iOrigin[3];
_GetEntOrigin(pEnt, fOrigin);
FVecIVec(fOrigin, iOrigin);
Copier
Copié
Copier
Copié
// Show visuals
static iOwner; iOwner = _GetEntOwner
(pEnt);
Send_Explode(iOrigin);
Send_Pros(iOrigin);
Send_ShockWave(iOrigin);
OnGrenade_PlaySound
(pEnt);
Copier
Copié
Copier
Copié
// Removed default smoke entity, and his detonate event accordingly
if(!IsAllowedToUse(iOwner))
OnGrenade_RemoveByTouch(pEnt);
return;
Copier
Copié
Copier
Copié
// Action on near players
static Float: fOrigin[3], iOrigin[3];
HealPlayersOnRadius(iOwner, fOrigin);
_GetEntOrigin(pEnt, fOrigin);
FVecIVec(fOrigin, iOrigin);
Send_Explode(iOrigin);
Send_Pros(iOrigin);
Send_ShockWave(iOrigin);
OnGrenade_PlaySound(pEnt);
OnGrenade_RemoveByTouch(pEnt);
HealPlayersOnRadius(iOwner, fOrigin);
}
}
stock HealPlayersOnRadius(pInflictor, Float: fOrigin[3]) {
stock HealPlayersOnRadius(pInflictor, Float: fOrigin[3]) {
Copier
Copié
Copier
Copié
for(new pPlayer = 1; pPlayer <= MaxClients; pPlayer++) {
for(new pPlayer = 1; pPlayer <= MaxClients; pPlayer++) {
if(is_user_alive(pPlayer)) {
if(is_user_alive(pPlayer)) {
Copier
Copié
Copier
Copié
#if !defined ONLY_FOR_TEAMMATES
if(cvars[c_HealTeammates_Or_All] == 1) {
if(get_user_team(pInflictor) != get_user_team(pPlayer))
if(get_user_team(pInflictor) != get_user_team(pPlayer))
continue;
continue;
#endif
}
#pragma unused pInflictor
Copier
Copié
Copier
Copié
static Float: playerOrigin[3];
#pragma unused pInflictor
_GetEntOrigin(pPlayer, playerOrigin);
Copier
Copié
Copier
Copié
if(get_distance_f(fOrigin, playerOrigin) <
HEAL_RADIUS)
static Float: playerOrigin[3];
OnPlayer_HealEvent(pPlayer);
_GetEntOrigin(pPlayer, playerOrigin);
}
}
if(get_distance_f(fOrigin, playerOrigin) <
cvars[c_GiveHealth_Radius])
OnPlayer_HealEvent(pPlayer);
}
}
}
}
stock OnPlayer_HealEvent(const pPlayer) {
stock OnPlayer_HealEvent(const pPlayer) {
Copier
Copié
Copier
Copié
set_user_health(pPlayer,
min
(get_user_health(pPlayer) +
HEALTH_TO_HEAL, HEALTH_MAX));
if((get_user_health(pPlayer) + cvars[c_GiveHealth_Num]) < cvars[c_GiveHealth_Limite]) {
set_user_health(pPlayer,
(get_user_health(pPlayer) + cvars[c_GiveHealth_Num]));
} else if(
(get_user_health(pPlayer) +
cvars[c_GiveHealth_Num]) >= cvars[c_GiveHealth_Limite]) {
set_user_health(pPlayer, cvars[c_GiveHealth_Limite]);
}
Copier
Copié
Copier
Copié
#if defined EFFECT_SCREENFADE
if(cvars[c_ScreenFade_Effects] == 1) {
if(!IsBlind(pPlayer))
if(!IsBlind(pPlayer))
__UTIL_ScreenFade(pPlayer);
__UTIL_ScreenFade(pPlayer);
}
#endif
}
}
Copier
Copié
Copier
Copié
#if (defined MODEL_V || defined MODEL_P)
stock OnPlayer_SetViewModels(const pPlayer) {
stock OnPlayer_SetViewModels(const pPlayer) {
Copier
Copié
Copier
Copié
#if defined MODEL_V
_SetViewModel(pPlayer, MODEL_V);
_SetViewModel(pPlayer, MODEL_V);
_SetWeaponModel(pPlayer, MODEL_P);
#endif
#if defined MODEL_P
_SetWeaponModel(pPlayer, MODEL_P);
#endif
}
}
Copier
Copié
Copier
Copié
#endif
stock OnGrenade_SetWorldModel(const pEnt)
stock OnGrenade_SetWorldModel(const pEnt)
Copier
Copié
Copier
Copié
_SetWorldModel(pEnt, MODEL_W);
_SetWorldModel(pEnt, MODEL_W);
stock OnGrenade_RemoveByTouch(const pEnt)
stock OnGrenade_RemoveByTouch(const pEnt)
Copier
Copié
Copier
Copié
_RemoveEntity(pEnt);
_RemoveEntity(pEnt);
stock Send_StatusIcon__Cross(const pPlayer, status = STATUSICON_FLASH) {
stock Send_StatusIcon__Cross(const pPlayer, status = STATUSICON_FLASH) {
Copier
Copié
Copier
Copié
message_begin(MSG_ONE_UNRELIABLE, g_MsgId_StatusIcon, .player = pPlayer);
message_begin(MSG_ONE_UNRELIABLE, g_MsgId_StatusIcon, .player = pPlayer);
write_byte(status);
write_byte(status);
write_string("cross");
write_string("cross");
write_byte(0);
write_byte(0);
write_byte(255);
write_byte(255);
write_byte(0);
write_byte(0);
message_end();
message_end();
}
}
stock OnGrenade_PlaySound(const pEnt)
stock OnGrenade_PlaySound(const pEnt)
Copier
Copié
Copier
Copié
engfunc(EngFunc_EmitSound, pEnt, CHAN_WEAPON, SOUND_HEAL, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
engfunc(EngFunc_EmitSound, pEnt, CHAN_WEAPON, SOUND_HEAL, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
stock Send_Explode(iOrigin[3]) {
stock Send_Explode(iOrigin[3]) {
Copier
Copié
Copier
Copié
emessage_begin(MSG_PVS, SVC_TEMPENTITY);
emessage_begin(MSG_PVS, SVC_TEMPENTITY);
ewrite_byte(TE_EXPLOSION);
ewrite_byte(TE_EXPLOSION);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[2] + 65);
ewrite_coord(iOrigin[2] + 65);
ewrite_short(g_pFirstExplosion);
ewrite_short(g_pFirstExplosion);
ewrite_byte(30);
ewrite_byte(30);
ewrite_byte(20);
ewrite_byte(20);
ewrite_byte(TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES);
ewrite_byte(TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES);
emessage_end();
emessage_end();
}
}
stock Send_Pros(iOrigin[3]) {
stock Send_Pros(iOrigin[3]) {
Copier
Copié
Copier
Copié
emessage_begin(MSG_PVS, SVC_TEMPENTITY);
emessage_begin(MSG_PVS, SVC_TEMPENTITY);
ewrite_byte(TE_SPRITETRAIL);
ewrite_byte(TE_SPRITETRAIL);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[2] + 20);
ewrite_coord(iOrigin[2] + 20);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[2] + 80);
ewrite_coord(iOrigin[2] + 80);
ewrite_short(g_pPros);
ewrite_short(g_pPros);
ewrite_byte(20);
ewrite_byte(20);
ewrite_byte(20);
ewrite_byte(20);
ewrite_byte(4);
ewrite_byte(4);
ewrite_byte(20);
ewrite_byte(20);
ewrite_byte(10);
ewrite_byte(10);
emessage_end();
emessage_end();
}
}
stock Send_ShockWave(iOrigin[3]) {
stock Send_ShockWave(iOrigin[3]) {
Copier
Copié
Copier
Copié
emessage_begin(MSG_PVS, SVC_TEMPENTITY);
emessage_begin(MSG_PVS, SVC_TEMPENTITY);
ewrite_byte(TE_BEAMCYLINDER);
ewrite_byte(TE_BEAMCYLINDER);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[2]);
ewrite_coord(iOrigin[2]);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[0]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[1]);
ewrite_coord(iOrigin[2] +
HEAL_RADIUS
);
ewrite_coord(iOrigin[2] +
cvars[c_GiveHealth_Radius]
);
ewrite_short(g_pCircle);
ewrite_short(g_pCircle);
ewrite_byte(0);
ewrite_byte(0);
ewrite_byte(1);
ewrite_byte(1);
ewrite_byte(5);
ewrite_byte(5);
ewrite_byte(30);
ewrite_byte(30);
ewrite_byte(1);
ewrite_byte(1);
ewrite_byte(10);
ewrite_byte(10);
ewrite_byte(255);
ewrite_byte(255);
ewrite_byte(40);
ewrite_byte(40);
ewrite_byte(255);
ewrite_byte(255);
ewrite_byte(5);
ewrite_byte(5);
emessage_end();
emessage_end();
}
}
stock __UTIL_ScreenFade(const pPlayer, iColor[3] = {170, 255, 0}, iAlpha = 80, Float: flFxTime = 1.0, Float: flHoldTime = 0.3) {
stock __UTIL_ScreenFade(const pPlayer, iColor[3] = {170, 255, 0}, iAlpha = 80, Float: flFxTime = 1.0, Float: flHoldTime = 0.3) {
Copier
Copié
Copier
Copié
const FFADE_IN = 0x0000;
const FFADE_IN = 0x0000;
Copier
Copié
Copier
Copié
emessage_begin(MSG_ONE_UNRELIABLE, g_MsgId_ScreenFade, .player = pPlayer);
emessage_begin(MSG_ONE_UNRELIABLE, g_MsgId_ScreenFade, .player = pPlayer);
ewrite_short(FixedUnsigned16(flFxTime));
ewrite_short(FixedUnsigned16(flFxTime));
ewrite_short(FixedUnsigned16(flHoldTime));
ewrite_short(FixedUnsigned16(flHoldTime));
ewrite_short(FFADE_IN);
ewrite_short(FFADE_IN);
ewrite_byte(iColor[0]);
ewrite_byte(iColor[0]);
ewrite_byte(iColor[1]);
ewrite_byte(iColor[1]);
ewrite_byte(iColor[2]);
ewrite_byte(iColor[2]);
ewrite_byte(iAlpha);
ewrite_byte(iAlpha);
emessage_end();
emessage_end();
}
}
stock FixedUnsigned16(Float:flValue, iScale = (1 << 12)) {
stock FixedUnsigned16(Float:flValue, iScale = (1 << 12)) {
Copier
Copié
Copier
Copié
return clamp(floatround(flValue * iScale), 0, 0xFFFF);
return clamp(floatround(flValue * iScale), 0, 0xFFFF);
}
stock IsUserHaveAccessToUse(const pPlayer) {
// Anytime we can add other checks like cached bool
return (get_user_flags(pPlayer) & ACCESS_FLAGS);
}
}
bool: IsAllowedToUse(pPlayer) {
bool: IsAllowedToUse(pPlayer) {
#pragma unused pPlayer
#pragma unused pPlayer
Copier
Copié
Copier
Copié
#if defined ACCESS_FLAGS
if(cvars[c_AccessUse_Nade] == 1) {
if(!IsUserHaveAccessToUse(pPlayer)) {
if(!(checkAccess(pPlayer, cvars[c_AccessFlags]))) {
return false;
return false;
}
}
}
#if defined SUPPORT_GAMECMS
else if(cvars[c_AccessUse_Nade] == 2) {
static Array:Services;
Services = cmsapi_get_user_services(pPlayer, "", cvars[c_AccessServices]);
if(!Services) {
return false;
}
}
#endif
#endif
Copier
Copié
Copier
Copié
if(g_bCanUseItem == status_DISABLED) {
if(g_bCanUseItem == status_DISABLED) {
//
client_print_color(pPlayer, print_team_
red
, "^3
You no may use this grenade now
!");
client_print_color(pPlayer, print_team_
default
, "^3
[^4Nade^3] ^1Лечебная граната выключена^4
!");
return false;
return false;
}
}
return true;
// Also you can add another conditions there...
return true;
}
}
stock bool: IsBlind(pPlayer) {
stock bool: IsBlind(pPlayer) {
Copier
Copié
Copier
Copié
return bool:(Float: _get_blindStartTime(pPlayer) + Float: _get_blindFadeTime(pPlayer) >= get_gametime());
return bool:(Float: _get_blindStartTime(pPlayer) + Float: _get_blindFadeTime(pPlayer) >= get_gametime());
}
checkAccess(const pPlayer, const flags[]){
return (get_user_flags(pPlayer) & read_flags(flags));
}
}
/* API?! */
/* API?! */
/**
/**
* Set item status to use.
* Set item status to use.
*
*
* @note Usage examples:
* @note Usage examples:
* SHN_SetStatus(1);
* SHN_SetStatus(1);
*
*
* @param status: 1 - enabled / 0 - disabled
* @param status: 1 - enabled / 0 - disabled
*
*
* @noreturn
* @noreturn
*/
*/
Copier
Copié
Copier
Copié
// native SHN_SetStatus(status)
// native SHN_SetStatus(status)
public native__SetStatus(plugin_id, argc)
public native__SetStatus(plugin_id, argc)
{
{
Copier
Copié
Copier
Copié
enum { arg_status = 1 };
enum { arg_status = 1 };
Copier
Copié
Copier
Copié
g_bCanUseItem = get_param(arg_status) == 1 ? status_ENABLED : status_DISABLED;
g_bCanUseItem = get_param(arg_status) == 1 ? status_ENABLED : status_DISABLED;
}
}
/**
/**
* Retrieves the item status to use.
* Retrieves the item status to use.
*
*
* @note Usage examples:
* @note Usage examples:
* SHN_GetStatus();
* SHN_GetStatus();
*
*
* @return Current status: 1 - enabled / 0 - disabled
* @return Current status: 1 - enabled / 0 - disabled
*/
*/
Copier
Copié
Copier
Copié
// native SHN_GetStatus()
// native SHN_GetStatus()
public native__GetStatus(plugin_id, argc)
public native__GetStatus(plugin_id, argc)
{
{
Copier
Copié
Copier
Copié
return g_bCanUseItem == status_ENABLED ? status_ENABLED : status_DISABLED;
return g_bCanUseItem == status_ENABLED ? status_ENABLED : status_DISABLED;
}
/* ============= Блокировка карт =========================== */
public Check_LockMap()
{
new getmap[32], map[32];
read_args(getmap, charsmax(getmap));
remove_quotes(getmap);
get_mapname(map, charsmax(map));
if(!strcmp(getmap, map, true))
{
pause("ad");
}
}
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
/** * Copyright (C) Dev-CS Team, 2018 * * This software is licensed under the GNU General Public License, version 3 or higher. * Additional exceptions apply. For full license details, see LICENSE.txt or visit: * https://alliedmods.net/amxmodx-license * * Description: * This plugin add a new grenade item to game names as 'HealthNade'. * The grenade will give additional health of allies (or all) nearby. * * Changelog: * - 0.0.1 (20.11.17): * - Init; * - 0.0.2 (23.11.17): * - FIX: AMXX 1.8.2 compilation; * - Removed HamSandwich module. * - 0.0.3 (25.12.17): * - FIX: some bugs with 'emessage' flood; (Thanks to Mistrick) * - Removed AMXX 1.8.2 support; * - 0.0.4 (09.08.18): * - FIX: The blinding effect is no longer reset; * - Add: ScreenFade effect settings; * - Add: Customisable models use (on/off); * - Rework function for restrict item; * - Simply API: SHN_S(G)etStatus (realy nned it?!); * * TODO: * - Change the principle of the replacement Item (smart replacement). * * Credits: Arkshine, https://forums.alliedmods.net/showpost.php?p=1567176&postcount=16 */ #include <amxmodx> #include <fakemeta> #include <engine> #include <fun> #include <csx> /* Settings */ /* Enable action only for the privileged */ // #define ACCESS_FLAGS ( ADMIN_LEVEL_H ) /* Enable action only for teammates */ // #define ONLY_FOR_TEAMMATES /* Enable Screenfade effect */ #define EFFECT_SCREENFADE const HEALTH_TO_HEAL = 50; const HEALTH_MAX = 100; const HEAL_RADIUS = 300; /* You can disable those models */ #define MODEL_V "models/v_he_mk_nade.mdl" #define MODEL_P "models/p_he_mk_nade.mdl" #define MODEL_W "models/w_he_mk_nade.mdl" new const SPRITE_EXPLODE1[] = "sprites/heal_explode.spr"; new const SPRITE_PROS[] = "sprites/heal_shape.spr"; new const SOUND_HEAL[] = "woomen_expr.wav"; /* End of settings */ enum { XO_WEAPON = 4, XO_CGRENADE = 5, m_pPlayer = 41, m_usEvent = 114 } new const EXCLASS[] = "grenade"; enum { STATUSICON_HIDE = 0, STATUSICON_FLASH = 2 }; const flagSmokeEvent = (1 << 1); #define IsSgGrenade(%1) (get_pdata_int(%1, m_usEvent, XO_CGRENADE) & flagSmokeEvent) #define _GetEntOwner(%1) pev(%1, pev_owner) #define _GetEntOrigin(%1,%2) pev(%1, pev_origin, %2) #define _SetViewModel(%1,%2) set_pev(%1, pev_viewmodel2, %2) #define _SetWeaponModel(%1,%2) set_pev(%1, pev_weaponmodel2, %2) #define _SetWorldModel(%1,%2) engfunc(EngFunc_SetModel, %1, %2) #define _RemoveEntity(%1) engfunc(EngFunc_RemoveEntity, %1) #define _get_blindStartTime(%1) get_ent_data_float(%1, "CBasePlayer", "m_blindStartTime") #define _get_blindFadeTime(%1) get_ent_data_float(%1, "CBasePlayer", "m_blindFadeTime") #if AMXX_VERSION_NUM < 183 #error [ERROR]: AMXX 1.8.2 - not supported (cuz use new fakemeta natives)! #endif new g_MsgId_StatusIcon, g_MsgId_ScreenFade; new g_pFirstExplosion, g_pPros, g_pCircle; enum status_s { status_DISABLED = 0, status_ENABLED = 1 }; new status_s: g_bCanUseItem = status_ENABLED; new const VERSION[] = "0.0.4"; public plugin_natives() { register_native("SHN_SetStatus", "native__SetStatus", .style = 0); register_native("SHN_GetStatus", "native__GetStatus", .style = 0); } public plugin_init() { register_plugin("Smoke: HealthNade", VERSION, "wopox1337"); g_MsgId_StatusIcon = get_user_msgid("StatusIcon"); g_MsgId_ScreenFade = get_user_msgid("ScreenFade"); register_touch(EXCLASS, "*", "CGrenade_ExplodeTouch"); register_event("CurWeapon", "Event_CurWeapon", "be", "1=1"); } public plugin_precache() { #if defined MODEL_V precache_model(MODEL_V); #endif #if defined MODEL_P precache_model(MODEL_P); #endif #if defined MODEL_W precache_model(MODEL_W); #endif g_pFirstExplosion = precache_model(SPRITE_EXPLODE1); g_pPros = precache_model(SPRITE_PROS); g_pCircle = precache_model("sprites/shockwave.spr"); precache_sound(SOUND_HEAL); } public Event_CurWeapon(pPlayer) { enum { WeaponID = 2 }; if(read_data(WeaponID) == CSW_SMOKEGRENADE) { if(!IsAllowedToUse(pPlayer)) return; #if defined MODEL_V OnPlayer_SetViewModels(pPlayer); #endif Send_StatusIcon__Cross(pPlayer); } else Send_StatusIcon__Cross(pPlayer, .status = STATUSICON_HIDE); } public grenade_throw(pPlayer, pEnt, w_id) { if(w_id != CSW_SMOKEGRENADE) return; if(!IsAllowedToUse(pPlayer)) return; #if defined MODEL_W OnGrenade_SetWorldModel(pEnt); #endif } public CGrenade_ExplodeTouch(const pEnt, const pOther) { // Filter to another grenades type if(!IsSgGrenade(pEnt)) return; static iOwner; iOwner = _GetEntOwner(pEnt); if(!IsAllowedToUse(iOwner)) return; static Float: fOrigin[3], iOrigin[3]; _GetEntOrigin(pEnt, fOrigin); FVecIVec(fOrigin, iOrigin); // Show visuals Send_Explode(iOrigin); Send_Pros(iOrigin); Send_ShockWave(iOrigin); OnGrenade_PlaySound(pEnt); // Removed default smoke entity, and his detonate event accordingly OnGrenade_RemoveByTouch(pEnt); // Action on near players HealPlayersOnRadius(iOwner, fOrigin); } stock HealPlayersOnRadius(pInflictor, Float: fOrigin[3]) { for(new pPlayer = 1; pPlayer <= MaxClients; pPlayer++) { if(is_user_alive(pPlayer)) { #if !defined ONLY_FOR_TEAMMATES if(get_user_team(pInflictor) != get_user_team(pPlayer)) continue; #endif #pragma unused pInflictor static Float: playerOrigin[3]; _GetEntOrigin(pPlayer, playerOrigin); if(get_distance_f(fOrigin, playerOrigin) < HEAL_RADIUS) OnPlayer_HealEvent(pPlayer); } } } stock OnPlayer_HealEvent(const pPlayer) { set_user_health(pPlayer, min(get_user_health(pPlayer) + HEALTH_TO_HEAL, HEALTH_MAX)); #if defined EFFECT_SCREENFADE if(!IsBlind(pPlayer)) __UTIL_ScreenFade(pPlayer); #endif } #if (defined MODEL_V || defined MODEL_P) stock OnPlayer_SetViewModels(const pPlayer) { #if defined MODEL_V _SetViewModel(pPlayer, MODEL_V); #endif #if defined MODEL_P _SetWeaponModel(pPlayer, MODEL_P); #endif } #endif stock OnGrenade_SetWorldModel(const pEnt) _SetWorldModel(pEnt, MODEL_W); stock OnGrenade_RemoveByTouch(const pEnt) _RemoveEntity(pEnt); stock Send_StatusIcon__Cross(const pPlayer, status = STATUSICON_FLASH) { message_begin(MSG_ONE_UNRELIABLE, g_MsgId_StatusIcon, .player = pPlayer); write_byte(status); write_string("cross"); write_byte(0); write_byte(255); write_byte(0); message_end(); } stock OnGrenade_PlaySound(const pEnt) engfunc(EngFunc_EmitSound, pEnt, CHAN_WEAPON, SOUND_HEAL, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); stock Send_Explode(iOrigin[3]) { emessage_begin(MSG_PVS, SVC_TEMPENTITY); ewrite_byte(TE_EXPLOSION); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + 65); ewrite_short(g_pFirstExplosion); ewrite_byte(30); ewrite_byte(20); ewrite_byte(TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES); emessage_end(); } stock Send_Pros(iOrigin[3]) { emessage_begin(MSG_PVS, SVC_TEMPENTITY); ewrite_byte(TE_SPRITETRAIL); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + 20); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + 80); ewrite_short(g_pPros); ewrite_byte(20); ewrite_byte(20); ewrite_byte(4); ewrite_byte(20); ewrite_byte(10); emessage_end(); } stock Send_ShockWave(iOrigin[3]) { emessage_begin(MSG_PVS, SVC_TEMPENTITY); ewrite_byte(TE_BEAMCYLINDER); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2]); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + HEAL_RADIUS); ewrite_short(g_pCircle); ewrite_byte(0); ewrite_byte(1); ewrite_byte(5); ewrite_byte(30); ewrite_byte(1); ewrite_byte(10); ewrite_byte(255); ewrite_byte(40); ewrite_byte(255); ewrite_byte(5); emessage_end(); } stock __UTIL_ScreenFade(const pPlayer, iColor[3] = {170, 255, 0}, iAlpha = 80, Float: flFxTime = 1.0, Float: flHoldTime = 0.3) { const FFADE_IN = 0x0000; emessage_begin(MSG_ONE_UNRELIABLE, g_MsgId_ScreenFade, .player = pPlayer); ewrite_short(FixedUnsigned16(flFxTime)); ewrite_short(FixedUnsigned16(flHoldTime)); ewrite_short(FFADE_IN); ewrite_byte(iColor[0]); ewrite_byte(iColor[1]); ewrite_byte(iColor[2]); ewrite_byte(iAlpha); emessage_end(); } stock FixedUnsigned16(Float:flValue, iScale = (1 << 12)) { return clamp(floatround(flValue * iScale), 0, 0xFFFF); } stock IsUserHaveAccessToUse(const pPlayer) { // Anytime we can add other checks like cached bool return (get_user_flags(pPlayer) & ACCESS_FLAGS); } bool: IsAllowedToUse(pPlayer) { #pragma unused pPlayer #if defined ACCESS_FLAGS if(!IsUserHaveAccessToUse(pPlayer)) { return false; } #endif if(g_bCanUseItem == status_DISABLED) { // client_print_color(pPlayer, print_team_red, "^3 You no may use this grenade now!"); return false; } // Also you can add another conditions there... return true; } stock bool: IsBlind(pPlayer) { return bool:(Float: _get_blindStartTime(pPlayer) + Float: _get_blindFadeTime(pPlayer) >= get_gametime()); } /* API?! */ /** * Set item status to use. * * @note Usage examples: * SHN_SetStatus(1); * * @param status: 1 - enabled / 0 - disabled * * @noreturn */ // native SHN_SetStatus(status) public native__SetStatus(plugin_id, argc) { enum { arg_status = 1 }; g_bCanUseItem = get_param(arg_status) == 1 ? status_ENABLED : status_DISABLED; } /** * Retrieves the item status to use. * * @note Usage examples: * SHN_GetStatus(); * * @return Current status: 1 - enabled / 0 - disabled */ // native SHN_GetStatus() public native__GetStatus(plugin_id, argc) { return g_bCanUseItem == status_ENABLED ? status_ENABLED : status_DISABLED; }
Texte modifié
Ouvrir un fichier
#include <amxmodx> #include <fakemeta> #include <engine> #include <fun> #include <csx> #pragma semicolon 1 new const szPluginInfo[][] = {"Smoke HealthNade", "1.1", "medusa + ApXuTekToR"}; #define SUPPORT_GAMECMS #if defined SUPPORT_GAMECMS native Array:cmsapi_get_user_services(const index, const szAuth[] = "", const szService[] = "", serviceID = 0, bool:part = false); #endif #define MODEL_V "models/health_nade/v_he_mk_nade.mdl" #define MODEL_P "models/health_nade/p_he_mk_nade.mdl" #define MODEL_W "models/health_nade/w_he_mk_nade.mdl" new const SPRITE_EXPLODE1[] = "sprites/health_nade/heal_explode.spr"; new const SPRITE_PROS[] = "sprites/health_nade/heal_shape.spr"; new const SOUND_HEAL[] = "health_nade/woomen_expr.wav"; enum { XO_WEAPON = 4, XO_CGRENADE = 5, m_pPlayer = 41, m_usEvent = 114 } new const EXCLASS[] = "grenade"; enum { STATUSICON_HIDE = 0, STATUSICON_FLASH = 2 }; const flagSmokeEvent = (1 << 1); #define IsSgGrenade(%1) (get_pdata_int(%1, m_usEvent, XO_CGRENADE) & flagSmokeEvent) #define _GetEntOwner(%1) pev(%1, pev_owner) #define _GetEntOrigin(%1,%2) pev(%1, pev_origin, %2) #define _SetViewModel(%1,%2) set_pev(%1, pev_viewmodel2, %2) #define _SetWeaponModel(%1,%2) set_pev(%1, pev_weaponmodel2, %2) #define _SetWorldModel(%1,%2) engfunc(EngFunc_SetModel, %1, %2) #define _RemoveEntity(%1) engfunc(EngFunc_RemoveEntity, %1) #define _get_blindStartTime(%1) get_ent_data_float(%1, "CBasePlayer", "m_blindStartTime") #define _get_blindFadeTime(%1) get_ent_data_float(%1, "CBasePlayer", "m_blindFadeTime") #if AMXX_VERSION_NUM < 183 #error [ERROR]: AMXX 1.8.2 - not supported (cuz use new fakemeta natives)! #endif new g_MsgId_StatusIcon, g_MsgId_ScreenFade; new g_pFirstExplosion, g_pPros, g_pCircle; enum status_s { status_DISABLED = 0, status_ENABLED = 1 }; new status_s: g_bCanUseItem = status_ENABLED; enum e_cvars { c_AccessUse_Nade, c_AccessFlags[16], c_AccessServices[32], c_HealTeammates_Or_All, c_GiveHealth_Num, c_GiveHealth_Limite, c_GiveHealth_Radius, c_ScreenFade_Effects, } new cvars[e_cvars]; public plugin_natives() { register_native("SHN_SetStatus", "native__SetStatus", .style = 0); register_native("SHN_GetStatus", "native__GetStatus", .style = 0); } public plugin_init() { g_MsgId_StatusIcon = get_user_msgid("StatusIcon"); g_MsgId_ScreenFade = get_user_msgid("ScreenFade"); register_touch(EXCLASS, "*", "CGrenade_ExplodeTouch"); register_event("CurWeapon", "Event_CurWeapon", "be", "1=1"); initCvars(); register_srvcmd("HealthNade_lockmap", "Check_LockMap"); new szConfigsDir[256]; get_localinfo("amxx_configsdir", szConfigsDir, charsmax(szConfigsDir)); server_cmd("exec %s/SevCorp/HelthNade.cfg", szConfigsDir); server_exec(); } #if defined SUPPORT_GAMECMS public plugin_cfg() { if(is_plugin_loaded("GameCMS_API") == INVALID_PLUGIN_ID) { log_amx("WARNING: gamecms_api.amxx isn't loaded! Plugin Stopped."); pause("a"); return; } } #endif public plugin_precache() { register_plugin(szPluginInfo[0], szPluginInfo[1], szPluginInfo[2]); precache_model(MODEL_V); precache_model(MODEL_P); precache_model(MODEL_W); g_pFirstExplosion = precache_model(SPRITE_EXPLODE1); g_pPros = precache_model(SPRITE_PROS); g_pCircle = precache_model("sprites/shockwave.spr"); precache_sound(SOUND_HEAL); } public initCvars() { register_cvar("HelthGrenade_AccessUse_Nade", "0"); register_cvar("HelthGrenade_AccessFlags", "m"); #if defined SUPPORT_GAMECMS register_cvar("HelthGrenade_AccessServices", "_healthnade"); #endif register_cvar("HelthGrenade_HealTeammates_Or_All", "0"); register_cvar("HelthGrenade_GiveHealth_Num", "50"); register_cvar("HelthGrenade_GiveHealth_Limite", "110"); register_cvar("HelthGrenade_GiveHealth_Radius", "300"); register_cvar("HelthGrenade_ScreenFade_Effects", "1"); get_cvar_string("HelthGrenade_AccessFlags", cvars[c_AccessFlags], charsmax(cvars[c_AccessFlags])); #if defined SUPPORT_GAMECMS get_cvar_string("HelthGrenade_AccessServices", cvars[c_AccessServices], charsmax(cvars[c_AccessServices])); #endif cvars[c_AccessUse_Nade] = get_cvar_num("HelthGrenade_AccessUse_Nade"); cvars[c_HealTeammates_Or_All] = get_cvar_num("HelthGrenade_HealTeammates_Or_All"); cvars[c_GiveHealth_Num] = get_cvar_num("HelthGrenade_GiveHealth_Num"); cvars[c_GiveHealth_Limite] = get_cvar_num("HelthGrenade_GiveHealth_Limite"); cvars[c_GiveHealth_Radius] = get_cvar_num("HelthGrenade_GiveHealth_Radius"); cvars[c_ScreenFade_Effects] = get_cvar_num("HelthGrenade_ScreenFade_Effects"); } public Event_CurWeapon(pPlayer) { enum { WeaponID = 2 }; if(read_data(WeaponID) == CSW_SMOKEGRENADE) { if(!IsAllowedToUse(pPlayer)) return; OnPlayer_SetViewModels(pPlayer); Send_StatusIcon__Cross(pPlayer); } else Send_StatusIcon__Cross(pPlayer, .status = STATUSICON_HIDE); } public grenade_throw(pPlayer, pEnt, w_id) { if(w_id != CSW_SMOKEGRENADE) return; if(!IsAllowedToUse(pPlayer)) return; OnGrenade_SetWorldModel(pEnt); } public CGrenade_ExplodeTouch(const pEnt, const pOther) { if(!IsSgGrenade(pEnt)) return; static iOwner; iOwner = _GetEntOwner(pEnt); if(!IsAllowedToUse(iOwner)) return; static Float: fOrigin[3], iOrigin[3]; _GetEntOrigin(pEnt, fOrigin); FVecIVec(fOrigin, iOrigin); Send_Explode(iOrigin); Send_Pros(iOrigin); Send_ShockWave(iOrigin); OnGrenade_PlaySound(pEnt); OnGrenade_RemoveByTouch(pEnt); HealPlayersOnRadius(iOwner, fOrigin); } stock HealPlayersOnRadius(pInflictor, Float: fOrigin[3]) { for(new pPlayer = 1; pPlayer <= MaxClients; pPlayer++) { if(is_user_alive(pPlayer)) { if(cvars[c_HealTeammates_Or_All] == 1) { if(get_user_team(pInflictor) != get_user_team(pPlayer)) continue; } #pragma unused pInflictor static Float: playerOrigin[3]; _GetEntOrigin(pPlayer, playerOrigin); if(get_distance_f(fOrigin, playerOrigin) < cvars[c_GiveHealth_Radius]) OnPlayer_HealEvent(pPlayer); } } } stock OnPlayer_HealEvent(const pPlayer) { if((get_user_health(pPlayer) + cvars[c_GiveHealth_Num]) < cvars[c_GiveHealth_Limite]) { set_user_health(pPlayer, (get_user_health(pPlayer) + cvars[c_GiveHealth_Num])); } else if((get_user_health(pPlayer) + cvars[c_GiveHealth_Num]) >= cvars[c_GiveHealth_Limite]) { set_user_health(pPlayer, cvars[c_GiveHealth_Limite]); } if(cvars[c_ScreenFade_Effects] == 1) { if(!IsBlind(pPlayer)) __UTIL_ScreenFade(pPlayer); } } stock OnPlayer_SetViewModels(const pPlayer) { _SetViewModel(pPlayer, MODEL_V); _SetWeaponModel(pPlayer, MODEL_P); } stock OnGrenade_SetWorldModel(const pEnt) _SetWorldModel(pEnt, MODEL_W); stock OnGrenade_RemoveByTouch(const pEnt) _RemoveEntity(pEnt); stock Send_StatusIcon__Cross(const pPlayer, status = STATUSICON_FLASH) { message_begin(MSG_ONE_UNRELIABLE, g_MsgId_StatusIcon, .player = pPlayer); write_byte(status); write_string("cross"); write_byte(0); write_byte(255); write_byte(0); message_end(); } stock OnGrenade_PlaySound(const pEnt) engfunc(EngFunc_EmitSound, pEnt, CHAN_WEAPON, SOUND_HEAL, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); stock Send_Explode(iOrigin[3]) { emessage_begin(MSG_PVS, SVC_TEMPENTITY); ewrite_byte(TE_EXPLOSION); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + 65); ewrite_short(g_pFirstExplosion); ewrite_byte(30); ewrite_byte(20); ewrite_byte(TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES); emessage_end(); } stock Send_Pros(iOrigin[3]) { emessage_begin(MSG_PVS, SVC_TEMPENTITY); ewrite_byte(TE_SPRITETRAIL); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + 20); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + 80); ewrite_short(g_pPros); ewrite_byte(20); ewrite_byte(20); ewrite_byte(4); ewrite_byte(20); ewrite_byte(10); emessage_end(); } stock Send_ShockWave(iOrigin[3]) { emessage_begin(MSG_PVS, SVC_TEMPENTITY); ewrite_byte(TE_BEAMCYLINDER); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2]); ewrite_coord(iOrigin[0]); ewrite_coord(iOrigin[1]); ewrite_coord(iOrigin[2] + cvars[c_GiveHealth_Radius]); ewrite_short(g_pCircle); ewrite_byte(0); ewrite_byte(1); ewrite_byte(5); ewrite_byte(30); ewrite_byte(1); ewrite_byte(10); ewrite_byte(255); ewrite_byte(40); ewrite_byte(255); ewrite_byte(5); emessage_end(); } stock __UTIL_ScreenFade(const pPlayer, iColor[3] = {170, 255, 0}, iAlpha = 80, Float: flFxTime = 1.0, Float: flHoldTime = 0.3) { const FFADE_IN = 0x0000; emessage_begin(MSG_ONE_UNRELIABLE, g_MsgId_ScreenFade, .player = pPlayer); ewrite_short(FixedUnsigned16(flFxTime)); ewrite_short(FixedUnsigned16(flHoldTime)); ewrite_short(FFADE_IN); ewrite_byte(iColor[0]); ewrite_byte(iColor[1]); ewrite_byte(iColor[2]); ewrite_byte(iAlpha); emessage_end(); } stock FixedUnsigned16(Float:flValue, iScale = (1 << 12)) { return clamp(floatround(flValue * iScale), 0, 0xFFFF); } bool: IsAllowedToUse(pPlayer) { #pragma unused pPlayer if(cvars[c_AccessUse_Nade] == 1) { if(!(checkAccess(pPlayer, cvars[c_AccessFlags]))) { return false; } } #if defined SUPPORT_GAMECMS else if(cvars[c_AccessUse_Nade] == 2) { static Array:Services; Services = cmsapi_get_user_services(pPlayer, "", cvars[c_AccessServices]); if(!Services) { return false; } } #endif if(g_bCanUseItem == status_DISABLED) { client_print_color(pPlayer, print_team_default, "^3[^4Nade^3] ^1Лечебная граната выключена^4!"); return false; } return true; } stock bool: IsBlind(pPlayer) { return bool:(Float: _get_blindStartTime(pPlayer) + Float: _get_blindFadeTime(pPlayer) >= get_gametime()); } checkAccess(const pPlayer, const flags[]){ return (get_user_flags(pPlayer) & read_flags(flags)); } /* API?! */ /** * Set item status to use. * * @note Usage examples: * SHN_SetStatus(1); * * @param status: 1 - enabled / 0 - disabled * * @noreturn */ // native SHN_SetStatus(status) public native__SetStatus(plugin_id, argc) { enum { arg_status = 1 }; g_bCanUseItem = get_param(arg_status) == 1 ? status_ENABLED : status_DISABLED; } /** * Retrieves the item status to use. * * @note Usage examples: * SHN_GetStatus(); * * @return Current status: 1 - enabled / 0 - disabled */ // native SHN_GetStatus() public native__GetStatus(plugin_id, argc) { return g_bCanUseItem == status_ENABLED ? status_ENABLED : status_DISABLED; } /* ============= Блокировка карт =========================== */ public Check_LockMap() { new getmap[32], map[32]; read_args(getmap, charsmax(getmap)); remove_quotes(getmap); get_mapname(map, charsmax(map)); if(!strcmp(getmap, map, true)) { pause("ad"); } }
Trouver la différence