Плагин FireDeagle

Сообщения
17
Реакции
-1
Ошибка
[AMXX] Run time error 10 (plugin "firedigle.amxx") (native "get_user_weapon") - debug not enabled!
ОС
Linux
Amx Mod X
1.9.0
Билд
ReHLDS version: 3.12.0.780-dev
ReGamedll
ReGameDLL version: 5.21.0.575-dev
Версия Metamod
Patch: Metamod-P (mm-p) v37
Список метамодулей
[ 1] WHBlocker RUN - whblocker_mm_i38 v1.5.697 ini Chlvl ANY
[ 2] Reunion RUN - reunion_mm_i386. v0.1.92d ini Start Never
[ 3] Rechecker RUN - rechecker_mm_i38 v2.3 ini Chlvl ANY
[ 4] VoiceTranscoder RUN - VoiceTranscoder. v2017RC5 ini ANY ANY
[ 5] ReSemiclip RUN - resemiclip_mm_i3 v2.3.9 ini Chlvl ANY
[ 6] AMX Mod X RUN - amxmodx_mm_i386. v1.9.0-d ini Start ANY
[ 7] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0-d pl6 ANY ANY
[ 8] Ham Sandwich RUN - hamsandwich_amxx v1.9.0-d pl6 ANY ANY
[ 9] Fun RUN - fun_amxx_i386.so v1.9.0-d pl6 ANY ANY
[10] ReAPI RUN - reapi_amxx_i386. v5.22.0. pl6 ANY Never
[11] MySQL RUN - mysql_amxx_i386. v1.9.0-d pl6 ANY ANY
[12] Engine RUN - engine_amxx_i386 v1.9.0-d pl6 ANY ANY
[13] CStrike RUN - cstrike_amxx_i38 v1.9.0-d pl6 ANY ANY
[14] SxGeo RUN - sxgeo_amxx_i386. v2.3 pl6 ANY Never
[15] CSX RUN - csx_amxx_i386.so v1.9.0-d pl6 ANY ANY
Список плагинов
[ 1] HPP_BLOCK 1.1 UNKNOWN + bristo hpp_blocker.amx running
[ 2] Recoil Control 1.5 OT recoil_control. running
[ 3] Knife WarnUP 1.0 ill upcswar.amxx running
[ 4] Fake Ping 1.1 MeRcyLeZZ/gyxoBk ping.amxx running
[ 5] [ReAPI] Healthnade 0.1.1 F@nt0M reapi_healthnad running
[ 6] Advanced Ultimate Weap 0.1.0b steelzzz auw.amxx running
[ 7] Refill Weapon On Kill 0.3 Vaqtincha refill_weapon_o running
[ 8] FreshBans 1.4.0b kanagava fresh_bans.amxx running
[ 9] Injection Med-Kit 1.1.2 Emma Jule injection.amxx running
[ 10] ScreenMaker 1.1 neygomon screen_maker.am running
[ 11] Admin Loader 2.9 neygomon admin_loader.am running
[ 12] [GRENADE] Molotov 1.0.2 medusa grenade_molotov running
[ 13] Knives menu 1.0.0a Nordic Warrior knives_menu.amx running
[ 14] unknown unknown unknown forward_some_sh running
[ 15] Advanced Gag 1.9.0 neygomon amx_gag.amxx running
[ 16] Lite Admin ESP 1.0 neygomon admin_esp.amxx running
[ 17] [ReAPI] AdminFreeLook 1.0 ReHLDS Team adminfreelook.a running
[ 18] [ReAPI] VIP System 1.3.2 pUzzlik re_vip_system.a running
[ 19] Nick Change Menu 0.1.1 serfreeman1337 nickchange_menu running
[ 20] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 21] Menus Front-End 1.4 neugomon menufront.amxx running
[ 22] Players Menu 1.7 neugomon plmenu.amxx running
[ 23] Admin Votes 1.9.0-dev+ AMXX Dev Team adminvote.amxx running
[ 24] Restrict Weapons 1.9.0-dev+ AMXX Dev Team restmenu.amxx running
[ 25] AES: Bonus CSTRIKE 0.5.9 [REA serfreeman1337/s aes_bonus_cstri running
[ 26] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 27] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 28] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 29] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 30] raise_the_coin 1.0.2 Baton4ik48 raise_the_coin. running
[ 31] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 32] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 33] CSStatsX SQL 0.7.4+1 serfreeman1337 csstatsx_sql.am running
[ 34] Say me and Say hp 1.4 neygomon sayme.amxx running
[ 35] AES Bonus: Flags 0.2 Sonyx aes_bonus_flags running
[ 36] Lite Translit 2.8 neygomon lite_translit_c running
[ 37] Night Mode 1.2.3 Radius night_mode.amxx running
[ 38] Advanced MapChooser 1.4 neygomon map_chooser.amx running
[ 39] Mode 2x2 2.5re s1lent mode.amxx running
[ 40] No Players Map 1.03 neygomon no_players_map. running
[ 41] Damager 0.0.5 steelzzz damager.amxx running
[ 42] Advanced Kill Assists 1.3b Xelson next21_kill_ass running
[ 43] Top Awards 1.2.0 szawesome top_awards.amxx running
[ 44] Music Connection 0.0.1 Jumper music_connectio running
[ 45] Revive/Mined Die Playe 2.3.9 Emma Jule revive_teammate running
[ 46] ASP 1.0.2 iPlague autospawnpoints running
[ 47] DemoRecoder 1.1 neygomon amx_demorec.amx running
[ 48] MENU TAKE WEAPON 2.2 Sanya@ (Skype: a menu_upcs.amxx running
[ 49] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 50] Menu 3.1 WaT_1 menuupcs.amxx running
[ 51] UA 1.4 neygomon lite_voteban.am running
[ 52] [GM] VIP Test 1.1.1 [GM] NWC gm_vip_test.amx running
[ 53] [SxGeo] Connect Info 1.0 s1lent sxgeo_connect_i running
[ 54] PUTIN 3.2 MayroN putin.amxx running
[ 55] [ReAPI] Ghost after de 0.0.1 steelzzz ghost.amxx running
[ 56] [ZP] Gundrop effect 0.1 PaXaN-ZOMBIE upcsdrop.amxx running
[ 57] Block grande info 1.0 neygomon blocgren.amxx running
[ 58] Block Radio Commands 1.0 d3m37r4 blocradio.amxx running
[ 59] BOMB REAL TIMER 5.0 Vaqtincha | Flym bomb_real_timer running
[ 60] GameName 1.0 Lonkura gamename.amxx running
[ 61] [ReAPI] Parachute 1.1 ReHLDS Team parachute.amxx running
[ 62] Reset Score 0.2 Silenttt / CepeH rs0.4.amxx running
[ 63] buy_admin 1.0 sergeychavko buy_admin.amxx running
[ 64] Death Sprite 1.0 DarkGL skull.amxx running
[ 65] Team Grenade Trail 1.2 Numb team_grenade_tr running
[ 66] CT Bomb Cracker 0.5 Vaqtincha ct_bomb_cracker running
[ 67] Win Messages 1.1 neygomon win_msg.amxx running
[ 68] Spectator Bots 2.3 bs SISA spectator_bots. running
[ 69] Adverts 1.0 pUzzlik adverts_message running
[ 70] Weapon Model + Sound R 1.2 GHW_Chronic new_weapons.amx running
[ 71] AWPoff 1.2 PAffAEJIkA :3 awp_off.amxx running
[ 72] unknown unknown unknown changername.amx running
[ 73] [ReAPI] No Team Flash 0.0.2 Vaqtincha no_team_flash.a running
[ 74] Custom Models 1.3.2 neugomon custom_models.a running
[ 75] Nade Messages 1.0 v3x nademessages.am running
[ 76] [RE] Talisman 1.4 BiZaJe talisman.amxx running
[ 77] [RE] Talisman Health 1.0 BiZaJe talisman_health running
[ 78] [RE] Talisman HUD 1.0 BiZaJe talisman_hud.am running
[ 79] [RE] Talisman Glow Pla 1.0 BiZaJe talisman_glow.a running
[ 80] [RE] Talisman Sound 1.0 BiZaJe talisman_sound. running
Автор плагина
Не известен
Версия плагина
Не известен
Исходный код
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <file>
//#include <cstrike>
#include <fakemeta>
//#include <reapi>

// Настройки:

// Флаг доступа:
#define ACCESS_FLAG ADMIN_LEVEL_H

// Мин. и макс. урон от огня:
#define FIRE_DMG_MIN 4
#define FIRE_DMG_MAX 8

// Мин. и макс. длительность горения:
#define FIRE_DUR_MIN 4
#define FIRE_DUR_MAX 8

// Путь к папке с моделями ("models/.../"):
#define MODEL_PATH "models/awFireDeagle/"

// Название моделей ("deagle" => v/p_deagle.mdl):
#define MODEL_NAME "deagle"

// Команда для вкл\выкл огненного дигла:
#define SWITCH_CMD "say /fd"

// Префикс плагина в чате:
//new const pPrefix[] = "!g[!tFireDeagle!g]!t";

// Поддержка режима FFA(Каждый сам за себя)
#define SUPPORT_FFA 0

// Множитель урона от попадания огненного дигла [Float]
#define FIRE_SHOT_DMG 0.8


enum cvars{
cFireDmgMin,
cFireDmgMax,
cFireDurMin,
cFireDurMax,
cAccessFlags,
cModelsPath,
cModelsName,
cFfaMode,
cDmgMult,
cChatPrefix,
cSwitchCmd,
cPlayerGlow
}

new bool:pOnFire[33], bool:pFireDeagleActive[33];
new msgDamage, spFire[5];
new vModel[128], pModel[128];
new pCvars[cvars];
new pPrefix[128], mdlName[128], mdlPath[128];

#define PLUG_VER "1.2"
#define PLUG_NAME "Fire Deagle"

public plugin_init(){
register_plugin(PLUG_NAME, PLUG_VER, "ArKaNeMaN");
get_pcvar_string(pCvars[cChatPrefix], pPrefix, charsmax(pPrefix));
static swtchCmd[128]; get_pcvar_string(pCvars[cSwitchCmd], swtchCmd, charsmax(swtchCmd));
RegisterHam (Ham_TakeDamage, "player", "pTakeDamage", true);
RegisterHam(Ham_Item_Deploy, "weapon_deagle", "pDeagleDeploy", true);
RegisterHam(Ham_Killed,"player","pDeath");
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "wPrimaryAttack", true);
msgDamage = get_user_msgid("Damage");
register_clcmd(swtchCmd, "fdSwitch");
server_print("[%s v%s] loaded. ", PLUG_NAME, PLUG_VER);
}

public cfgExec(){
pCvars[cFireDmgMin] = register_cvar("awFdFireDmgMin", "4");
pCvars[cFireDmgMax] = register_cvar("awFdFireDmgMax", "8");
pCvars[cFireDurMin] = register_cvar("awFdFireDurMin", "4");
pCvars[cFireDurMax] = register_cvar("awFdFireDurMax", "8");
pCvars[cAccessFlags] = register_cvar("awFdAccessFlags", "t");
pCvars[cModelsPath] = register_cvar("awFdModelsPath", "models/awFireDeagle/");
pCvars[cModelsName] = register_cvar("awFdModelsName", "deagle");
pCvars[cFfaMode] = register_cvar("awFdFfaMode", "0");
pCvars[cDmgMult] = register_cvar("awFdDmgMult", "1.0");
pCvars[cChatPrefix] = register_cvar("awFdChatPrefix", "!g[!tFireDeagle!g]!t");
pCvars[cSwitchCmd] = register_cvar("awFdSwitchCmd", "say /fd");
pCvars[cPlayerGlow] = register_cvar("awFdPlayerGlow", "1");

static cfgDir[32], cfgFileFullName[64];
get_configsdir(cfgDir, charsmax(cfgDir));
formatex(cfgFileFullName, charsmax(cfgFileFullName), "%s/awFireDeagle.cfg", cfgDir);
if(file_exists(cfgFileFullName)){
server_cmd("exec %s", cfgFileFullName);
server_exec();
}
else{
server_print("[%s v%s] [Error] [Config file not found (%s)] [Plugin paused]", PLUG_NAME, PLUG_VER, cfgFileFullName);
pause("d");
}
}

public wPrimaryAttack(weapon){
static id; id = get_pdata_cbase(weapon, 41, 4);
if(pFireDeagleActive[id] && get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])) emit_sound(id, CHAN_WEAPON, "awFireDeagle/shot.wav", 1.0, ATTN_NORM, 0, 100);
}

public fdSwitch(id){
if(get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])){
static name[32]; get_user_name(id, name, charsmax(name));
pFireDeagleActive[id] = !pFireDeagleActive[id];
printColorChat(id, "%s Огненный дигл !g%s!t.", pPrefix, pFireDeagleActive[id] ? "активирован" : "деактивирован");
if(get_user_weapon(id) == CSW_DEAGLE){
if(pFireDeagleActive[id]) setFireModel(id);
else resetDeagleModel(id);
}
}
else printColorChat(id, "%s Нет доступа!", pPrefix);
}

public plugin_natives() register_native("fdIsUserOnFire", "nativeIsUserOnFire");

public nativeIsUserOnFire(pluginId, param) return pOnFire[get_param(1)] ? 1 : 0;

public plugin_precache(){
cfgExec();
get_pcvar_string(pCvars[cModelsPath], mdlPath, charsmax(mdlPath));
get_pcvar_string(pCvars[cModelsName], mdlName, charsmax(mdlName));
for(new i = 0; i < 5; i++){
static fileName[128]; formatex(fileName, charsmax(fileName), "sprites/awFireDeagle/fire%d.spr", i+1);
spFire[i] = precache_model(fileName);
}
/*
precache_sound("awFireDeagle/dmg1.wav");
precache_sound("awFireDeagle/dmg2.wav");
precache_sound("awFireDeagle/dmg3.wav");
precache_sound("awFireDeagle/dmg4.wav");
*/
precache_sound("awFireDeagle/shot.wav");

formatex(vModel, charsmax(vModel), "%sv_%s.mdl", mdlPath, mdlName);
if(file_exists(vModel)) precache_model(vModel);
else formatex(vModel, charsmax(vModel), "");

formatex(pModel, charsmax(pModel), "%sp_%s.mdl", mdlPath, mdlName);
if(file_exists(pModel)) precache_model(pModel);
else formatex(pModel, charsmax(pModel), "");
}

public client_authorized(id) pFireDeagleActive[id] = false;

public pDeath(victim, attacker, corpse){
static data[2]; data[0] = victim;
pFireEnd(data);
remove_task(victim);
}

public pTakeDamage(victim, weapon, attacker, Float:damage, damagebits){
if(!attacker || !victim || attacker == victim) return HAM_IGNORED;
if(get_user_weapon(attacker) == CSW_DEAGLE && get_user_flags(attacker) & get_pcvar_flags(pCvars[cAccessFlags]) && pFireDeagleActive[attacker]){
if(!pOnFire[victim]){
if(get_user_team(attacker) != get_user_team(victim) || get_pcvar_num(pCvars[cFfaMode])){
static data[2]; data[0] = victim; data[1] = attacker;
pOnFire[victim] = true;
igniteEffects(data);
ignitePlayer(data);
static fireDur; fireDur = random_num(get_pcvar_num(pCvars[cFireDurMin]), get_pcvar_num(pCvars[cFireDurMax]));
if(get_pcvar_num(pCvars[cPlayerGlow])) set_user_rendering(victim, kRenderFxGlowShell, 240, 127, 19, kRenderNormal, 25);
set_task(float(fireDur), "pFireEnd" , victim, data, 2);
damage = damage*get_pcvar_float(pCvars[cDmgMult]);
SetHamParamFloat(4, damage);
return HAM_IGNORED;
}
}
}
return HAM_IGNORED;
}

public pFireEnd(data[]){
pOnFire[data[0]] = false;
set_user_rendering(data[0]);
}

public igniteEffects(data[]){

new id = data[0];

if(is_user_alive(id) && pOnFire[id]){
static korigin[3]; get_user_origin(id, korigin);

message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(17);
write_coord(korigin[0]);
write_coord(korigin[1]);
write_coord(korigin[2]);
write_short(spFire[random_num(0, 4)]);
write_byte(20);
write_byte(200);
message_end();

set_task(0.1, "igniteEffects" , 0 , data, 2);
}

return PLUGIN_CONTINUE;

}

public ignitePlayer(data[]){

new id = data[0];

if(is_user_alive(id) && pOnFire[id]){

new korigin[3];
new pOrigin[3];

get_user_origin(id, korigin);

ExecuteHam(Ham_TakeDamage, data[0], data[1], data[1], float(random_num(get_pcvar_num(pCvars[cFireDmgMin]), get_pcvar_num(pCvars[cFireDmgMax]))), DMG_BURN);
message_begin(MSG_ONE, msgDamage, {0, 0, 0}, id);
write_byte(30);
write_byte(30);
write_long(1<<21);
write_coord(korigin[0]);
write_coord(korigin[1]);
write_coord(korigin[2]);
message_end();
/*
static name[32]; get_user_name(id, name, charsmax(name));
static sSound[128]; formatex(sSound, charsmax(sSound), "awFireDeagle/dmg%d.wav", random_num(1, 4));
emit_sound(data[0], CHAN_VOICE, sSound, 0.8, ATTN_NORM, 0, PITCH_NORM);
emit_sound(id, CHAN_ITEM, sSound, 0.6, ATTN_NORM, 0, PITCH_NORM);
*/
new players[32], inum = 0;
get_players(players, inum, "a");
for(new i = 0 ; i < inum; ++i){
get_user_origin(players[i], pOrigin);
if(get_distance(korigin, pOrigin) < 100){
if(!pOnFire[players[i]]){
ExecuteHam(Ham_TakeDamage, players[i], data[0], data[1], float(random_num(get_pcvar_num(pCvars[cFireDmgMin]), get_pcvar_num(pCvars[cFireDmgMax]))), DMG_BURN);
message_begin(MSG_ONE, msgDamage, {0, 0, 0}, players[i]);
write_byte(30);
write_byte(30);
write_long(1<<21);
write_coord(pOrigin[0]);
write_coord(pOrigin[1]);
write_coord(pOrigin[2]);
message_end();
/*
static ssSound[128]; formatex(ssSound, charsmax(ssSound), "awFireDeagle/fire%d.wav", random_num(1, 4));
emit_sound(players[i], CHAN_VOICE, ssSound, 0.8, ATTN_NORM, 0, PITCH_NORM);
*/
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(17);
write_coord(pOrigin[0]);
write_coord(pOrigin[1]);
write_coord(pOrigin[2]);
write_short(spFire[random_num(0, 4)]);
write_byte(20);
write_byte(200);
message_end();
}
}
}
set_task(1.0, "ignitePlayer" , 0, data, 2);
}
return PLUGIN_CONTINUE;
}

public pDeagleDeploy(weapon){
static id; id = get_pdata_cbase(weapon, 41, 4);
setFireModel(id);
return HAM_IGNORED;
}

public setFireModel(id){
if(pFireDeagleActive[id] && get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])){
if(vModel[0]) set_pev(id, pev_viewmodel2, vModel);
if(pModel[0]) set_pev(id, pev_weaponmodel2, pModel);
return true;
}
return false;
}

public resetDeagleModel(id){
set_pev(id, pev_viewmodel2, "models/v_deagle.mdl");
set_pev(id, pev_weaponmodel2, "models/p_deagle.mdl");
}

stock printColorChat(const index, const input[], any:...){
#define gmsg_SayText 76
static msg[191];
new count = 1, players[32];
vformat(msg, 190, input, 3);
replace_all(msg, sizeof(msg), "!g", "^4");
replace_all(msg, sizeof(msg), "!t", "^3");
replace_all(msg, sizeof(msg), "!n", "^1");
if(index) players[0] = index; else get_players(players, count, "ch");
for(new i = 0; i < count; i++){
if(!is_user_connected(players[i])) return;
message_begin(MSG_ONE_UNRELIABLE, gmsg_SayText, _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
Плагин работает все отлично но постоянно ерорит с эту ошибку может кто подскажет в чом проблема? Я не селен в этом очень.
 
Сообщения
678
Реакции
56
Помог
16 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован

ArKaNeMaN

Квалифицированный специалист по VipModular
Сообщения
434
Реакции
296
Помог
5 раз(а)
Это вроде что-то из моего старого... Насколько я помню, я кому-то писал огненный дигл под заказ, а потом его продавали на одном из хостингов)

Может я ошибаюсь, конечно, но да)
Проверил. Не ошибаюсь)
12 Фев 2023
А можно саму ошибку показать?)
И было бы неплохо поймать её в дебаг-режиме
 
Последнее редактирование:

ArKaNeMaN

Квалифицированный специалист по VipModular
Сообщения
434
Реакции
296
Помог
5 раз(а)
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
ArKaNeMaN, 'сильная'
Код:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <file>
//#include <cstrike>
#include <fakemeta>
//#include <reapi>
12 Фев 2023
MENTOP ,debug в plugin.ini напротив плагина
 
Сообщения
1,055
Реакции
212
Предупреждения
9
Помог
6 раз(а)
Код:
public fdSwitch(id){
    if(!is_user_alive(id) || !is_user_connected(id)){
        return;
    }
    
    if(get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])){
        static name[32]; get_user_name(id, name, charsmax(name));
        pFireDeagleActive[id] = !pFireDeagleActive[id];
        printColorChat(id, "%s Огненный дигл !g%s!t.", pPrefix, pFireDeagleActive[id] ? "активирован" : "деактивирован");
        if(get_user_weapon(id) == CSW_DEAGLE){
            if(pFireDeagleActive[id]) setFireModel(id);
            else resetDeagleModel(id);
        }
    }
    else printColorChat(id, "%s Нет доступа!", pPrefix);
}
 
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
BiZaJe, а зачем и на живучесть и конект????
12 Фев 2023
Достаточно is_user_alive
 
Сообщения
1,055
Реакции
212
Предупреждения
9
Помог
6 раз(а)
Code_0xABC, чтоб мёртвый игрок не юзал
Но это так предложка
Без разницы хоть на живого, хоть на мёртвого делай чек
12 Фев 2023
Code_0xABC, коннект - если игрок заюзал, и резко вылетел
Но тут хз стоит ли
 
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
Ты удивишся, но в is_user_alive есть проверка на коннект. И ошибка появляется, если допустим игрок не живой, а пытается взять этот дигл
 
Последнее редактирование:
Сообщения
1,055
Реакции
212
Предупреждения
9
Помог
6 раз(а)
Code_0xABC, и?
Я знаю про это
Ты не мне говори про это, а ТС’у
А для него две проверки для видимости , что код работает
 
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
Код:
public fdSwitch(id){
    if(!is_user_alive(id)){
        return;
    }
    
    if(get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])){
        static name[32]; get_user_name(id, name, charsmax(name));
        pFireDeagleActive[id] = !pFireDeagleActive[id];
        printColorChat(id, "%s Огненный дигл !g%s!t.", pPrefix, pFireDeagleActive[id] ? "активирован" : "деактивирован");
        if(get_user_weapon(id) == CSW_DEAGLE){
            if(pFireDeagleActive[id]) setFireModel(id);
            else resetDeagleModel(id);
        }
    }
    else printColorChat(id, "%s Нет доступа!", pPrefix);
}
 
Сообщения
494
Реакции
341
Помог
11 раз(а)
BiZaJe, Code_0xABC, тут более логично предположить, что ошибка вызывается в функции pTakeDamage. Там нужна проверка на коннект.
13 Фев 2023
Код:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <file>
//#include <cstrike>
#include <fakemeta>
//#include <reapi>

// Настройки:
    
    // Флаг доступа:
        #define ACCESS_FLAG ADMIN_LEVEL_H
        
    // Мин. и макс. урон от огня:
        #define FIRE_DMG_MIN 4
        #define FIRE_DMG_MAX 8
        
    // Мин. и макс. длительность горения:
        #define FIRE_DUR_MIN 4
        #define FIRE_DUR_MAX 8
        
    // Путь к папке с моделями ("models/.../"):
        #define MODEL_PATH "models/awFireDeagle/"
        
    // Название моделей ("deagle" => v/p_deagle.mdl):
        #define MODEL_NAME "deagle"
        
    // Команда для вкл\выкл огненного дигла:
        #define SWITCH_CMD "say /fd"
        
    // Префикс плагина в чате:
        //new const pPrefix[] = "!g[!tFireDeagle!g]!t";
        
    // Поддержка режима FFA(Каждый сам за себя)
        #define SUPPORT_FFA 0
        
    // Множитель урона от попадания огненного дигла [Float]
        #define FIRE_SHOT_DMG 0.8


enum cvars{
    cFireDmgMin,
    cFireDmgMax,
    cFireDurMin,
    cFireDurMax,
    cAccessFlags,
    cModelsPath,
    cModelsName,
    cFfaMode,
    cDmgMult,
    cChatPrefix,
    cSwitchCmd,
    cPlayerGlow
}

new bool:pOnFire[33], bool:pFireDeagleActive[33];
new msgDamage, spFire[5];
new vModel[128], pModel[128];
new pCvars[cvars];
new pPrefix[128], mdlName[128], mdlPath[128];

#define PLUG_VER "1.2"
#define PLUG_NAME "Fire Deagle"

public plugin_init(){
    register_plugin(PLUG_NAME, PLUG_VER, "ArKaNeMaN");
    get_pcvar_string(pCvars[cChatPrefix], pPrefix, charsmax(pPrefix));
    static swtchCmd[128]; get_pcvar_string(pCvars[cSwitchCmd], swtchCmd, charsmax(swtchCmd));
    RegisterHam (Ham_TakeDamage, "player", "pTakeDamage", true);
    RegisterHam(Ham_Item_Deploy, "weapon_deagle", "pDeagleDeploy", true);
    RegisterHam(Ham_Killed,"player","pDeath");
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "wPrimaryAttack", true);
    msgDamage = get_user_msgid("Damage");
    register_clcmd(swtchCmd, "fdSwitch");
    server_print("[%s v%s] loaded. ", PLUG_NAME, PLUG_VER);
}

public cfgExec(){
    pCvars[cFireDmgMin] = register_cvar("awFdFireDmgMin", "4");
    pCvars[cFireDmgMax] = register_cvar("awFdFireDmgMax", "8");
    pCvars[cFireDurMin] = register_cvar("awFdFireDurMin", "4");
    pCvars[cFireDurMax] = register_cvar("awFdFireDurMax", "8");
    pCvars[cAccessFlags] = register_cvar("awFdAccessFlags", "t");
    pCvars[cModelsPath] = register_cvar("awFdModelsPath", "models/awFireDeagle/");
    pCvars[cModelsName] = register_cvar("awFdModelsName", "deagle");
    pCvars[cFfaMode] = register_cvar("awFdFfaMode", "0");
    pCvars[cDmgMult] = register_cvar("awFdDmgMult", "1.0");
    pCvars[cChatPrefix] = register_cvar("awFdChatPrefix", "!g[!tFireDeagle!g]!t");
    pCvars[cSwitchCmd] = register_cvar("awFdSwitchCmd", "say /fd");
    pCvars[cPlayerGlow] = register_cvar("awFdPlayerGlow", "1");
    
    static cfgDir[32], cfgFileFullName[64];
    get_configsdir(cfgDir, charsmax(cfgDir));
    formatex(cfgFileFullName, charsmax(cfgFileFullName), "%s/awFireDeagle.cfg", cfgDir);
    if(file_exists(cfgFileFullName)){
        server_cmd("exec %s", cfgFileFullName);
        server_exec();
    }
    else{
        server_print("[%s v%s] [Error] [Config file not found (%s)] [Plugin paused]", PLUG_NAME, PLUG_VER, cfgFileFullName);
        pause("d");
    }
}

public wPrimaryAttack(weapon){
    static id; id = get_pdata_cbase(weapon, 41, 4);
    if(pFireDeagleActive[id] && get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])) emit_sound(id, CHAN_WEAPON, "awFireDeagle/shot.wav", 1.0, ATTN_NORM, 0, 100);
}

public fdSwitch(id){
    if(is_user_alive(id) && get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])){
        static name[32]; get_user_name(id, name, charsmax(name));
        pFireDeagleActive[id] = !pFireDeagleActive[id];
        printColorChat(id, "%s Огненный дигл !g%s!t.", pPrefix, pFireDeagleActive[id] ? "активирован" : "деактивирован");
        if(get_user_weapon(id) == CSW_DEAGLE){
            if(pFireDeagleActive[id]) setFireModel(id);
            else resetDeagleModel(id);
        }
    }
    else printColorChat(id, "%s Нет доступа!", pPrefix);
}

public plugin_natives() register_native("fdIsUserOnFire", "nativeIsUserOnFire");

public nativeIsUserOnFire(pluginId, param) return pOnFire[get_param(1)] ? 1 : 0;

public plugin_precache(){
    cfgExec();
    get_pcvar_string(pCvars[cModelsPath], mdlPath, charsmax(mdlPath));
    get_pcvar_string(pCvars[cModelsName], mdlName, charsmax(mdlName));
    for(new i = 0; i < 5; i++){
        static fileName[128]; formatex(fileName, charsmax(fileName), "sprites/awFireDeagle/fire%d.spr", i+1);
        spFire[i] = precache_model(fileName);
    }
    /*
    precache_sound("awFireDeagle/dmg1.wav");
    precache_sound("awFireDeagle/dmg2.wav");
    precache_sound("awFireDeagle/dmg3.wav");
    precache_sound("awFireDeagle/dmg4.wav");
     */
    precache_sound("awFireDeagle/shot.wav");
    
    formatex(vModel, charsmax(vModel), "%sv_%s.mdl", mdlPath, mdlName);
    if(file_exists(vModel)) precache_model(vModel);
    else formatex(vModel, charsmax(vModel), "");
    
    formatex(pModel, charsmax(pModel), "%sp_%s.mdl", mdlPath, mdlName);
    if(file_exists(pModel)) precache_model(pModel);
    else formatex(pModel, charsmax(pModel), "");
}

public client_authorized(id) pFireDeagleActive[id] = false;

public pDeath(victim, attacker, corpse){
    static data[2]; data[0] = victim;
    pFireEnd(data);
    remove_task(victim);
}

public pTakeDamage(victim, weapon, attacker, Float:damage, damagebits){
    if(attacker == victim) return HAM_IGNORED;
    if(is_user_connected(attacker) && get_user_weapon(attacker) == CSW_DEAGLE && get_user_flags(attacker) & get_pcvar_flags(pCvars[cAccessFlags]) && pFireDeagleActive[attacker]){
        if(!pOnFire[victim]){
            if(get_user_team(attacker) != get_user_team(victim) || get_pcvar_num(pCvars[cFfaMode])){
                static data[2]; data[0] = victim; data[1] = attacker;
                pOnFire[victim] = true;
                igniteEffects(data);
                ignitePlayer(data);
                static fireDur; fireDur = random_num(get_pcvar_num(pCvars[cFireDurMin]), get_pcvar_num(pCvars[cFireDurMax]));
                if(get_pcvar_num(pCvars[cPlayerGlow])) set_user_rendering(victim, kRenderFxGlowShell, 240, 127, 19, kRenderNormal, 25);
                set_task(float(fireDur), "pFireEnd" , victim, data, 2);
                damage = damage*get_pcvar_float(pCvars[cDmgMult]);
                SetHamParamFloat(4, damage);
                return HAM_IGNORED;
            }
        }
    }
    return HAM_IGNORED;
}

public pFireEnd(data[]){
    pOnFire[data[0]] = false;
    set_user_rendering(data[0]);
}

public igniteEffects(data[]){
    
    new id = data[0];
        
    if(is_user_alive(id) && pOnFire[id]){
        static korigin[3]; get_user_origin(id, korigin);
        
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
        write_byte(17);
        write_coord(korigin[0]);
        write_coord(korigin[1]);
        write_coord(korigin[2]);
        write_short(spFire[random_num(0, 4)]);
        write_byte(20);
        write_byte(200);
        message_end();
        
        set_task(0.1, "igniteEffects" , 0 , data, 2);
    }
    
    return PLUGIN_CONTINUE;
    
}

public ignitePlayer(data[]){
    
    new id = data[0];
    
    if(is_user_alive(id) && pOnFire[id]){
        
        new korigin[3];
        new pOrigin[3];
        
        get_user_origin(id, korigin);
        
        ExecuteHam(Ham_TakeDamage, data[0], data[1], data[1], float(random_num(get_pcvar_num(pCvars[cFireDmgMin]), get_pcvar_num(pCvars[cFireDmgMax]))), DMG_BURN);
        message_begin(MSG_ONE, msgDamage, {0, 0, 0}, id);
        write_byte(30);
        write_byte(30);
        write_long(1<<21);
        write_coord(korigin[0]);
        write_coord(korigin[1]);
        write_coord(korigin[2]);
        message_end();
        /*
        static name[32]; get_user_name(id, name, charsmax(name));
        static sSound[128]; formatex(sSound, charsmax(sSound), "awFireDeagle/dmg%d.wav", random_num(1, 4));
        emit_sound(data[0], CHAN_VOICE, sSound, 0.8, ATTN_NORM, 0, PITCH_NORM);
        emit_sound(id, CHAN_ITEM, sSound, 0.6, ATTN_NORM, 0, PITCH_NORM);
         */
        new players[32], inum = 0;
        get_players(players, inum, "a");
        for(new i = 0 ; i < inum; ++i){
            get_user_origin(players[i], pOrigin);
            if(get_distance(korigin, pOrigin) < 100){
                if(!pOnFire[players[i]]){
                    ExecuteHam(Ham_TakeDamage, players[i], data[0], data[1], float(random_num(get_pcvar_num(pCvars[cFireDmgMin]), get_pcvar_num(pCvars[cFireDmgMax]))), DMG_BURN);
                    message_begin(MSG_ONE, msgDamage, {0, 0, 0}, players[i]);
                    write_byte(30);
                    write_byte(30);
                    write_long(1<<21);
                    write_coord(pOrigin[0]);
                    write_coord(pOrigin[1]);
                    write_coord(pOrigin[2]);
                    message_end();
                    /*
                    static ssSound[128]; formatex(ssSound, charsmax(ssSound), "awFireDeagle/fire%d.wav", random_num(1, 4));
                    emit_sound(players[i], CHAN_VOICE, ssSound, 0.8, ATTN_NORM, 0, PITCH_NORM);
                     */
                    message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
                    write_byte(17);
                    write_coord(pOrigin[0]);
                    write_coord(pOrigin[1]);
                    write_coord(pOrigin[2]);
                    write_short(spFire[random_num(0, 4)]);
                    write_byte(20);
                    write_byte(200);
                    message_end();
                }
            }
        }
        set_task(1.0, "ignitePlayer" , 0, data, 2);
    }
    return PLUGIN_CONTINUE;
}

public pDeagleDeploy(weapon){
    static id; id = get_pdata_cbase(weapon, 41, 4);
    setFireModel(id);
    return HAM_IGNORED;
}

public setFireModel(id){
    if(pFireDeagleActive[id] && get_user_flags(id) & get_pcvar_flags(pCvars[cAccessFlags])){
        if(vModel[0]) set_pev(id, pev_viewmodel2, vModel);
        if(pModel[0]) set_pev(id, pev_weaponmodel2, pModel);
        return true;
    }
    return false;
}

public resetDeagleModel(id){
    set_pev(id, pev_viewmodel2, "models/v_deagle.mdl");
    set_pev(id, pev_weaponmodel2, "models/p_deagle.mdl");
}

stock printColorChat(const index, const input[], any:...){
    #define gmsg_SayText 76
    static msg[191];
    new count = 1, players[32];
    vformat(msg, 190, input, 3);
    replace_all(msg, sizeof(msg), "!g", "^4");
    replace_all(msg, sizeof(msg), "!t", "^3");
    replace_all(msg, sizeof(msg), "!n", "^1");
    if(index) players[0] = index; else get_players(players, count, "ch");
    for(new i = 0; i < count; i++){
        if(!is_user_connected(players[i])) return;
        message_begin(MSG_ONE_UNRELIABLE, gmsg_SayText, _, players[i]);
        write_byte(players[i]);
        write_string(msg);
        message_end();
    }
}
 
Сообщения
17
Реакции
-1
ArKaNeMaN,
[AMXX] Displaying debug trace (plugin "firedigle.amxx", version "1.2")
[AMXX] Run time error 10: native error (native "RegisterHam")
[AMXX] [0] firedigle.sma::plugin_init (line 73)
 

ArKaNeMaN

Квалифицированный специалист по VipModular
Сообщения
434
Реакции
296
Помог
5 раз(а)
Сообщения
17
Реакции
-1
Тему можно закрыть проблема решилась. Всем огромное спасибо кто отозвался.
 
  • it's so  bad
Реакции: DEVV
Сообщения
3,049
Реакции
1,739
Помог
80 раз(а)
MENTOP, каким образом решилась? Не вижу сообщения с решением проблемы
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу