- Ошибка
-
10:37:59: [AMXX] Displaying debug trace (plugin "CSDM_Style_Gun_Menu.amxx", version "0.0.9")
L 06/12/2020 - 10:37:59: [AMXX] Run time error 10: native error (native "menu_display")
L 06/12/2020 - 10:37:59: [AMXX] [0] CSDM_Style_Gun_Menu.sma::HandlePrimaryWeapons (line 514)
L 06/12/2020 - 19:29:31: [AMXX] Displaying debug trace (plugin "CSDM_Style_Gun_Menu.amxx", version "0.0.9")
L 06/12/2020 - 19:29:31: [AMXX] Run time error 10: native error (native "menu_display")
- ОС
- Windows
- Amx Mod X
-
Amx Mod X 1.9.0
- Билд
-
version
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.696-dev
Build date: 18:46:47 May 18 2020 (2228)
Build from: https://github.com/dreamstalker/rehlds/commit/987ee51
- ReGamedll
-
game version
ReGameDLL version: 5.17.0.466-dev
Build date: 02:56:24 May 27 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/bffb373
- Версия Metamod
-
meta version
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 15:47:38 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] AMX Mod X RUN - amxmodx_mm.dll v1.9.0.5270 ini Start ANY
[ 2] Reunion RUN - reunion_mm.dll v0.1.0.92 ini Start Never
[ 3] ReSemiclip RUN - resemiclip_mm.dll v2.3.9 ini Chlvl ANY
[ 4] POD-Bot mm RUN - podbot_mm.dll vV3B22 ini Chlvl ANY
[ 5] ReAuthCheck RUN - reauthcheck_mm.dll v0.1.6 ini Start Never
[ 6] Rechecker RUN - rechecker_mm.dll v2.5 ini Chlvl ANY
[ 7] Revoice RUN - revoice_mm.dll v0.1.0.34 ini Start Never
[ 8] WHBlocker RUN - whblocker_mm.dll v1.5.697 ini Chlvl ANY
[ 9] SafeNameAndChat RUN - safenameandchat.dll v1.1 ini ANY ANY
[10] CStrike RUN - cstrike_amxx.dll v1.9.0.5270 pl1 ANY ANY
[11] CSX RUN - csx_amxx.dll v1.9.0.5270 pl1 ANY ANY
[12] MySQL RUN - mysql_amxx.dll v1.9.0.5270 pl1 ANY ANY
[13] SQLite RUN - sqlite_amxx.dll v1.9.0.5270 pl1 ANY ANY
[14] Fun RUN - fun_amxx.dll v1.9.0.5270 pl1 ANY ANY
[15] Engine RUN - engine_amxx.dll v1.9.0.5270 pl1 ANY ANY
[16] FakeMeta RUN - fakemeta_amxx.dll v1.9.0.5270 pl1 ANY ANY
[17] GeoIP RUN - geoip_amxx.dll v1.9.0.5270 pl1 ANY ANY
[18] Ham Sandwich RUN - hamsandwich_amxx.dll v1.9.0.5270 pl1 ANY ANY
[19] ReAPI RUN - reapi_amxx.dll v5.13.0.194-dev pl1 ANY Never
[20] ReCSDM RUN - csdm_amxx.dll v3.6 pl1 ANY ANY
[21] ReAimDetector RUN - reaimdetector_amxx.dll v0.2.2 pl1 ANY Never
21 plugins, 21 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] Admin Commands 1.9.0.5270 AMXX Dev Team admincmd.amxx running
[ 2] Anti Flood 1.9.0.5270 AMXX Dev Team antiflood.amxx running
[ 3] Admin Votes 1.9.0.5270 AMXX Dev Team adminvote.amxx running
[ 4] Admin Base 1.9.0.5270 AMXX Dev Team admin.amxx running
[ 5] Stats Configuration 1.9.0.5270 AMXX Dev Team statscfg.amxx running
[ 6] Pause Plugins 1.9.0.5270 AMXX Dev Team pausecfg.amxx running
[ 7] Maps Menu 1.9.0.5270 AMXX Dev Team mapsmenu.amxx running
[ 8] Players Menu 1.9.0.5270 AMXX Dev Team plmenu.amxx running
[ 9] Menus Front-End 1.9.0.5270 AMXX Dev Team menufront.amxx running
[ 10] Commands Menu 1.9.0.5270 AMXX Dev Team cmdmenu.amxx running
[ 11] Plugin Menu 1.9.0.5270 AMXX Dev Team pluginmenu.amxx running
[ 12] POD-Bot Menu 1.3 g4s|figurE.09 amxx_podbotmenu running
[ 13] Weapon Menu 0.0.9 SavSin CSDM_Style_Gun_ running
[ 14] Language Menu 1.0 F@nt0M langmenu.amxx running
[ 15] Show timeleft for CSDM 1.0 neygomon Showtimeleftscd running
[ 16] Bullet Damage 0.0.1 ConnorMcLeod bullet_damage.a running
[ 17] Game Namer 1.1 NeuroToxin gamenamechanger running
[ 18] 'Fire in the hole' blo 1.0 xPaw hidefireintheho running
[ 19] LongJump Enabler 1.0.1 ConnorMcLeod longjump.amxx running
[ 20] MultiJump 1.1 twistedeuphoria multijump.amxx running
[ 21] [ReAPI] Hint blocker 0.1.0 F@tn0M reapi_hint_bloc running
[ 22] Automatic Unstuck 1.5 NL)Ramon(NL stuck.amxx running
[ 23] DeRoiD's Mapchooser 2.33 DeRoiD dmc233.amxx running
[ 24] Sentry guns 1.1 JGHG & miRror CSDM_Sentry.amx debug
[ 25] SF TripMine 19.09.2015 serfreeman1337 CSDM_LaserMine. debug
[ 26] unknown unknown unknown laserfenser.amx debug
[ 27] Client Autoexec on Con 1.1 Torch miRror client_autoexec running
[ 28] Build Dispenser #1.0.5 NOVA csdm_dispenser_ running
[ 29] Welcome HudMsg 0.1 KpacaB4IK dhud.amxx running
[ 30] [ReApi] Killer ScreenF 0.0.4 Vaqtincha reapi_killer_sc running
[ 31] [ReAPI] Vampire 1.0.1 MakapoH reapi_vampire.a running
[ 32] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 33] Toggle Water 0.2 mx?! ToggleWater.amx running
[ 34] Longjump Player Model 0.1 KORD_12.7 p_longjump.amxx running
[ 35] Frag Counter 1.0 Kia Armani kills_counter.a running
[ 36] Spect Bot 1.4 Jack Daniel`s spect_bot.amxx running
[ 37] ResetScore 1.0 Leo_[BH] resetscore_reap running
[ 38] menu on key m 228 unknown menu.amxx running
[ 39] Models Replacement 0.0.2 ConnorMcLeod | V models_replacem running
[ 40] CSDM Main 3.6.0.1 CSDM Team csdm_item.amxx running
[ 41] ReCSDM Spawns 3.6.0.1 ReCSDM Team csdm_spawn_pres running
[ 42] ReCSDM Misc 3.6.0.1 ReCSDM Team csdm_misc.amxx running
[ 43] ReCSDM Stripper 3.6.0.1 KWo csdm_stripper.a running
[ 44] ReCSDM Item Mode 3.6.0.1 FALUCO & KWo & S csdm_itemmode.a running
[ 45] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 46] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 47] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 48] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 49] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
49 plugins, 49 running
- Автор плагина
- SavSin
- Версия плагина
- 0.0.9
- Исходный код
-
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#define OFFSET_PRIMARYWEAPON 116
#define OFFSET_C4_SLOT 372
#define m_iMapZone 235
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_cs_set_user_nobuy(%1) set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0))
enum _:CHOICES
{
OPTION_NONE, OPTION_NEW, OPTION_OLD, OPTION_SAVE
}
new const g_szOptions[CHOICES][] =
{
"None", "Выбрать", "Предыдущий выбор", "Предыдущий + запомнить"
}
new g_WeaponBPAmmo[] =
{
0, 52, 0, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, 0, 100
};
new g_WeaponSlots[] =
{
0, 2, 0, 1, 4, 1, 5, 1, 1, 4, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 4, 2, 1, 1, 3, 1
};
const m_iBuyingStatus = 34;
new g_szWepFile[256], g_FilePointer;
new g_pWeaponMenu, g_sWeaponMenu, g_SpawnMenu;
new g_bSave[33], g_ipPreviousWeapons[33], g_isPreviousWeapons[33];
new Array:g_PrimaryWeapons, Array:g_SecondaryWeapons;
new g_MainMenuTitle, g_PrimaryMenuTitle, g_SecondaryMenuTitle, g_PluginPrefix, g_iToggle, g_iBlockDrop, g_iHENade, g_iFlash, g_iSmoke, g_iArmorAmount, g_iNVG, g_iUnlimitedAmmo, g_iStripMode, g_iTeamMode, g_iFastSwitch, g_iCZBotSupport;
new g_szMainMenuTitle[32], g_szPriMenuTitle[32], g_szSecMenuTitle[32], g_szPrefixName[32];
new bool:g_bomb_targ, g_iEnt, iconstatus;
new CsTeams:g_MenuTeam, CsTeams:g_iPlayerTeam[33];
public plugin_init()
{
register_plugin("Weapon Menu", "0.0.9", "SavSin");
g_MainMenuTitle = register_cvar("wm_mainmenutitle", "меню оружия"); //Main Menu Title Cvar.
g_PrimaryMenuTitle = register_cvar("wm_primenutitle", "Основное оружие"); //Primary Weapons Menu Title Cvar.
g_SecondaryMenuTitle = register_cvar("wm_secmenutitle", "Пистолеты"); //Secondary Weapons Menu Title Cvar.
g_PluginPrefix = register_cvar("amx_prefix_name", "CSDM"); //Prefix Name Cvar.
g_iToggle = register_cvar("wm_switch", "1"); //Turns plugin on and off.
g_iBlockDrop = register_cvar("wm_blockdrop", "1"); //Blocks weapon drop.
g_iHENade = register_cvar("wm_henade", "0"); // Amount of HE Nades given to each player.
g_iFlash = register_cvar("wm_flash", "0"); //Amount of Flash Nades given to each player.
g_iSmoke = register_cvar("wm_smoke", "0"); //Amount of Smoke Nades given to each player.
g_iArmorAmount = register_cvar("wm_armor", "0"); //Amount of Armor Given to each player.
g_iNVG = register_cvar("wm_nvg", "0"); //Give NVG's?
g_iUnlimitedAmmo = register_cvar("wm_unlimitedammo", "0"); //Allow Unlimited ammo?
g_iStripMode = register_cvar("wm_stripmode", "2"); //1 = Strip and keep bomb 2 = Strip All.
g_iFastSwitch = register_cvar("wm_fastswitch", "0"); //1 = Switch to last used weapon 0 = dont
g_iCZBotSupport = register_cvar("wm_czbotsupport", "0"); //1 = Rage method of CZ bot support 0 = no cz bot support.
register_concmd ("amx_teammode", "cmdTeamMode", ADMIN_BAN, "0 = No teams buy. 1 = CT buy. 2 = T buy.");
register_concmd("wmadminmenu", "cmdAdminMenu", ADMIN_RCON, "Opens the admin menu.");
register_concmd("say wmadmin", "cmdAdminMenu", ADMIN_RCON, "Opens the admin menu.");
register_event("CurWeapon", "eCurWeapon", "be", "1=1"); //Unlimited ammo
get_pcvar_string(g_MainMenuTitle, g_szMainMenuTitle, charsmax(g_szMainMenuTitle)); //Main Menu Title Text
get_pcvar_string(g_PrimaryMenuTitle, g_szPriMenuTitle, charsmax(g_szPriMenuTitle)); // Primary Menu Title Text
get_pcvar_string(g_SecondaryMenuTitle, g_szSecMenuTitle, charsmax(g_szSecMenuTitle)); //Secondary Menu Title Text
get_pcvar_string(g_PluginPrefix, g_szPrefixName, charsmax(g_szPrefixName)); //Prefix Name shows infront of plugin chat.
RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawn", 1); //Player Spawn Post
if(get_pcvar_num(g_iCZBotSupport))
RegisterHam(Ham_Spawn, "czbot", "fwdPlayerSpawn", 1); //Player Spawn Post
RegisterHam(Ham_Touch, "func_buyzone", "fwdBuyZoneTouch", 1); //Player touches buyzone
iconstatus = get_user_msgid("StatusIcon");
register_event("HLTV", "Event_HLTV_NewRound", "a", "1=0", "2=0"); //New round start
register_event("TeamInfo", "eTeamInfo", "a"); //Event Team Info.
register_clcmd("say /guns", "cmdGuns"); //Re-Enables Gun menu
register_clcmd("say guns", "cmdGuns"); //Re-Enables Gun menu
register_clcmd("say_team /guns", "cmdGuns"); //Re-Enables Gun menu
register_clcmd("say_team guns", "cmdGuns"); //Re-Enables Gun menu
register_clcmd("drop", "blockDrop"); //Re-Enables Gun menu
CreateWeaponsArray(); //Create the menus and arrays
new szNum[3];
g_SpawnMenu = menu_create(g_szMainMenuTitle, "HandleSpawnMenu"); //Create Main Menu
for(new i = 1; i < sizeof(g_szOptions); i++) //Loop through all the options
{
num_to_str(i, szNum, charsmax(szNum));
menu_additem(g_SpawnMenu, g_szOptions[i], szNum, 0); //Add the options to the menu
}
menu_setprop(g_SpawnMenu , MPROP_EXIT , MEXIT_NEVER); //Dont allow Menu to exit
if (fm_find_ent_by_class(-1, "func_bomb_target") || fm_find_ent_by_class(-1, "info_bomb_target")) //Checks for bombsites
{
g_bomb_targ = true; //If there is a bomb site Set this to true
}
}
public client_disconnected(id)
{
g_ipPreviousWeapons[id] = 0;
g_isPreviousWeapons[id] = 0;
g_bSave[id] = false;
}
public client_connect(id)
{
g_ipPreviousWeapons[id] = 0;
g_isPreviousWeapons[id] = 0;
g_bSave[id] = false;
}
public plugin_precache()
{
g_iTeamMode = register_cvar("wm_teammode", "0"); // 0 = both 1 = T only 2 = CT only.
g_iEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_map_parameters"));
dllfunc(DLLFunc_Spawn, g_iEnt);
server_cmd("sv_restart 1");
}
public Event_HLTV_NewRound()
{
if(!get_pcvar_num(g_iToggle))
return PLUGIN_HANDLED;
new iTeamMode;
switch(clamp(get_pcvar_num(g_iTeamMode), 0, 2))
{
case 0:
{
iTeamMode = 3;
}
case 1:
{
g_MenuTeam = CS_TEAM_T;
iTeamMode = 1;
}
case 2:
{
g_MenuTeam = CS_TEAM_CT;
iTeamMode = 2;
}
}
set_pdata_int(g_iEnt, m_iBuyingStatus, iTeamMode, 4);
return PLUGIN_HANDLED;
}
public fwdBuyZoneTouch(iEnt, id)
{
if(!get_pcvar_num(g_iToggle))
return HAM_IGNORED;
if(is_user_connected(id) && g_iPlayerTeam[id] == g_MenuTeam)
{
message_begin(MSG_ONE, iconstatus, {0,0,0}, id);
write_byte(0);
write_string("buyzone");
write_byte(0);
write_byte(255);
write_byte(0);
message_end();
}
return PLUGIN_HANDLED;
}
public cmdTeamMode(id)
{
if(!get_pcvar_num(g_iToggle))
return PLUGIN_HANDLED;
new arg[2];
read_argv(1, arg, sizeof(arg));
new iArg = str_to_num(arg);
set_pcvar_num(g_iTeamMode, clamp(iArg, 0, 2));
server_cmd("sv_restart 1");
return PLUGIN_HANDLED;
}
public cmdGuns(id) //Renable Guns Menu
{
if(get_pcvar_num(g_iToggle) && g_bSave[id])
{
g_bSave[id] = false;
client_print_color(id, print_chat, "^4[^4%s] ^3Оружие ^3можно ^3будет ^3поменять ^3после ^3респауна", g_szPrefixName);
}
}
public fwdPlayerSpawn(id)
{
if(is_user_alive(id) && get_pcvar_num(g_iToggle)) //Check if player alive and plugin is active
{
if(get_pcvar_num(g_iTeamMode))
{
if(g_iPlayerTeam[id] == g_MenuTeam)
{
switch(get_pcvar_num(g_iStripMode))
{
case 1: //Strip and keep bomb
{
StripUserWeapons(id); //Calls the Strip Function
}
case 2: // Strip Everything
{
strip_user_weapons(id); //Fun native to strip ALL weapons
give_item(id, "weapon_knife"); //Fun native to give the knife back
}
}
}
}
else
{
switch(get_pcvar_num(g_iStripMode))
{
case 1: //Strip and keep bomb
{
StripUserWeapons(id); //Calls the Strip Function
}
case 2: // Strip Everything
{
strip_user_weapons(id); //Fun native to strip ALL weapons
give_item(id, "weapon_knife"); //Fun native to give the knife back
}
}
}
if(g_bomb_targ && get_pcvar_num(g_iStripMode) == 1 && g_iPlayerTeam[id] == CS_TEAM_CT)
{
cs_set_user_defuse(id, 1); //If there is a bomb site and your a CT give you a Defuse kit
}
if(get_pcvar_num(g_iHENade)) //Check if Grenades are enabled
{
//g_HeNadesLeft[id] = get_pcvar_num(g_iHENade);
//Gives player the right amount of grenades
give_item(id, "weapon_hegrenade");
cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num(g_iHENade));
}
if(get_pcvar_num(g_iFlash)) //Checks if Flashbangs are enabled
{
//Gives player the correct amount of flashbangs
give_item(id, "weapon_flashbang");
cs_set_user_bpammo(id, CSW_FLASHBANG, get_pcvar_num(g_iFlash));
}
if(get_pcvar_num(g_iSmoke)) //Checks if smoke is enabled
{
//Gives Player the correct amount of Smoke Grenades
give_item(id, "weapon_smokegrenade");
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, get_pcvar_num(g_iSmoke));
}
//Gives the player the amount of armor based on the cvar above.
cs_set_user_armor(id, get_pcvar_num(g_iArmorAmount), CS_ARMOR_VESTHELM);
if(get_pcvar_num(g_iNVG)) //Night Vision enabled?
{
cs_set_user_nvg(id, 1); //Gives the user night vision
}
if(get_pcvar_num(g_iTeamMode))
{
if(g_iPlayerTeam[id] == g_MenuTeam)
{
if(!is_user_bot(id))
{
if(!g_bSave[id]) //Checks weather you have saved your previous weapons or not.
{
menu_display(id, g_SpawnMenu); //Shows the menu if you havn't saved your previous
}
else
{
PreviousWeapons(id); //Gives you the weapons you saved in from the menu
}
}
else
{
new iPrimaryArraySize = ArraySize(g_PrimaryWeapons);
new iSecondaryArraySize = ArraySize(g_SecondaryWeapons);
for(new i=0; i< 2; i++)
{
new WeaponName[32], szArrayData[32];
if(i == 0)
{
ArrayGetString(g_PrimaryWeapons, iPrimaryArraySize, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
}
else
{
ArrayGetString(g_SecondaryWeapons, iSecondaryArraySize, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
}
replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
strtolower(WeaponName);//Converts all to lower case
GiveWeapons(id, WeaponName); //Gives secondary weapon
}
}
}
}
else
{
if(!is_user_bot(id))
{
if(!g_bSave[id]) //Checks weather you have saved your previous weapons or not.
{
menu_display(id, g_SpawnMenu); //Shows the menu if you havn't saved your previous
}
else
{
PreviousWeapons(id); //Gives you the weapons you saved in from the menu
}
}
else
{
new iPrimaryWeapon = random_num(0, ArraySize(g_PrimaryWeapons)-1);
new iSecondaryWeapon = random_num(0, ArraySize(g_SecondaryWeapons)-1);
for(new i=0; i< 2; i++)
{
new WeaponName[32], szArrayData[32];
if(i == 0)
{
ArrayGetString(g_PrimaryWeapons, iPrimaryWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
}
else
{
ArrayGetString(g_SecondaryWeapons, iSecondaryWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
}
replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
strtolower(WeaponName);//Converts all to lower case
GiveWeapons(id, WeaponName); //Gives secondary weapon
}
}
}
}
}
public eCurWeapon(id)
{
if(!get_pcvar_num(g_iToggle) || !get_pcvar_num(g_iUnlimitedAmmo))
return PLUGIN_HANDLED;
new iWeapon = read_data(2); //Gets current Weapon ID CSW weapon constraints
if(g_WeaponSlots[iWeapon] == 1 || g_WeaponSlots[iWeapon] == 2)
{
if(cs_get_user_bpammo(id, iWeapon) < g_WeaponBPAmmo[iWeapon])
{
cs_set_user_bpammo(id, iWeapon, g_WeaponBPAmmo[iWeapon]); //If your bp ammo is lower then the max then set it to the max
}
}
return PLUGIN_CONTINUE;
}
public blockDrop(id) //Blocks weapon drop
{
if(get_pcvar_num(g_iToggle) && get_pcvar_num(g_iBlockDrop) && get_user_weapon(id) != CSW_C4)
{
if(get_pcvar_num(g_iTeamMode))
{
if(g_iPlayerTeam[id] == g_MenuTeam)
{
set_hudmessage( 255, 255, 255, -1.0, 0.35, 0, 0.0, 2.0, 0.0, 0.0 )
show_hudmessage( id, "нельзя вибросить оружие" )
return PLUGIN_HANDLED;
}
}
else
{
set_hudmessage( 255, 255, 255, -1.0, 0.35, 0, 0.0, 2.0, 0.0, 0.0 )
show_hudmessage( id, "нельзя вибросить оружие" )
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public HandleSpawnMenu(id, iMenu, iItem)
{
new szKey[3], Dummy;
menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the selection off the menu
switch(str_to_num(szKey))
{
case OPTION_NEW:
{
menu_display(id, g_pWeaponMenu); //Displays primary weapons menu
}
case OPTION_OLD:
{
PreviousWeapons(id); //Gives your previous weapons
}
case OPTION_SAVE:
{
PreviousWeapons(id); //Same as OPTION_OLD but saves it so you get these weapons each spawn.
g_bSave[id] = true;
client_print_color(id, print_chat, "^4[^4%s] чат ^4/guns ^3для ^3замены ^3оружия", g_szPrefixName);
}
}
return PLUGIN_CONTINUE;
}
public PreviousWeapons(id) //Access the array to give you the previous weapons used by you.
{
new szpData[32], szsData[32];
ArrayGetString(g_PrimaryWeapons, g_ipPreviousWeapons[id], szpData, charsmax(szpData)); //Gets the array item of your previous primary weapon
ArrayGetString(g_SecondaryWeapons, g_isPreviousWeapons[id], szsData, charsmax(szsData)); //Gets the array item of your previous secondary weapon
strtolower(szpData); //Converts it all to lower case
strtolower(szsData); //Converts it all to lower case
replace_all(szpData, charsmax(szpData), " ", ""); //Removes spaces from the array text.
replace_all(szsData, charsmax(szsData), " ", ""); //Removes spaces from the array text.
format(szpData, charsmax(szpData), "weapon_%s", szpData); //adds weapon_ infront of the array text.
format(szsData, charsmax(szsData), "weapon_%s", szsData);//adds weapon_ infront of the array text.
GiveWeapons(id, szpData); //Gives player previous primary weapon
GiveWeapons(id, szsData); //Gives player previous Secondary Weapon
}
public CreateWeaponsArray()
{
get_configsdir(g_szWepFile, charsmax(g_szWepFile)); //gets addons/amxmodx/configs directory
format(g_szWepFile, charsmax(g_szWepFile), "%s/DM_WeaponOrder.ini", g_szWepFile); //formats the file name for the Weapons order INI
g_FilePointer = fopen(g_szWepFile, "r"); //Opens the file
//Arrays
g_PrimaryWeapons = ArrayCreate(15); //Creates the Primary Weapons Array
g_SecondaryWeapons = ArrayCreate(15); //Creates the Secondary Weapons Array
//Weapon Menus
g_pWeaponMenu = menu_create(g_szPriMenuTitle, "HandlePrimaryWeapons"); //Creates the Primary Weapon Menu
g_sWeaponMenu = menu_create(g_szSecMenuTitle, "HandleSecondaryWeapons"); //Creates the Secondary Weapon Menu
new szData[32], szWeaponName[32], szpNum[3], szsNum[3];
new pCounter, sCounter;
if(g_FilePointer) //Makes sure the files open
{
while(!feof(g_FilePointer))
{
fgets(g_FilePointer, szData, charsmax(szData)); //Reads a line of the file
trim(szData); //Removes '^n' new line character from the end of the line
if(containi(szData, ";") != -1) //Checks to see if its a comment and then ignores it
continue;
//Check Weapon Slot for Menu Placement
copy(szWeaponName, charsmax(szWeaponName), szData); //Copys the file data into a new variable to alter it
replace_all(szWeaponName, charsmax(szWeaponName), " ", ""); //Removes Spaces from the Text
format(szWeaponName, charsmax(szWeaponName), "weapon_%s", szWeaponName); //Adds Weapon_ to the text
strtolower(szWeaponName); //converts the whole thing to lower case
new iWeaponID = get_weaponid(szWeaponName); //Gets the CSW weapon constraint for that weapon
switch(g_WeaponSlots[iWeaponID]) //Checks which slot the weapon is for
{
case 1: //Primary Slot
{
ArrayPushString(g_PrimaryWeapons, szData); //Adds the original text to the array
num_to_str(pCounter, szpNum, charsmax(szpNum));
menu_additem(g_pWeaponMenu, szData, szpNum, 0); //Adds item to the primary weapons menu
++pCounter;
}
case 2: //Secondary Slot
{
ArrayPushString(g_SecondaryWeapons, szData); //Adds the original text to the array
num_to_str(sCounter, szsNum, charsmax(szsNum));
menu_additem(g_sWeaponMenu, szData, szsNum, 0);//Adds item to the Secondary Weapons Menu
++sCounter;
}
}
}
}
else
{
set_fail_state("Failed to Open Weapons List");
}
//Blocks exit for both primary and secondary menus
menu_setprop(g_pWeaponMenu , MPROP_EXIT , MEXIT_NEVER);
menu_setprop(g_sWeaponMenu , MPROP_EXIT , MEXIT_NEVER);
fclose(g_FilePointer); //Closes the file
}
public HandlePrimaryWeapons(id, iMenu, iItem)
{
new szKey[3], iSelectedWeapon, Dummy;
menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the primary weapon selected.
iSelectedWeapon = str_to_num(szKey);
g_ipPreviousWeapons[id] = iSelectedWeapon; //Stores the selected weapon for option 2 and 3 on the main menu
new WeaponName[32], szArrayData[32];
ArrayGetString(g_PrimaryWeapons, iSelectedWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
strtolower(WeaponName);//Converts all to lower case
GiveWeapons(id, WeaponName); //Gives primary weapon
menu_display(id, g_sWeaponMenu); //Displays secondary weapons menu
}
public HandleSecondaryWeapons(id, iMenu, iItem)
{
new szKey[3], iSelectedWeapon, Dummy;
menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the secondary weapon selected
iSelectedWeapon = str_to_num(szKey);
g_isPreviousWeapons[id] = iSelectedWeapon; //Stores the selected weapon for option 2 and 3 on the main menu
new WeaponName[32], szArrayData[32];
ArrayGetString(g_SecondaryWeapons, iSelectedWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
strtolower(WeaponName);//Converts all to lower case
GiveWeapons(id, WeaponName); //Gives secondary weapon
}
public grenade_throw(id , greindex , wId) //When a grenade is thrown switch to last inv automatically
{
if(get_pcvar_num(g_iToggle) && get_pcvar_num(g_iFastSwitch))
{
client_cmd(id, "lastinv");
}
}
stock GiveWeapons(id, szWeapon[])
{
if(is_user_connected(id))
{
new iWeaponId = get_weaponid(szWeapon); //Get the weapon id of the weapon given
give_item(id, szWeapon); //Give the weapon
cs_set_user_bpammo(id, iWeaponId, g_WeaponBPAmmo[iWeaponId]); //Set the ammo to max ammo
}
}
stock StripUserWeapons(id)
{
new iC4Ent = get_pdata_cbase(id, OFFSET_C4_SLOT); //Gets the slot for C4
if( iC4Ent > 0 ) //If you have the C4
{
set_pdata_cbase(id, OFFSET_C4_SLOT, FM_NULLENT); //Remove it
}
strip_user_weapons(id); //Strip User weapons
give_item(id, "weapon_knife"); //Give the knife
set_pdata_int(id, OFFSET_PRIMARYWEAPON, 0); //Set primary weapon offset to 0
if( iC4Ent > 0 ) //if you had the c4
{
set_pev(id, pev_weapons, pev(id, pev_weapons) | (1<<CSW_C4)); //Give it back
set_pdata_cbase(id, OFFSET_C4_SLOT, iC4Ent); //Set the offset back to normal
cs_set_user_bpammo(id, CSW_C4, 1); //Give the backpack
cs_set_user_plant(id, 1); //Allow user to plant it
}
return PLUGIN_HANDLED;
}
public eTeamInfo()
{
if(!get_pcvar_num(g_iToggle))
return PLUGIN_HANDLED;
new id = read_data(1);
new szTeam[2];
read_data(2, szTeam, charsmax(szTeam));
switch(szTeam[0])
{
case 'T':
{
g_iPlayerTeam[id] = CS_TEAM_T;
}
case 'C':
{
g_iPlayerTeam[id] = CS_TEAM_CT;
}
}
return PLUGIN_HANDLED;
}
public cmdAdminMenu(id)
{
if(!get_pcvar_num(g_iToggle))
return PLUGIN_HANDLED;
new iAdminMenu = menu_create("WM Admin Menu", "HandleAdminMenu");
switch(get_pcvar_num(g_iTeamMode))
{
case 1:
{
menu_additem(iAdminMenu, "TeamMode:\r T", "0", 0);
}
case 2:
{
menu_additem(iAdminMenu, "TeamMode:\r CT", "0", 0);
}
default:
{
menu_additem(iAdminMenu, "TeamMode:\r Both", "0", 0);
}
}
menu_additem(iAdminMenu, "Save and Exit", "1", 0);
menu_setprop(iAdminMenu , MPROP_EXIT , MEXIT_NEVER); //Dont allow Menu to exit
menu_display(id, iAdminMenu);
return PLUGIN_HANDLED;
}
public ChangeTeamMode(id, CsTeams:iTeam, iValue)
{
set_pcvar_num(g_iTeamMode, iValue);
g_MenuTeam = iTeam;
switch(iTeam)
{
case CS_TEAM_T: client_print(id, print_center, "Team Mode changed to T");
case CS_TEAM_CT: client_print(id, print_center, "Team Mode changed to CT");
default: client_print(id, print_center, "Team Mode changed to Both");
}
}
public HandleAdminMenu(id, iMenu, iItem)
{
new szKey[3], bool:bUpdateMenu, Dummy;
menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the primary weapon selected.
switch(str_to_num(szKey))
{
case 0:
{
switch(get_pcvar_num(g_iTeamMode))
{
case 1:
{
ChangeTeamMode(id, CS_TEAM_CT, 2);
bUpdateMenu = true;
}
case 2:
{
ChangeTeamMode(id, CS_TEAM_UNASSIGNED, 0);
bUpdateMenu = true;
}
default:
{
ChangeTeamMode(id, CS_TEAM_T, 1);
bUpdateMenu = true;
}
}
}
case 1:
{
server_cmd("sv_restart 1");
}
}
if(bUpdateMenu)
{
menu_destroy(iMenu);
cmdAdminMenu(id);
}
else
{
menu_destroy(iMenu);
}
}
помогите испаравить)
В этой теме было размещено решение! Перейти к решению.