плагин супер но может кто сделает чтоб в меню были пункты например скины для awp нажимаешь и выбираешь скин а то все перемешано долга гор тать выбирать все скины в а дном может кто сделает
а можно чуть подробней? как именно?sergei, // "AK-47 Frontside" - имя требуемой модели, указанное в weapon_skins.ini
список скинов вы можете сами формировать
Помогите разобраться до конца, пожалуйста.ade888, после 270 строки нужно ввести проверку на наличие флага.
#define vip_flag ADMIN_LEVEL_H
#if defined DEFAULT_SKIN_MENU
public Command_ChangeSkin(id)
{
if(!is_user_connected(id))
return false;
if((get_user_flags(id) & vip_flag))
return true;
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);
return false;
}
new const FILE_MODELS[] = "weapon_skins.ini";
new const FILE_MODELS2[] = "weapon_skins2.ini";
#if defined DEFAULT_SKIN_MENU
register_clcmd("say /ak47", "Command_ChangeSkin");
register_clcmd("say /m4a1", "Command_ChangeSkin");
register_clcmd("say /skinreset", "Command_ResetSkin");
#endif // DEFAULT_SKIN_MENU
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);
format(file_path, charsmax(file_path), "%s/%s", file_path, FILE_MODELS2);
register_clcmd("say /ak47", "Command_ChangeSkinAk");
register_clcmd("say /m4a1", "Command_ChangeSkinM4");
public Command_ChangeSkinM4(id)
{
Command_ChangeSkin(id, CSW_M4A1);
}
public Command_ChangeSkinAk(id)
{
Command_ChangeSkin(id, CSW_AK47);
}
public Command_ChangeSkin(id, weapon)
{
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);
if(skin_info[WeaponID] != weapon) continue;
menu_additem(menu, skin_info[SkinName]);
}
menu_display(id, menu);
}
public Command_ChangeSkin(id)
{
new menu = menu_create("Skin Menu", "SkinMenu_Handler");
new skin_info[SkinInfo];
for(new i, key[2]; i < g_iWeaponSkinsCount; i++)
{
ArrayGetArray(g_aWeaponSkins, i, skin_info);
if(skin_info[WeaponID] != weapon) continue;
key[0] = i;
menu_additem(menu, skin_info[SkinName], key);
}
menu_display(id, menu);
}
public SkinMenu_Handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new info[2], stuff;
menu_item_getinfo(menu, item, stuff, info, charsmax(info), _, _, stuff);
new skin = info[0];
new skin_info[SkinInfo];
ArrayGetArray(g_aWeaponSkins, skin, skin_info);
g_iPlayerSkins[id][skin_info[WeaponID]] = skin + 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, skin + 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;
}
//AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// weapon_skin_system.sma
//
// C:\test\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(78) : warning
217: loose indentation
// C:\test\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(79) : warning
217: loose indentation
// C:\test\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(101) : error
088: number of arguments does not match definition
// C:\test\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(105) : error
088: number of arguments does not match definition
// C:\test\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(287) : error
017: undefined symbol "weapon"
//
// 3 Errors.
// Could not locate output file C:\test\cstrike\addons\amxmodx\scripting\compile
d\weapon_skin_system.amx (compile failed).
//
// Compilation Time: 0,28 sec
// ----------------------------------------
Press enter to exit ...
[\w Меню моделей оружия]
say = /wss
cmd = player_menu1
"\wAK-47" "say /ak47"
"\wM4A1-4" "say /m4a1"
"\wСбросить скин" "say /skinreset"
#define FLAG_ACCESS (ADMIN_BAN|ADMIN_LEVEL_H)
Что не так сделано, быть может есть вариант лучше?//// weapon_skin_system.sma
//
// D:\rehlds_public\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(308)
: warning 209: function "Command_ChangeSkin" should return a value
// D:\rehlds_public\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(371)
: warning 217: loose indentation
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif
#define FLAG_ACCESS (ADMIN_BAN|ADMIN_LEVEL_H)
new bool:has_used[32];
has_used[id] = true;
#if defined DEFAULT_SKIN_MENU
public Command_ChangeSkin(id, weapon)
{
if (!has_used[id])
{
if (!(get_user_flags(id) & FLAG_ACCESS))
{
client_print_color(id, print_team_default, "^1[^4WSS^1] ^3Скины оружий доступны только ^4VIP ^3игрокам^1.");
return PLUGIN_HANDLED;
}
}
new menu = menu_create("Skin Menu", "SkinMenu_Handler");
new skin_info[SkinInfo];
for(new i, key[2]; i < g_iWeaponSkinsCount; i++)
{
ArrayGetArray(g_aWeaponSkins, i, skin_info);
if(skin_info[WeaponID] != weapon) continue;
key[0] = i;
menu_additem(menu, skin_info[SkinName], key);
}
menu_display(id, menu);
}
public SkinMenu_Handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new info[2], stuff;
menu_item_getinfo(menu, item, stuff, info, charsmax(info), _, _, stuff);
new skin = info[0];
new skin_info[SkinInfo];
ArrayGetArray(g_aWeaponSkins, skin, skin_info);
g_iPlayerSkins[id][skin_info[WeaponID]] = skin + 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, skin + 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)
{
if (!has_used[id])
{
if (!(get_user_flags(id) & FLAG_ACCESS))
{
client_print_color(id, print_team_default, "^1[^4WSS^1] ^3Команда доступна только ^4VIP ^3игрокам^1.");
return PLUGIN_HANDLED;
}
}
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])
{
num[0] = i;
menu_additem(menu, weapons, num);
}
}
menu_display(id, menu);
return PLUGIN_HANDLED;
}
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;
has_used[id] = true;
menu_destroy(menu);
return PLUGIN_HANDLED;
}
#endif // DEFAULT_SKIN_MENU
209: function "Command_ChangeSkin" should return a value
return PLUGIN_HANDLED;
public Command_ChangeSkin(id, weapon)
{
if (!has_used[id])
{
if (!(get_user_flags(id) & FLAG_ACCESS))
{
client_print_color(id, print_team_default, "^1[^4WSS^1] ^3Скины оружий доступны только ^4VIP ^3игрокам^1.");
return PLUGIN_HANDLED;
}
}
new menu = menu_create("Skin Menu", "SkinMenu_Handler");
new skin_info[SkinInfo];
for(new i, key[2]; i < g_iWeaponSkinsCount; i++)
{
ArrayGetArray(g_aWeaponSkins, i, skin_info);
if(skin_info[WeaponID] != weapon) continue;
key[0] = i;
menu_additem(menu, skin_info[SkinName], key);
}
menu_display(id, menu);
}
==>
public Command_ChangeSkin(id, weapon)
{
if (!has_used[id])
{
if (!(get_user_flags(id) & FLAG_ACCESS))
{
client_print_color(id, print_team_default, "^1[^4WSS^1] ^3Скины оружий доступны только ^4VIP ^3игрокам^1.");
return PLUGIN_HANDLED;
}
}
new menu = menu_create("Skin Menu", "SkinMenu_Handler");
new skin_info[SkinInfo];
for(new i, key[2]; i < g_iWeaponSkinsCount; i++)
{
ArrayGetArray(g_aWeaponSkins, i, skin_info);
if(skin_info[WeaponID] != weapon) continue;
key[0] = i;
menu_additem(menu, skin_info[SkinName], key);
}
menu_display(id, menu);
return PLUGIN_HANDLED;
}
warning 217: loose indentation
Стоит его только поправить// D:\rehlds_public\cstrike\addons\amxmodx\scripting\weapon_skin_system.sma(308)
: warning 209: function "Command_ChangeSkin" should return a value
return PLUGIN_HANDLED;