Помогите решить проблему с плагином Weapon Skin System 0.7.0-55

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
67
Реакции
1
Помог
1 раз(а)
Ошибка
Не работает команда /skinreset - сброс модели для оружия.
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0.5249 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Jun 19 2019 13:31:53
Built from: https://github.com/alliedmodders/amxmodx/commit/6cecb34
Build ID: 5249:6cecb34
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.6.0.672-dev
Build date: 17:31:06 Jun 5 2019 (1880)
Build from: https://github.com/dreamstalker/rehlds/commit/0c8d3d7
ReGamedll
ReGameDLL version: 5.9.0.362-dev
Build date: 20:19:32 Jun 21 2019
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/b669a39
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.0.133 ini Start Never
[ 2] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 3] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 4] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5249 ini Start ANY
[ 5] Revoice RUN - revoice_mm_i386.so v0.1.0.32 ini Start Never
[ 6] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 7] MySQL RUN - mysql_amxx_i386.so v1.9.0.5249 pl4 ANY ANY
[ 8] ReAPI RUN - reapi_amxx_i386.so v5.9.0.171-dev pl4 ANY Never
[ 9] Engine RUN - engine_amxx_i386.so v1.9.0.5249 pl4 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5249 pl4 ANY ANY
[11] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5249 pl4 ANY ANY
[12] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5249 pl4 ANY ANY
[13] hackdetector RUN - hackdetector_amxx_i386.so v0.15.328.lite pl4 ANY ANY
[14] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5249 pl4 ANY ANY
[15] Fun RUN - fun_amxx_i386.so v1.9.0.5249 pl4 ANY ANY
15 plugins, 15 running
Список плагинов
[  1]admin_loader-055-183                   unknown     unknown            running
[ 2]fb_web_online unknown unknown running
[ 3] FreshBans 1.4.2b kanagava fresh_bans_142_ running
[ 4] fb_forwards 0.1.4 Kanagava & Realu fb_forwards.amx running
[ 5] Admin Commands 1.9.0.5249 AMXX Dev Team admincmd.amxx running
[ 6] Admin Help 1.9.0.5249 AMXX Dev Team adminhelp.amxx running
[ 7] Slots Reservation 1.9.0.5249 AMXX Dev Team adminslots.amxx running
[ 8] Multi-Lingual System 1.9.0.5249 AMXX Dev Team multilingual.am running
[ 9] Menus Front-End 1.9.0.5249 AMXX Dev Team menufront.amxx running
[ 10] Commands Menu 1.9.0.5249 AMXX Dev Team cmdmenu.amxx running
[ 11] Players Menu 1.9.0.5249 AMXX Dev Team plmenu.amxx running
[ 12] Maps Menu 1.9.0.5249 AMXX Dev Team mapsmenu.amxx running
[ 13] Plugin Menu 1.9.0.5249 AMXX Dev Team pluginmenu.amxx running
[ 14] Reklama 09.07.2019 mx?! reklama.amxx running
[ 15] Admin Chat 1.9.0.5249 AMXX Dev Team adminchat.amxx running
[ 16] Anti Flood 1.9.0.5249 AMXX Dev Team antiflood.amxx running
[ 17] Scrolling Message 1.9.0.5249 AMXX Dev Team scrollmsg.amxx running
[ 18] Info. Messages 1.9.0.5249 AMXX Dev Team imessage.amxx running
[ 19] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 20] NextMap 1.9.0.5249 AMXX Dev Team nextmap.amxx running
[ 21] TimeLeft 1.9.0.5249 AMXX Dev Team timeleft.amxx running
[ 22] Pause Plugins 1.9.0.5249 AMXX Dev Team pausecfg.amxx running
[ 23] Stats Configuration 1.9.0.5249 AMXX Dev Team statscfg.amxx running
[ 24] StatsX 1.9.0.5249 AMXX Dev Team statsx.amxx running
[ 25] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 26] Spectator Bots 2.1 SISA s_b.amxx running
[ 27] Micro Army Rank System 1.29Hz_p1 Ge3eR mars.amxx running
[ 28] unknown unknown unknown ExCLuSiVe_CSDM. running
[ 29] Connect Info 1.0 Hypa_[KZ] connect_info.am running
[ 30] Parachute 1.1 Random1, 93()|29 sub_parachute.a running
[ 31] AFK Control ReNew 1.2(a) neygomon afk_control.amx running
[ 32] Advanced Kill Assists 0.9 Spection next21_kill_ass running
[ 33] Ping Checker 26.0.1 RC1 h1k3 ping_checker.am running
[ 34] Show Damage 1.0 neygomon damager.amxx running
[ 35] Screen Fade [True Flas 1.0 Leo_[BH] screen_fade_fla running
[ 36] AntiFlash FINAL 5.0 Leo_[BH] antiflash5.amxx running
[ 37] Ultimate Gore 1.6 JTP10181 amx_gore_ultima running
[ 38] Reset Score and Sound 1.0 Silence NewResetScore.a running
[ 39] Voteban CSR 0.8.5beta Leo_[BH] csr_voteban.amx running
[ 40] Demo Recorder 1.6 Sho0ter demorecorder.am running
[ 41] Time Lights 1.1 Leo_[BH] time_light.amxx running
[ 42] Simple Grenade Trail 1.0 seroff granade_trail.a running
[ 43] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
[ 44] PLUGIN VERSION AUTHOR hidetimer.amxx running
[ 45] Weapon Skin System 0.7.0-55 Mistrick weapon_skin_sys running
[ 46] Map Manager: Core 3.0.5 Mistrick map_manager_cor running
[ 47] Map Manager: Scheduler 0.1.3 Mistrick map_manager_sch running
[ 48] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[ 49] Map Manager: Nominatio 0.1.2 Mistrick map_manager_nom running
[ 50] Map Manager: BlockList 0.0.3 Mistrick map_manager_blo running
[ 51] Map Manager: Online so 0.0.2 Mistrick map_manager_onl running
[ 52] Map Manager: Effects 0.0.8 Mistrick map_manager_eff running
[ 53] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
53 plugins, 53 running
Автор плагина
Mistrick
Версия плагина
0.7.0-55
Исходный код
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Weapon Skin System"
#define VERSION "0.7.0-55"
#define AUTHOR "Mistrick"

#pragma semicolon 1

#define DEFAULT_SKIN_MENU

#define MODEL_NOT_SET 0

#define is_valid_pev(%0) (pev_valid(%0) == 2)
#define get_weapon_skin(%0) pev(%0, pev_iuser4)
#define set_weapon_skin(%0,%1) set_pev(%0, pev_iuser4, %1)

const XO_CBASEPLAYER = 5;
const XO_CBASEPLAYERWEAPON = 4;

const m_pPlayer = 41;
const m_pNext = 42;
const m_iId = 43;
const m_pActiveItem = 373;
const m_rgpPlayerItems_CWeaponBox = 34;
const m_rgpPlayerItems_CBasePlayer = 367;

enum Forwards
{
WEAPON_DEPLOY,
WEAPON_HOLSTER,
WEAPON_CAN_PICKUP,
WEAPON_DROP,
WEAPON_ADD_TO_PLAYER
};

enum
{
ADD_BY_WEAPONBOX,
ADD_BY_ARMORY_ENTITY,
ADD_BY_BUYZONE
};

enum
{
WEAPON_MODEL_IGNORED,
WEAPON_MODEL_CHANGED
};

new g_iForwards[Forwards];
new Float:g_flLastTouchTime;
new bool:g_bIgnoreSetModel = true;

enum _:SkinInfo
{
WeaponID,
SkinName[32],
ModelV,
ModelP,
ModelW[64]
};

new const FILE_MODELS[] = "weapon_skins.ini";

new Array:g_aWeaponSkins;
new g_LoadedWeapons;
new g_iWeaponSkinsCount;
new g_iPlayerSkins[33][32];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

#if defined DEFAULT_SKIN_MENU
register_clcmd("say /skins", "Command_ChangeSkin");
register_clcmd("say /skinreset", "Command_ResetSkin");
#endif // DEFAULT_SKIN_MENU

// forward cs_weapon_deploy(id, weapon, weaponid, skin);
g_iForwards[WEAPON_DEPLOY] = CreateMultiForward("wss_weapon_deploy", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL);

// forward cs_weapon_holster(id, weapon, weaponid, skin);
g_iForwards[WEAPON_HOLSTER] = CreateMultiForward("wss_weapon_holster", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL);

// forward cs_weapon_can_pickup(id, weaponbox, weapon, weaponid, skin);
// should return 1 for block pickup
g_iForwards[WEAPON_CAN_PICKUP] = CreateMultiForward("wss_weapon_can_pickup", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL);

// forward cs_weapon_drop(id, weaponbox, weapon, weaponid, skin);
g_iForwards[WEAPON_DROP] = CreateMultiForward("wss_weapon_drop", ET_CONTINUE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL);

RegisterWeapons();
RegisterWeaponDrop();
}

RegisterWeapons()
{
for(new i = CSW_P228, weapon_name[32]; i <= CSW_P90; i++)
{
if(get_weaponname(i, weapon_name, charsmax(weapon_name)))
{
RegisterHam(Ham_Item_Deploy, weapon_name, "Ham_WeaponDeploy_Post", .Post = true);
RegisterHam(Ham_Item_Holster, weapon_name, "Ham_WeaponHolster_Post", .Post = true);
RegisterHam(Ham_Item_AddToPlayer, weapon_name, "Ham_WeaponAddToPlayer_Post", .Post = true);
}
}
register_touch("armoury_entity", "player", "CArmouryEntity__Touch");
register_touch("weaponbox", "player", "CWeaponBox__Touch");
}
RegisterWeaponDrop()
{
RegisterHam(Ham_Spawn, "grenade", "Ham_WeaponSpawn_Post", .Post = true);
RegisterHam(Ham_Spawn, "weaponbox", "Ham_WeaponSpawn_Post", .Post = true);
register_forward(FM_SetModel, "FM_SetModel_Pre", ._post = false);
}

public plugin_precache()
{
new file_path[128]; get_localinfo("amxx_configsdir", file_path, charsmax(file_path));
format(file_path, charsmax(file_path), "%s/%s", file_path, FILE_MODELS);

new file = fopen(file_path, "rt");

if(!file)
{
set_fail_state("File not found!");
}

g_aWeaponSkins = ArrayCreate(SkinInfo, 1);

// forward wss_loaded_skin(index, weaponid, name[]);
new fwd = CreateMultiForward("wss_loaded_skin", ET_IGNORE, FP_CELL, FP_CELL, FP_STRING);

new buffer[256], weapon_name[32], skin_name[32], model_v[64], model_p[64], model_w[64];
new weaponid, skin_info[SkinInfo];
new ret;

while(!feof(file))
{
fgets(file, buffer, charsmax(buffer));

if(!buffer[0] || buffer[0] == ';') continue;

parse(buffer, weapon_name, charsmax(weapon_name), skin_name, charsmax(skin_name), model_v, charsmax(model_v), model_p, charsmax(model_p), model_w, charsmax(model_w));
weaponid = get_weapon_csw(weapon_name);

if(!weaponid) continue;

skin_info[WeaponID] = weaponid;

g_LoadedWeapons |= (1 << weaponid);

if(model_v[0] && file_exists(model_v))
{
skin_info[ModelV] = engfunc(EngFunc_AllocString, model_v);
precache_model(model_v);
}
if(model_p[0] && file_exists(model_p))
{
skin_info[ModelP] = engfunc(EngFunc_AllocString, model_p);
precache_model(model_p);
}
if(model_w[0] && file_exists(model_w))
{
copy(skin_info[ModelW], charsmax(skin_info[ModelW]), model_w);
precache_model(model_w);
}
copy(skin_info[SkinName], charsmax(skin_info[SkinName]), skin_name);

ExecuteForward(fwd, ret, g_iWeaponSkinsCount + 1, weaponid, skin_name);

ArrayPushArray(g_aWeaponSkins, skin_info);
g_iWeaponSkinsCount++;

skin_info[ModelV] = MODEL_NOT_SET; skin_info[ModelP] = MODEL_NOT_SET; skin_info[ModelW] = MODEL_NOT_SET;
}

fclose(file);

if(!g_iWeaponSkinsCount)
{
ArrayDestroy(g_aWeaponSkins);
set_fail_state("File is empty!");
}
}

public plugin_natives()
{
register_library("weapon_skin_system");
register_native("wss_register_weapon", "native_register_weapon");
register_native("wss_get_weapon_skin_index", "native_get_weapon_skin_index");
register_native("wss_set_weapon_skin_index", "native_set_weapon_skin_index");
register_native("wss_get_skin_name", "native_get_skin_name");
register_native("wss_set_user_skin", "native_set_user_skin");
}

// TODO: add call forward?
// native wss_register_weapon(weaponid, skinname[], model_v[], model_p[], model_w[]);
public native_register_weapon(plugin, params)
{
enum {
arg_weaponid = 1,
arg_skinname,
arg_model_v,
arg_model_p,
arg_model_w
};

new skin_info[SkinInfo], model[64];
skin_info[WeaponID] = get_param(arg_weaponid);

g_LoadedWeapons |= (1 << skin_info[WeaponID]);

get_string(arg_model_v, model, charsmax(model));
if(model[0] && file_exists(model))
{
skin_info[ModelV] = engfunc(EngFunc_AllocString, model);
precache_model(model);
}
get_string(arg_model_p, model, charsmax(model));
if(model[0] && file_exists(model))
{
skin_info[ModelP] = engfunc(EngFunc_AllocString, model);
precache_model(model);
}
get_string(arg_model_w, model, charsmax(model));
if(model[0] && file_exists(model))
{
copy(skin_info[ModelW], charsmax(skin_info[ModelW]), model);
precache_model(model);
}
get_string(arg_skinname, skin_info[SkinName], charsmax(skin_info[SkinName]));

// ExecuteForward(fwd, ret, g_iWeaponSkinsCount + 1, weaponid, skin_name);

ArrayPushArray(g_aWeaponSkins, skin_info);
g_iWeaponSkinsCount++;

return g_iWeaponSkinsCount;
}

// native wss_get_weapon_skin_index(weapon);
public native_get_weapon_skin_index(plugin, params)
{
enum { arg_weapon = 1 };

new weapon = get_param(arg_weapon);

return get_weapon_skin(weapon);
}

// native wss_set_weapon_skin_index(weapon);
public native_set_weapon_skin_index(plugin, params)
{
enum {
arg_weapon = 1,
arg_skin
};

set_weapon_skin(get_param(arg_weapon), get_param(arg_skin));
}

// native wss_get_skin_name(skin, name[], len);
public native_get_skin_name(plugin, params)
{
enum
{
arg_skin = 1,
arg_name,
arg_len
};

new skin = get_param(arg_skin);

if(skin < 1 || skin > g_iWeaponSkinsCount)
{
log_error(AMX_ERR_NATIVE, "[WSS] Get skin name: wrong skin index! index %d", skin);
return 0;
}

new skin_info[SkinInfo];
ArrayGetArray(g_aWeaponSkins, skin - 1, skin_info);
set_string(arg_name, skin_info[SkinName], get_param(arg_len));

return 1;
}

// native wss_set_user_skin(id, weaponid, skin_index);
public native_set_user_skin(plugin, params)
{
enum
{
arg_id = 1,
arg_weaponid,
arg_skin_index
};

new id = get_param(arg_id);
new weaponid = get_param(arg_weaponid);
new skin_index = get_param(arg_skin_index);

if(id < 1 || id > 32)
{
log_error(AMX_ERR_NATIVE, "[WSS] Set user skin: wrong player index! index %d", id);
return 0;
}

if(!weaponid)
{
arrayset(g_iPlayerSkins[id], 0, sizeof(g_iPlayerSkins[]));
return 1;
}

g_iPlayerSkins[id][weaponid] = skin_index;

return 1;
}

public client_connect(id)
{
arrayset(g_iPlayerSkins[id], 0, sizeof(g_iPlayerSkins[]));
}

#if defined DEFAULT_SKIN_MENU
public Command_ChangeSkin(id)
{
new menu = menu_create("Skin Menu", "SkinMenu_Handler");

new skin_info[SkinInfo];
for(new i; i < g_iWeaponSkinsCount; i++)
{
ArrayGetArray(g_aWeaponSkins, i, skin_info);
menu_additem(menu, skin_info[SkinName]);
}
menu_display(id, menu);
}
public SkinMenu_Handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}

new skin_info[SkinInfo];
ArrayGetArray(g_aWeaponSkins, item, skin_info);

g_iPlayerSkins[id][skin_info[WeaponID]] = item + 1;

new weapon, weaponid;
new cur_weapon = get_pdata_cbase(id, m_pActiveItem, XO_CBASEPLAYER);

#define MAX_ITEM_SLOTS 6

for(new i; i < MAX_ITEM_SLOTS; i++)
{
weapon = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer + i, XO_CBASEPLAYER);

while (is_valid_pev(weapon))
{
weaponid = get_pdata_int(weapon, m_iId, XO_CBASEPLAYERWEAPON);

if(weaponid == skin_info[WeaponID])
{
set_weapon_skin(weapon, item + 1);

if(weapon == cur_weapon)
{
if(skin_info[ModelV]) set_pev(id, pev_viewmodel, skin_info[ModelV]);
if(skin_info[ModelP]) set_pev(id, pev_weaponmodel, skin_info[ModelP]);
}
// stop cycles
i = MAX_ITEM_SLOTS; break;
}

weapon = get_pdata_cbase(weapon, m_pNext, XO_CBASEPLAYERWEAPON);
}
}

menu_destroy(menu);
return PLUGIN_HANDLED;
}

public Command_ResetSkin(id)
{
static weapons[][] =
{
"", "weapon_p228", "weapon_shield", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4",
"weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45",
"weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy",
"weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle",
"weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90"
};

new menu = menu_create("Skin Reset", "SkinReset_Handler");

for(new i = 1, num[2]; i < 32; i++)
{
if(g_LoadedWeapons & (1 << i) && g_iPlayerSkins[id][i])
{
num[0] = i;
menu_additem(menu, weapons[i], num);
}
}

menu_display(id, menu);
}

public SkinReset_Handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}

new info[2], buffer;
menu_item_getinfo(menu, item, buffer, info, charsmax(info), .callback = buffer);

new weaponid = info[0];

g_iPlayerSkins[id][weaponid] = 0;

menu_destroy(menu);
return PLUGIN_HANDLED;
}
#endif // DEFAULT_SKIN_MENU

public Ham_WeaponDeploy_Post(const weapon)
{
new id = get_pdata_cbase(weapon, m_pPlayer, XO_CBASEPLAYERWEAPON);
new weaponid = get_pdata_int(weapon, m_iId, XO_CBASEPLAYERWEAPON);

#if defined _DEBUG
client_print(0, print_chat, "deploy: id %d, weapon %d, weaponid %d", id, weapon, weaponid);
#endif // _DEBUG

new skin = get_weapon_skin(weapon);
if(skin)
{
new skin_info[SkinInfo];
ArrayGetArray(g_aWeaponSkins, skin - 1, skin_info);
if(skin_info[ModelV]) set_pev(id, pev_viewmodel, skin_info[ModelV]);
if(skin_info[ModelP]) set_pev(id, pev_weaponmodel, skin_info[ModelP]);

new ret; ExecuteForward(g_iForwards[WEAPON_DEPLOY], ret, id, weapon, weaponid, skin);
}
}

public Ham_WeaponHolster_Post(const weapon)
{
new id = get_pdata_cbase(weapon, m_pPlayer, XO_CBASEPLAYERWEAPON);
new weaponid = get_pdata_int(weapon, m_iId, XO_CBASEPLAYERWEAPON);

#if defined _DEBUG
client_print(0, print_chat, "holster: id %d, weapon %d, weaponid %d", id, weapon, weaponid);
#endif // _DEBUG

new skin = get_weapon_skin(weapon);
if(skin)
{
new ret; ExecuteForward(g_iForwards[WEAPON_HOLSTER], ret, id, weapon, weaponid, skin);
}
}

public CArmouryEntity__Touch(ent, id)
{
g_flLastTouchTime = get_gametime();
}

public CWeaponBox__Touch(ent, id)
{
#define MAX_ITEM_TYPES 6

for(new i, weapon; i < MAX_ITEM_TYPES; i++)
{
weapon = get_pdata_cbase(ent, m_rgpPlayerItems_CWeaponBox + i, XO_CBASEPLAYERWEAPON);

if(is_valid_pev(weapon))
{
new weaponid = get_pdata_int(weapon, m_iId, XO_CBASEPLAYERWEAPON);

new skin = get_weapon_skin(weapon);
if(skin)
{
#if defined _DEBUG
client_print(0, print_chat, "can pickup: id %d, weaponbox %d, weapon %d, weaponid %d", id, ent, weapon, weaponid);
#endif // _DEBUG

new ret; ExecuteForward(g_iForwards[WEAPON_CAN_PICKUP], ret, id, ent, weapon, weaponid, skin);

if(ret)
{
return PLUGIN_HANDLED;
}
}
}
}

return PLUGIN_CONTINUE;
}

public Ham_WeaponAddToPlayer_Post(const weapon, const id)
{
new weaponid = get_pdata_int(weapon, m_iId, XO_CBASEPLAYERWEAPON);

#if defined _DEBUG
client_print(0, print_chat, "add_to_player: id %d, weapon %d, weaponid %d", id, weapon, weaponid);
#endif // _DEBUG

new type;

if (pev(weapon, pev_owner) > 0)
{
type = ADD_BY_WEAPONBOX;
}
else if(get_gametime() == g_flLastTouchTime)
{
type = ADD_BY_ARMORY_ENTITY;
}
else
{
type = ADD_BY_BUYZONE;
}

if(type == ADD_BY_ARMORY_ENTITY || type == ADD_BY_WEAPONBOX)
{
return HAM_IGNORED;
}

if(get_weapon_skin(weapon))
{
return HAM_IGNORED;
}

if(g_iPlayerSkins[id][weaponid])
{
set_weapon_skin(weapon, g_iPlayerSkins[id][weaponid]);
}

return HAM_IGNORED;
}

public Ham_WeaponSpawn_Post(const ent)
{
if (is_valid_pev(ent))
{
g_bIgnoreSetModel = false;
}
}
public FM_SetModel_Pre(const ent)
{
if(g_bIgnoreSetModel || !is_valid_pev(ent)) return FMRES_IGNORED;

g_bIgnoreSetModel = true;

new classname[32]; pev(ent, pev_classname, classname, charsmax(classname));
if(equal(classname, "grenade"))
{
new id = pev(ent, pev_owner);
new weaponid = fm_cs_get_grenade_type(ent);

#if defined _DEBUG
client_print(0, print_chat, "throw grenade: id %d, weapon %d, weaponid %d", id, ent, weaponid);
#endif // _DEBUG

new ret = cs_weapon_drop(id, ent, ent, weaponid);

if(ret)
{
return FMRES_SUPERCEDE;
}

return FMRES_IGNORED;
}

#define MAX_ITEM_TYPES 6

for(new i, weapon; i < MAX_ITEM_TYPES; i++)
{
weapon = get_pdata_cbase(ent, m_rgpPlayerItems_CWeaponBox + i, XO_CBASEPLAYERWEAPON);

if(is_valid_pev(weapon))
{
new id = pev(ent, pev_owner);
new weaponid = get_pdata_int(weapon, m_iId, XO_CBASEPLAYERWEAPON);

#if defined _DEBUG
client_print(0, print_chat, "drop: id %d, weaponbox %d, weapon %d, weaponid %d", id, ent, weapon, weaponid);
#endif // _DEBUG

new ret = cs_weapon_drop(id, ent, weapon, weaponid);

if(ret)
{
return FMRES_SUPERCEDE;
}
}
}

return FMRES_IGNORED;
}

cs_weapon_drop(id, weaponbox, weapon, weaponid)
{
new skin = get_weapon_skin(weapon);
if(skin)
{
new skin_info[SkinInfo];
ArrayGetArray(g_aWeaponSkins, skin - 1, skin_info);
engfunc(EngFunc_SetModel, weaponbox, skin_info[ModelW]);

new ret; ExecuteForward(g_iForwards[WEAPON_DROP], ret, id, weaponbox, weapon, weaponid, skin);

return WEAPON_MODEL_CHANGED;
}
return WEAPON_MODEL_IGNORED;
}

stock get_weapon_csw(weapon_name[])
{
static weapons[][] =
{
"", "weapon_p228", "weapon_shield", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4",
"weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45",
"weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy",
"weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle",
"weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90"
};

for(new i = 1; i < sizeof(weapons); i++)
{
if(equali(weapon_name, weapons[i]))
{
return i;
}
}

return 0;
}

// work only for "grenade" classname
stock fm_cs_get_grenade_type(index)
{
const m_iTeam = 114;
new bits = get_pdata_int(index, m_iTeam);

if (bits & (1 << 0))
return CSW_HEGRENADE;
else if (bits & (1 << 1))
return CSW_SMOKEGRENADE;
else if (!bits)
return CSW_FLASHBANG;

return 0;
}
Помогите решить проблему с плагином Weapon Skin System 0.7.0-55 не работает команда /skinreset - сброс модели для оружия. Оставляю ссылку на плагин от https://dev-cs.ru/resources/104/ . В заранее спасибо!
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
3,569
Реакции
1,560
Помог
133 раз(а)
newcs, ошибки в логах сервера имеются? Связанные с этим плагином
 
Сообщения
2,491
Реакции
2,794
Помог
61 раз(а)
newcs, а если переключится на другое оружие и обратно?
 
Сообщения
67
Реакции
1
Помог
1 раз(а)
sbelov020, Нет ошибок нет в этом то все и дело!
2 Окт 2019
fantom, так все работает, но не возвращает на стандартный скин оружия.
 
Сообщения
2,491
Реакции
2,794
Помог
61 раз(а)
newcs, тоесть работает, но не возвращает? Оно должно при новом деплое оружия вернуть скин по умолчанию. А если не возвращает, то скорей всего у вас конфликт с другим плагином
 
Сообщения
141
Реакции
201
Помог
5 раз(а)
так и было задумано (скорее всего)
 
Сообщения
333
Реакции
290
Помог
9 раз(а)
так все работает, но не возвращает на стандартный скин оружия
Как, по вашему, он должен его возвращать? Новые настройки скина действуют только на вновь получаемое оружие. У вас после новой покупки скин остается?
 
Сообщения
584
Реакции
1,006
Помог
18 раз(а)
Скин сбрасывается при покупке нового оружия. Если у кого-то оружие со скином, то скин так и останется.
Цель была привязать модель к оружию, а не ставить модель конкретному игроку. Вы дропаете оружие со скином, если его берет игрок с другим скином на данное оружие, то у него будет изначальный скин, а не то привязанный для второго игрока.
 
  • Нравится
Реакции: Ayk
Сообщения
67
Реакции
1
Помог
1 раз(а)
Mistrick, ну вот и встало все на свои места, теперь понял. Спасибо за ответ!
 
Статус
В этой теме нельзя размещать новые ответы.

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

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