sf_level_skins

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
345
Реакции
77
Помог
14 раз(а)
Ошибка
Сбрасывается нож
ОС
Linux
Amx Mod X
AMX Mod X 1.8.3-dev+5201 (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: Sep 1 2018 09:52:22
Built from: https://github.com/alliedmodders/amxmodx/commit/8c0f97d
Build ID: 5201:8c0f97d
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.4.0.668-dev
Build date: 17:58:00 Oct 5 2018 (1637)
Build from: https://github.com/dreamstalker/rehlds/commit/89be216
ReGamedll
ReGameDLL version: 5.7.0.318-dev
Build date: 21:07:26 Oct 30 2018
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/932001b
Версия 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
Список метамодулей
[ 1] Reunion          RUN   -    reunion_mm_i386.so         v0.1.0.92        ini  Start Never
[ 2] Rechecker RUN - rechecker_mm_i386.so v2.5 ini Chlvl ANY
[ 3] hackdetector RUN - hackdetector_amxx_i386.so v0.15.328.lite ini ANY ANY
[ 4] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC3 ini ANY ANY
[ 5] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 6] AMX Mod X RUN - amxmodx_mm_i386.so v1.8.3-dev+5201 ini Start ANY
[ 7] ReParachute RUN - parachute_amxx_i386.so v1.1 Beta pl6 ANY ANY
[ 8] ReAPI RUN - reapi_amxx_i386.so v5.6.0.159-dev pl6 ANY Never
[ 9] MySQL RUN - mysql_amxx_i386.so v1.8.3-dev+5201 pl6 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.8.3-dev+5201 pl6 ANY ANY
[11] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.8.3-dev+5201 pl6 ANY ANY
[12] CStrike RUN - cstrike_amxx_i386.so v1.8.3-dev+5201 pl6 ANY ANY
[13] Engine RUN - engine_amxx_i386.so v1.8.3-dev+5201 pl6 ANY ANY
[14] Fun RUN - fun_amxx_i386.so v1.8.3-dev+5201 pl6 ANY ANY
14 plugins, 14 running
Список плагинов
[  1] Admin Loader            3.4         neygomon          admin_loader.am  running  
[ 2] FreshBans 1.4.0b kanagava fresh_bans_140_ running
[ 3] Aliases checker 0.8.2 kanagava alias_detector0 running
[ 4] Teleport Menu 1.8.3-dev+ AMXX Dev Team telemenu.amxx running
[ 5] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am running
[ 6] Stats Configuration 1.8.3-dev+ AMXX Dev Team statscfg.amxx running
[ 7] Admin Commands 1.8.3-dev+ AMXX Dev Team admincmd.amxx running
[ 8] Ultimate Chats Control 4.5 neygomon ucc.amxx running
[ 9] Players Menu 1.7 neugomon players_menu.am running
[ 10] [SWPlug] Knife Duel 1.0 Trendy swp_2.amxx debug
[ 11] menufront_cheto_tam 99 grust' <3 menufront_end.a running
[ 12] Shop for Knife 1.0 bristol shop_knife.amxx running
[ 13] FrostNades 2.09 Avalanche frostnades.amxx running
[ 14] Knife DeathMatch: VIP 1.0.3 Salvatore vipmenu.amxx running
[ 15] [Reapi] Custom Models 1.6.1 neygomon custom_models.a running
[ 16] [ReAPI] SF Level Skins 0.1 serfreeman1337 sf_level_skins. running
[ 17] Spec Money Save 0.2 F@nt0M spec_money_save running
[ 18] DemoRecoder 1.2 neygomon amx_demorec.amx running
[ 19] Ping Checker 26.0.1 RC1 h1k3 ping_checker.am running
[ 20] Kill Distance (mod) 0.3f Nightscream kill_distance_m running
[ 21] NoRound Balancer 1.3a neygomon noround_balance running
[ 22] menu 1 grust' <3 menu.amxx running
[ 23] Change Team 1.0 neygomon changeteam.amxx running
[ 24] resetscore(ReAPI) 1.0 Phantom resetscore.amxx running
[ 25] Train Killer 1.0 Pastout! trainkiller_1.a running
[ 26] CamChenger 1.0 qazwsxedc CamChenger.amxx running
[ 27] Bhop Menu 1.2a gyxoBka BhopMenu.amxx running
[ 28] Hook 1.0 xxx hook.amxx running
[ 29] Invise Water IDK IDK hide_water.amxx running
[ 30] [ReAPI] Block 'Fire in 0.0.1 sergrib reapi_block_FIT running
[ 31] BlockRadio 1.1 Phantom block_radio.amx running
[ 32] NameChangeTime 0.0.1 Vaqtincha block_change_ni running
[ 33] Rules Menu 1.1 nacya RulesMenu_2.amx running
[ 34] gram_naciya 1.0 grus' <3 vrode_grab.amxx running
[ 35] Snowball 0.6 alpha s1lent snowball.amxx running
[ 36] Menu Greetings 1.0 OverGame mg.amxx running
[ 37] [KH] System XmasTree 1.0 Kulogram KH_System_Xmas_ debug
[ 38] gifts 0.8.1 Psycrow next21_gifts.am running
[ 39] Night Sky + Lighint 1.0 Leo_[BH] night_sky.amxx running
[ 40] Chat Manager 1.1.1-11 Mistrick chatmanager.amx running
[ 41] Chat Manager: Addon 0.0.4-70 Mistrick chatmanager_add running
[ 42] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 43] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 44] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 45] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
45 plugins, 45 running
Автор плагина
serfreeman1337
Версия плагина
0.1
Исходный код
#include <amxmodx>
#include <aes_v>
#include <reapi>
#include <fakemeta>
#include <hamsandwich>
#include <nvault>

/*
new l = 18

public aes_get_player_level(id) {
return l
}*/


enum _:skin_info_struct {
SKIN_LEVEL_FROM,
SKIN_LEVEL_TO,
SKIN_WEAPON_NAME[32],
SKIN_V_MODEL[256],
SKIN_W_MODEL[256],
SKIN_P_MODEL[256],
SKIN_NAME[64]
}

enum _:plrmodel_info_struct {
PLRSKIN_LEVEL_FROM,
PLRSKIN_LEVEL_TO,
PLRSKIN_NAME[32],
PLRSKIN_MODEL_T[32],
PLRSKIN_MODEL_CT[32]
}

enum _:weapon_models_struct {
bool:SKIN_ON,
SKIN_ID
}

enum _:player_models_struct {
MODEL_T[32],
MODEL_CT[32]
}

new player_weapon_models[MAX_PLAYERS + 1][33][weapon_models_struct]
new player_models[MAX_PLAYERS + 1][player_models_struct]

new Array:weapon_skins
new weapon_skins_length

new Array:player_skins
new player_skins_length

new prm_menu
new skn_menu_cb
new plr_menu_cb

new const VAULT_NAME[] = "sf_weapon_skins";

public plugin_precache() {
register_plugin("[ReAPI] SF Level Skins", "0.1", "serfreeman1337")

weapon_skins = ArrayCreate(skin_info_struct)
player_skins = ArrayCreate(plrmodel_info_struct)

new f = fopen("addons/amxmodx/configs/sf_level_skins.ini", "r")

new Trie:is_hooked = TrieCreate()
new read_buffer[1024],current_section = 0

while(!feof(f)) {
fgets(f, read_buffer, charsmax(read_buffer))
trim(read_buffer)

if(!read_buffer[0] || read_buffer[0] == ';') {
continue
}

if(strcmp(read_buffer, "[WEAPON]") == 0) {
current_section = 1
continue
} else if(strcmp(read_buffer, "[PLAYER]") == 0) {
current_section = 2
continue
}

switch(current_section) {
case 1: {
new s_level[21], skin_info[skin_info_struct]

parse(read_buffer,
s_level, charsmax(s_level),
skin_info[SKIN_WEAPON_NAME], charsmax(skin_info[SKIN_WEAPON_NAME]),
skin_info[SKIN_V_MODEL], charsmax(skin_info[SKIN_V_MODEL]),
skin_info[SKIN_W_MODEL], charsmax(skin_info[SKIN_W_MODEL]),
skin_info[SKIN_P_MODEL], charsmax(skin_info[SKIN_P_MODEL]),
skin_info[SKIN_NAME], charsmax(skin_info[SKIN_NAME])
)

if(FindWeaponSkinByName(skin_info[SKIN_NAME]) != -1) {
server_print("Weapon skin with name ^"%s^" has already been added!", skin_info[SKIN_NAME]);
continue;
}

new s_lvl_from[10], s_lvl_to[10]
strtok(s_level, s_lvl_from, charsmax(s_lvl_from), s_lvl_to, charsmax(s_lvl_to), '-')

skin_info[SKIN_LEVEL_FROM] = str_to_num(s_lvl_from)
skin_info[SKIN_LEVEL_TO] = str_to_num(s_lvl_to)

if(skin_info[SKIN_V_MODEL][0]) {
if(file_exists(skin_info[SKIN_V_MODEL])) {
precache_model(skin_info[SKIN_V_MODEL])
} else {
log_amx("weapon model file ^"%s^" not found",
skin_info[SKIN_V_MODEL])
skin_info[SKIN_V_MODEL][0] = 0
}
}

if(skin_info[SKIN_W_MODEL][0]) {
if(file_exists(skin_info[SKIN_W_MODEL])) {
precache_model(skin_info[SKIN_W_MODEL])
} else {
log_amx("weapon model file ^"%s^" not found",
skin_info[SKIN_W_MODEL])
skin_info[SKIN_W_MODEL][0] = 0
}
}

if(skin_info[SKIN_P_MODEL][0]) {
if(file_exists(skin_info[SKIN_P_MODEL])) {
precache_model(skin_info[SKIN_P_MODEL])
} else {
log_amx("weapon model file ^"%s^" not found",
skin_info[SKIN_P_MODEL])
skin_info[SKIN_P_MODEL][0] = 0
}
}

ArrayPushArray(weapon_skins, skin_info)
weapon_skins_length ++

if(!TrieKeyExists(is_hooked, skin_info[SKIN_WEAPON_NAME])) {
RegisterHam(Ham_Item_Deploy, skin_info[SKIN_WEAPON_NAME], "Hook_WeaponDeploy", true)
RegisterHam(Ham_Item_AddToPlayer, skin_info[SKIN_WEAPON_NAME], "Hook_WeaponAddToPlayer", true)

TrieSetCell(is_hooked, skin_info[SKIN_WEAPON_NAME], true)
}
}
case 2: {
new s_level[21], plr_skin_info[plrmodel_info_struct], mdl_path[256]
parse(read_buffer, s_level, charsmax(s_level), plr_skin_info[PLRSKIN_MODEL_T], charsmax(plr_skin_info[PLRSKIN_MODEL_T]), plr_skin_info[PLRSKIN_MODEL_CT], charsmax(plr_skin_info[PLRSKIN_MODEL_CT]), plr_skin_info[PLRSKIN_NAME], charsmax(plr_skin_info[PLRSKIN_NAME]))

if(FindPlayerSkinByName(plr_skin_info[PLRSKIN_NAME])) {
server_print("Player skin with name ^"%s^" has already been added!", plr_skin_info[PLRSKIN_NAME]);
continue;
}

new s_lvl_from[10], s_lvl_to[10]
strtok(s_level, s_lvl_from, charsmax(s_lvl_from), s_lvl_to, charsmax(s_lvl_to), '-')

plr_skin_info[PLRSKIN_LEVEL_FROM] = str_to_num(s_lvl_from)
plr_skin_info[PLRSKIN_LEVEL_TO] = str_to_num(s_lvl_to)

formatex(mdl_path, charsmax(mdl_path), "models/player/%s/%s.mdl", plr_skin_info[PLRSKIN_MODEL_T], plr_skin_info[PLRSKIN_MODEL_T])

if(file_exists(mdl_path)) {
precache_model(mdl_path)

formatex(mdl_path, charsmax(mdl_path), "models/player/%s/%sT.mdl", plr_skin_info[PLRSKIN_MODEL_T], plr_skin_info[PLRSKIN_MODEL_T])

if(file_exists(mdl_path)) {
precache_model(mdl_path)
}
} else {
log_amx("player model file ^"%s^" not found", mdl_path)
plr_skin_info[PLRSKIN_MODEL_T][0] = 0
}

formatex(mdl_path, charsmax(mdl_path), "models/player/%s/%s.mdl", plr_skin_info[PLRSKIN_MODEL_CT], plr_skin_info[PLRSKIN_MODEL_CT])

if(file_exists(mdl_path)) {
precache_model(mdl_path)

formatex(mdl_path, charsmax(mdl_path), "models/player/%s/%sT.mdl", plr_skin_info[PLRSKIN_MODEL_CT], plr_skin_info[PLRSKIN_MODEL_CT])

if(file_exists(mdl_path)) {
precache_model(mdl_path)
}
} else {
log_amx("player model file ^"%s^" not found", mdl_path)
plr_skin_info[PLRSKIN_MODEL_CT][0] = 0
}

//new item_info[20]
//formatex(item_info, charsmax(item_info), "%d:%d", str_to_num(s_level), ArraySize(player_skins))
//menu_additem(plr_menu, plr_skin_info[PLRSKIN_NAME], item_info, 0, plr_menu_cb)

ArrayPushArray(player_skins, plr_skin_info)
player_skins_length ++
}
}
}

TrieDestroy(is_hooked)

prm_menu = menu_create("\rМеню Ножей \yツ", "PrmMenu_Handler")

if(weapon_skins_length)
menu_additem(prm_menu, "Выбрать скин", "1")

if(player_skins_length)
menu_additem(prm_menu, "Скин игрока^n", "2")

if(weapon_skins_length)
menu_additem(prm_menu, "Сбросить нож", "3")

if(player_skins_length)
menu_additem(prm_menu, "Стандартный скин игрока^n", "4")

skn_menu_cb = menu_makecallback("SknMenu_Callback")
plr_menu_cb = menu_makecallback("PlrMenu_Callback")

menu_setprop(prm_menu, MPROP_EXITNAME, "\rВыход")

//register_clcmd("a", "a")
}

public client_putinserver(id) {
SetSkinsByLevel(id)
}

public aes_player_connect(id) {
if(is_user_bot(id) || is_user_hltv(id)) return;
remove_task(id);
arrayset(player_weapon_models[id][0], 0, sizeof(player_weapon_models[]) * sizeof(player_weapon_models[][]));

new data[2112];
new authid[35];
get_user_authid(id, authid, charsmax(authid));
new vault = nvault_open(VAULT_NAME);

new player_level = aes_get_player_level(id);

if(vault != -1)
{
new timestamp;
new found = nvault_lookup(vault, authid, data, charsmax(data), timestamp);
new skin_name[64];

if(found)
{
new i = 0;
new pos = 0;
new current = 0;

while(data[pos] != EOS)
{
if(data[pos] != ';')
{
skin_name[current] = data[pos];
current++;
}
if(current > charsmax(skin_name) || data[pos] == ';')
{
skin_name[current] = EOS;
if(skin_name[0] != EOS)
{
new s_id;
if((s_id = FindWeaponSkinByName(skin_name)) != -1)
{
new skin_info[skin_info_struct];
ArrayGetArray(weapon_skins, s_id, skin_info);

if(
(!skin_info[SKIN_LEVEL_TO] && player_level >= skin_info[SKIN_LEVEL_FROM]) ||
(skin_info[SKIN_LEVEL_TO] && (skin_info[SKIN_LEVEL_FROM] <= player_level <= skin_info[SKIN_LEVEL_TO]))
) {
player_weapon_models[id][i][SKIN_ON] = true
player_weapon_models[id][i][SKIN_ID] = s_id;
}
}
}
current = 0;
skin_name[current] = EOS;
i++;
}

pos++;
}
}
}
nvault_close(vault);
}

public client_disconnected(id) {
if(!is_user_bot(id) && !is_user_hltv(id)) {
new data[2112];
new skin_info[skin_info_struct];
new authid[35];

get_user_authid(id, authid, charsmax(authid));

for(new i = 0; i < sizeof(player_weapon_models[]); i++) {
if(player_weapon_models[id][i][SKIN_ON]) {
ArrayGetArray(weapon_skins, player_weapon_models[id][i][SKIN_ID], skin_info);
add(data, charsmax(data), skin_info[SKIN_NAME], charsmax(skin_info[SKIN_NAME]));
}

add(data, charsmax(data), ";", 1);
}

new vault = nvault_open(VAULT_NAME);

if(vault != -1) {
nvault_set(vault, authid, data);
nvault_close(vault);
}
}

arrayset(player_weapon_models[id][0], 0, sizeof(player_weapon_models[]) * sizeof(player_weapon_models[][]));
arrayset(player_models[id], 0, sizeof(player_models[]));
}

public aes_player_levelup(id) {
SetSkinsByLevel(id)
}

public aes_player_leveldown(id) {
SetSkinsByLevel(id)
}

public SetSkinsByLevel(id) {
if(!is_user_connected(id)) {
return
}

new player_level = aes_get_player_level(id)

if(player_level <= 0) {
set_task(1.0, "SetSkinsByLevel", id)
return
}
}

public Hook_SetModel(ent, const model[]) {
if(contain(model, "models/w_") == 0) {
new classname[32]
get_entvar(ent, var_classname, classname, charsmax(classname))

if(strcmp(classname, "weaponbox") == 0) {
new wpn = WeaponBox_FindWpn(ent)

if(wpn != -1) {
new Float:si_vec[3]
get_entvar(wpn, var_vuser4, si_vec)

if(si_vec[0] == 2.0) {
new si_id = floatround(si_vec[2])

new skin_info[skin_info_struct]
ArrayGetArray(weapon_skins, si_id, skin_info)

if(skin_info[SKIN_W_MODEL]) {
engfunc(EngFunc_SetModel, ent, skin_info[SKIN_W_MODEL])
return FMRES_SUPERCEDE
}
}
}
}
}

return FMRES_IGNORED
}

public plugin_init() {
register_forward(FM_SetModel, "Hook_SetModel")
RegisterHookChain(RG_CBasePlayer_Spawn, "Hook_PlayerSpawn", true)

register_clcmd("say /skins", "PrmMenu_Show")
register_clcmd("say_team /skins", "PrmMenu_Show")
}

public Hook_PlayerSpawn(id) {
if(player_models[id][MODEL_T][0] || player_models[id][MODEL_CT][0]) {
new mdl[32], team = get_member(id, m_iTeam)
get_user_info(id, "model", mdl, charsmax(mdl))

switch(team) {
case TEAM_TERRORIST: {
if(player_models[id][MODEL_T][0] && strcmp(mdl, player_models[id][MODEL_T]) != 0) {
rg_set_user_model(id, player_models[id][MODEL_T])
}
}
case TEAM_CT: {
if(player_models[id][MODEL_CT][0] && strcmp(mdl, player_models[id][MODEL_CT]) != 0) {
rg_set_user_model(id, player_models[id][MODEL_CT])
}
}
}
}
}

public PrmMenu_Show(id) {
#define MIN_LEVEL_FOR_MENU 1
if(aes_get_player_level(id) < MIN_LEVEL_FOR_MENU) {
client_print_color(id, print_team_red, "^4[Нация Ножей] ^1Меню доступно с^3 2 ^1уровня")
return PLUGIN_HANDLED
}

menu_display(id, prm_menu)

return PLUGIN_CONTINUE
}

public PrmMenu_Handler(id, m, item) {
if(item == MENU_EXIT) {
return PLUGIN_CONTINUE
}

new item_info[10], dummy[2]
menu_item_getinfo(m, item, dummy[0], item_info, charsmax(item_info), dummy, charsmax(dummy), dummy[0])

switch(str_to_num(item_info)) {
case 1: WpnMenu_Show(id)
case 2: PlrMenu_Show(id)
case 3: WpnSkn_Disable(id)
case 4: PlrSkn_Disable(id)
}

return PLUGIN_CONTINUE
}

public WpnSkn_Disable(id) {
if(player_weapon_models[id][CSW_KNIFE][SKIN_ON] && get_user_weapon(id) == CSW_KNIFE) {
set_entvar(id, var_viewmodel, "models/v_knife.mdl")
set_entvar(id, var_weaponmodel, "models/p_knife.mdl")
}

arrayset(player_weapon_models[id][0], 0, sizeof(player_weapon_models[]) * sizeof(player_weapon_models[][]));

client_print_color(id, print_team_red, "^4[Нация Ножей] ^1Скины оружия ^3сброшены!")
}

public PlrSkn_Disable(id) {
rg_reset_user_model(id)

player_models[id][MODEL_T][0] = 0
player_models[id][MODEL_CT][0] = 0

client_print_color(id, print_team_red, "^4[Нация Ножей] ^1Скин игрока ^3сброшен!")
}


public WpnMenu_Show(id) {
new skn_menu, player_level = aes_get_player_level(id)

for(new s_i, skin_info[skin_info_struct] ; s_i < weapon_skins_length ; s_i++) {
ArrayGetArray(weapon_skins, s_i, skin_info)

if(
(!skin_info[SKIN_LEVEL_TO] && player_level >= skin_info[SKIN_LEVEL_FROM]) ||
(skin_info[SKIN_LEVEL_TO] && (skin_info[SKIN_LEVEL_FROM] <= player_level <= skin_info[SKIN_LEVEL_TO]))
) {
if(!skn_menu) {
skn_menu = menu_create("\rМеню Ножей \yツ", "SknMenu_Handler")
}

new s_i_str[10]
num_to_str(s_i, s_i_str, charsmax(s_i_str))
menu_additem(skn_menu, "placeholder", s_i_str, 0, skn_menu_cb)
}
}

menu_setprop(skn_menu, MPROP_EXITNAME, "Назад")

if(skn_menu) {
menu_display(id, skn_menu)
} else {
}
}

public SknMenu_Handler(id, m, item) {
if(item == MENU_EXIT) {
menu_destroy(m)
menu_display(id, prm_menu)

return PLUGIN_CONTINUE
}

new item_info[10], dummy[2]
menu_item_getinfo(m, item, dummy[0], item_info, charsmax(item_info), dummy, charsmax(dummy), dummy[0])

//new player_level = aes_get_player_level(id)
new si_id = str_to_num(item_info)

new skin_info[skin_info_struct]
ArrayGetArray(weapon_skins, si_id, skin_info)

new w_id = get_weaponid(skin_info[SKIN_WEAPON_NAME])

player_weapon_models[id][w_id][SKIN_ON] = true
player_weapon_models[id][w_id][SKIN_ID] = si_id

if(w_id == CSW_KNIFE && get_user_weapon(id) == CSW_KNIFE) {
if(skin_info[SKIN_V_MODEL][0] != EOS) {
set_entvar(id, var_viewmodel, skin_info[SKIN_V_MODEL])
}
else {
set_entvar(id, var_viewmodel, "models/v_knife.mdl")
}

if(skin_info[SKIN_P_MODEL][0] != EOS) {
set_entvar(id, var_weaponmodel, skin_info[SKIN_P_MODEL])
}
else {
set_entvar(id, var_weaponmodel, "models/p_knife.mdl")
}
}

client_print_color(id, print_team_red, "^4[Нация Ножей] ^1Выбран ^3%s", skin_info[SKIN_NAME])
menu_display(id, m)

return PLUGIN_CONTINUE
}

public SknMenu_Callback(id, m, item) {
new item_info[10], dummy[2]
menu_item_getinfo(m, item, dummy[0], item_info, charsmax(item_info), dummy, charsmax(dummy), dummy[0])

//new player_level = aes_get_player_level(id)
new si_id = str_to_num(item_info)

new skin_info[skin_info_struct]
ArrayGetArray(weapon_skins, si_id, skin_info)

new w_id = get_weaponid(skin_info[SKIN_WEAPON_NAME])

if(player_weapon_models[id][w_id][SKIN_ON] && player_weapon_models[id][w_id][SKIN_ID] == si_id) {
new item_name[64]
formatex(item_name, charsmax(item_name), "\w%s \r*", skin_info[SKIN_NAME])
menu_item_setname(m, item, item_name)

return ITEM_DISABLED
} else {
menu_item_setname(m, item, skin_info[SKIN_NAME])
}

return ITEM_ENABLED
}

public PlrMenu_Show(id) {
new plr_menu = menu_create("[Скин игрока]", "PlrMenu_Handler")
new player_level = aes_get_player_level(id)

for(new i, plrmodel[plrmodel_info_struct], item_info[10] ; i < player_skins_length ; i++) {
ArrayGetArray(player_skins, i, plrmodel)

if(
(!plrmodel[PLRSKIN_LEVEL_TO] && player_level >= plrmodel[PLRSKIN_LEVEL_FROM]) ||
(plrmodel[PLRSKIN_LEVEL_TO] && (plrmodel[PLRSKIN_LEVEL_FROM] <= player_level <= plrmodel[PLRSKIN_LEVEL_TO]))
){
formatex(item_info, charsmax(item_info), "%d", i)
menu_additem(plr_menu, plrmodel[PLRSKIN_NAME], item_info, 0, plr_menu_cb)
}
}

menu_setprop(plr_menu, MPROP_EXITNAME, "Назад")
menu_display(id, plr_menu)
}


public PlrMenu_Handler(id, m, item) {
if(item == MENU_EXIT) {
menu_destroy(m)
menu_display(id, prm_menu)
return PLUGIN_CONTINUE
}

new item_info[10], dummy[2]
menu_item_getinfo(m, item, dummy[0], item_info, charsmax(item_info), dummy, charsmax(dummy), dummy[0])

new player_level = aes_get_player_level(id)
new si_id = str_to_num(item_info)

new plrmodel[plrmodel_info_struct]
ArrayGetArray(player_skins, si_id, plrmodel)

if(
(!plrmodel[PLRSKIN_LEVEL_TO] && player_level >= plrmodel[PLRSKIN_LEVEL_FROM]) ||
(plrmodel[PLRSKIN_LEVEL_TO] && (plrmodel[PLRSKIN_LEVEL_FROM] <= player_level <= plrmodel[PLRSKIN_LEVEL_TO]))
) {
copy(player_models[id][MODEL_T], charsmax(player_models[][MODEL_T]), plrmodel[PLRSKIN_MODEL_T])
copy(player_models[id][MODEL_CT], charsmax(player_models[][MODEL_CT]), plrmodel[PLRSKIN_MODEL_CT])

client_print_color(id, print_team_red, "^4[Нация Ножей] ^1Выбран ^3%s", plrmodel[PLRSKIN_NAME])

menu_display(id, m)
return PLUGIN_CONTINUE
}

menu_destroy(m)
return PLUGIN_CONTINUE
}

public PlrMenu_Callback(id, m, item) {
new item_info[10], dummy[2]
menu_item_getinfo(m, item, dummy[0], item_info, charsmax(item_info), dummy, charsmax(dummy), dummy[0])

new si_id = str_to_num(item_info)
new plrmodel[plrmodel_info_struct]
ArrayGetArray(player_skins, si_id, plrmodel)

if(
strcmp(player_models[id][MODEL_T], plrmodel[PLRSKIN_MODEL_T]) == 0 &&
strcmp(player_models[id][MODEL_CT], plrmodel[PLRSKIN_MODEL_CT]) == 0
) {
new item_name[64]
formatex(item_name, charsmax(item_name), "\w%s \r*", plrmodel[PLRSKIN_NAME])
menu_item_setname(m, item, item_name)

return ITEM_DISABLED
} else {
menu_item_setname(m, item, plrmodel[PLRSKIN_NAME])
}

return ITEM_ENABLED
}

public Hook_WeaponDeploy(ent) {
new Float:si_vec[3]
get_entvar(ent, var_vuser4, si_vec)

if(si_vec[0] == 2.0) {
new si_id = floatround(si_vec[2])

new skin_info[skin_info_struct]
ArrayGetArray(weapon_skins, si_id, skin_info)

if(skin_info[SKIN_V_MODEL] || skin_info[SKIN_P_MODEL]) {
new id = get_member(ent, m_pPlayer)

if(skin_info[SKIN_V_MODEL]) {
set_entvar(id, var_viewmodel, skin_info[SKIN_V_MODEL])
}

if(skin_info[SKIN_P_MODEL]) {
set_entvar(id, var_weaponmodel, skin_info[SKIN_P_MODEL])
}
}
}
}

public Hook_WeaponAddToPlayer(ent) {
new Float:si_vec[3]
get_entvar(ent, var_vuser4, si_vec)

if(si_vec[0] == 0.0) {
new id = get_member(ent, m_pPlayer)
new w_id = get_member(ent, m_iId)

if(player_weapon_models[id][w_id][SKIN_ON]) {
si_vec[0] = 2.0
si_vec[2] = float(player_weapon_models[id][w_id][SKIN_ID])
} else {
si_vec[0] = 1.0
}

set_entvar(ent, var_vuser4, si_vec)
}
}

stock WeaponBox_FindWpn(const ent) {
for (new i = 1; i < MAX_ITEM_TYPES; ++i) {
new pPackEntity = get_member(ent, m_WeaponBox_rgpPlayerItems, i)
if (pPackEntity != -1) {
return pPackEntity
}
}

return -1
}

stock FindWeaponSkinByName(name[]) {
new ret = -1;

new skin_info[skin_info_struct];

for(new i = 0, size = ArraySize(weapon_skins); i < size; i++) {
ArrayGetArray(weapon_skins, i, skin_info);

if(equal(skin_info[SKIN_NAME], name)) {
ret = i;
break;
}
}

return ret;
}

stock bool:FindPlayerSkinByName(name[]) {
new bool:found = false;

new plr_skin_info[plrmodel_info_struct];

for(new i = 0, size = ArraySize(player_skins); i < size; i++) {
ArrayGetArray(player_skins, i, plr_skin_info);
if(equal(name, plr_skin_info[PLRSKIN_NAME])) {
found = true;
}
}

return found;
}
Доброго времени суток.
Проблема с сохранением в nvault
Сохранение вроде как есть, нож сохраняется. Но в какой-то момент заходишь и у тебя стоит почему-то дефолтный нож, приходится выбирать заново...
В чем проблема?
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
2,491
Реакции
2,794
Помог
61 раз(а)
KOLOKOLb4UK, для начала я бы проверил что хранится в самом nvault-е. Есть редаткоры позволяющие посмотреть что внутри. И делать это нужно в тот момент когда слетело сохранение не меняя ничего. Именно в тот момент нужно зайти по фтп и сохранить себе vault файл. После чего посмотреть какая запись знаходится по вашему стим ид.
 
Сообщения
345
Реакции
77
Помог
14 раз(а)
fantom, Я знаю лишь один редактор и у меня он к сожалению выдает ошибку при открытии...
 
Сообщения
2,491
Реакции
2,794
Помог
61 раз(а)
KOLOKOLb4UK, Еще вариант попроще. залогировать все что касается получения с NVault
 
Сообщения
345
Реакции
77
Помог
14 раз(а)
Вот запись после того, как я выбрал нож
1543333961239.png

Вот запись спустя какое-то время
1543333787963.png
27 Ноя 2018
Еще я заметил, что это единственный плагин с nvault, у которого не создается файл "JOURNAL". Почему и что это за файл?
28 Ноя 2018
up
 
Сообщения
1,304
Реакции
2,303
Помог
57 раз(а)
Попробуйте приложенный вариант, и отпишитесь о результатах.

Journal у данного плагина вы не видите потому, что доступ к хранилищу тут реализован по принципу "открыл -> прочитал/записал данные -> закрыл", тогда как другие плагины, вероятно, держат хранилище открытым всю сессию (до момента смены карты/выключения сервера).
 

Вложения

Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.

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

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