hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.06. 02:32



Jelenlévő felhasználók

Jelenleg 523 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 523 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Fegyvermenü awplimittel?
HozzászólásElküldve: 2014.03.12. 17:13 
Offline
Fanatikus

Csatlakozott: 2013.11.17. 10:55
Hozzászólások: 160
Megköszönt másnak: 61 alkalommal
Megköszönték neki: 3 alkalommal
Ebbe kellene nekem egy awp limit, úgyhogy:
4v4-től, Tbe 1 wp, Ctbe 1 wp lehet maximum.
8v8-tól, Tbe 2wp, Ctbe 2 wp lehet maximum.
Ebbe a pluginba írjátok bele, és ne más plugint adjatok, hozzá, mert az úgy nem megy.. ;)
Köszi!

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5. #include <cstrike>
  6. #include <fun>
  7.  
  8. #define OFFSET_PRIMARYWEAPON 116
  9. #define OFFSET_C4_SLOT 372
  10. #define m_iMapZone 235
  11. #define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
  12. #define fm_cs_set_user_nobuy(%1) set_pdata_int(%1, 235, get_pdata_int(%1, 235) & ~(1<<0))
  13.  
  14. enum _:CHOICES
  15. {
  16. OPTION_NONE, OPTION_NEW, OPTION_OLD, OPTION_SAVE
  17. }
  18.  
  19. new const g_szOptions[CHOICES][] =
  20. {
  21. "None", "Uj Fegyver", "Elozo Fegyver", "Elozo Fegyver+Mentes"
  22. }
  23.  
  24. new g_WeaponBPAmmo[] =
  25. {
  26. 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
  27. };
  28.  
  29. new g_WeaponSlots[] =
  30. {
  31. 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
  32. };
  33.  
  34. const m_iBuyingStatus = 34;
  35. new g_szWepFile[256], g_FilePointer;
  36. new g_pWeaponMenu, g_sWeaponMenu, g_SpawnMenu;
  37. new g_bSave[33], g_ipPreviousWeapons[33], g_isPreviousWeapons[33];
  38. new Array:g_PrimaryWeapons, Array:g_SecondaryWeapons;
  39. 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;
  40. new g_szMainMenuTitle[32], g_szPriMenuTitle[32], g_szSecMenuTitle[32], g_szPrefixName[32];
  41. new bool:g_bomb_targ, g_iEnt, iconstatus;
  42. new CsTeams:g_MenuTeam, CsTeams:g_iPlayerTeam[33];
  43.  
  44. public plugin_init()
  45. {
  46. register_plugin("Weapon Menu", "0.0.9", "SavSin");
  47.  
  48. g_MainMenuTitle = register_cvar("wm_mainmenutitle", "Fegyver menu"); //Main Menu Title Cvar.
  49. g_PrimaryMenuTitle = register_cvar("wm_primenutitle", "Elsodleges fegyver"); //Primary Weapons Menu Title Cvar.
  50. g_SecondaryMenuTitle = register_cvar("wm_secmenutitle", "Masodlagos fegyver"); //Secondary Weapons Menu Title Cvar.
  51. g_PluginPrefix = register_cvar("amx_prefix_name", "WM"); //Prefix Name Cvar.
  52.  
  53. g_iToggle = register_cvar("wm_switch", "1"); //Turns plugin on and off.
  54. g_iBlockre = register_cvar("wm_blockdrop", "0"); //Blocks weapon drop.
  55. g_iHENade = register_cvar("wm_henade", "2"); // Amount of HE Nades given to each player.
  56. g_iFlash = register_cvar("wm_flash", "2"); //Amount of Flash Nades given to each player.
  57. g_iSmoke = register_cvar("wm_smoke", "2"); //Amount of Smoke Nades given to each player.
  58. g_iArmorAmount = register_cvar("wm_armor", "100"); //Amount of Armor Given to each player.
  59. g_iNVG = register_cvar("wm_nvg", "1"); //Give NVG's?
  60. g_iUnlimitedAmmo = register_cvar("wm_unlimitedammo", "1"); //Allow Unlimited ammo?
  61. g_iStripMode = register_cvar("wm_stripmode", "1"); //1 = Strip and keep bomb 2 = Strip All.
  62. g_iFastSwitch = register_cvar("wm_fastswitch", "1"); //1 = Switch to last used weapon 0 = dont
  63.  
  64. g_iCZBotSupport = register_cvar("wm_czbotsupport", "0"); //1 = Rage method of CZ bot support 0 = no cz bot support.
  65.  
  66. register_concmd ("amx_teammode", "cmdTeamMode", ADMIN_BAN, "0 = No teams buy. 1 = CT buy. 2 = T buy.");
  67. register_concmd("wmadminmenu", "cmdAdminMenu", ADMIN_RCON, "Opens the admin menu.");
  68. register_concmd("say wmadmin", "cmdAdminMenu", ADMIN_RCON, "Opens the admin menu.");
  69.  
  70.  
  71. register_event("CurWeapon", "eCurWeapon", "be", "1=1"); //Unlimited ammo
  72.  
  73. get_pcvar_string(g_MainMenuTitle, g_szMainMenuTitle, charsmax(g_szMainMenuTitle)); //Main Menu Title Text
  74. get_pcvar_string(g_PrimaryMenuTitle, g_szPriMenuTitle, charsmax(g_szPriMenuTitle)); // Primary Menu Title Text
  75. get_pcvar_string(g_SecondaryMenuTitle, g_szSecMenuTitle, charsmax(g_szSecMenuTitle)); //Secondary Menu Title Text
  76. get_pcvar_string(g_PluginPrefix, g_szPrefixName, charsmax(g_szPrefixName)); //Prefix Name shows infront of plugin chat.
  77.  
  78. RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawn", 1); //Player Spawn Post
  79.  
  80. if(get_pcvar_num(g_iCZBotSupport))
  81. RegisterHam(Ham_Spawn, "czbot", "fwdPlayerSpawn", 1); //Player Spawn Post
  82.  
  83. RegisterHam(Ham_Touch, "func_buyzone", "fwdBuyZoneTouch", 1); //Player touches buyzone
  84. iconstatus = get_user_msgid("StatusIcon");
  85. register_event("HLTV", "Event_HLTV_NewRound", "a", "1=0", "2=0"); //New round start
  86. register_event("TeamInfo", "eTeamInfo", "a"); //Event Team Info.
  87. register_clcmd("say /guns", "cmdGuns"); //A fegyvermenut kovetkezo korben ujra hasznalhatod!
  88. register_clcmd("say guns", "cmdGuns"); //A fegyvermenut kovetkezo korben ujra hasznalhatod!
  89. register_clcmd("say_team /guns", "cmdGuns"); //A fegyvermenut kovetkezo korben ujra hasznalhatod!
  90. register_clcmd("say_team guns", "cmdGuns"); //A fegyvermenut kovetkezo korben ujra hasznalhatod!
  91. register_clcmd("drop" //Re-Enables Gun menu
  92.  
  93. CreateWeaponsArray(); //Create the menus and arrays
  94.  
  95. new szNum[3];
  96. g_SpawnMenu = menu_create(g_szMainMenuTitle, "HandleSpawnMenu"); //Create Main Menu
  97.  
  98. for(new i = 1; i < sizeof(g_szOptions); i++) //Loop through all the options
  99. {
  100. num_to_str(i, szNum, charsmax(szNum));
  101. menu_additem(g_SpawnMenu, g_szOptions[i], szNum, 0); //Add the options to the menu
  102. }
  103.  
  104. menu_setprop(g_SpawnMenu , MPROP_EXIT , MEXIT_NEVER); //Dont allow Menu to exit
  105.  
  106. if (fm_find_ent_by_class(-1, "func_bomb_target") || fm_find_ent_by_class(-1, "info_bomb_target")) //Checks for bombsites
  107. {
  108. g_bomb_targ = true; //If there is a bomb site Set this to true
  109. }
  110. }
  111.  
  112. public client_disconnect(id)
  113. {
  114. g_ipPreviousWeapons[id] = 0;
  115. g_isPreviousWeapons[id] = 0;
  116. g_bSave[id] = false;
  117. }
  118.  
  119. public client_connect(id)
  120. {
  121. g_ipPreviousWeapons[id] = 0;
  122. g_isPreviousWeapons[id] = 0;
  123. g_bSave[id] = false;
  124. }
  125.  
  126. public plugin_precache()
  127. {
  128. g_iTeamMode = register_cvar("wm_teammode", "0"); // 0 = both 1 = T only 2 = CT only.
  129. g_iEnt = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_map_parameters"));
  130. dllfunc(DLLFunc_Spawn, g_iEnt);
  131. server_cmd("sv_restart 0");
  132. }
  133.  
  134. public Event_HLTV_NewRound()
  135. {
  136.  
  137. if(!get_pcvar_num(g_iToggle))
  138. return PLUGIN_HANDLED;
  139.  
  140. new iTeamMode;
  141.  
  142. switch(clamp(get_pcvar_num(g_iTeamMode), 0, 2))
  143. {
  144. case 0:
  145. {
  146. iTeamMode = 3;
  147. }
  148. case 1:
  149. {
  150. g_MenuTeam = CS_TEAM_T;
  151. iTeamMode = 1;
  152. }
  153. case 2:
  154. {
  155. g_MenuTeam = CS_TEAM_CT;
  156. iTeamMode = 2;
  157. }
  158. }
  159.  
  160. set_pdata_int(g_iEnt, m_iBuyingStatus, iTeamMode, 4);
  161. return PLUGIN_HANDLED;
  162. }
  163.  
  164. public fwdBuyZoneTouch(iEnt, id)
  165. {
  166. if(!get_pcvar_num(g_iToggle))
  167. return HAM_IGNORED;
  168. if(is_user_connected(id) && g_iPlayerTeam[id] == g_MenuTeam)
  169. {
  170. message_begin(MSG_ONE, iconstatus, {0,0,0}, id);
  171. write_byte(0);
  172. write_string("buyzone");
  173. write_byte(0);
  174. write_byte(255);
  175. write_byte(0);
  176. message_end();
  177. }
  178. return PLUGIN_HANDLED;
  179. }
  180.  
  181. public cmdTeamMode(id)
  182. {
  183. if(!get_pcvar_num(g_iToggle))
  184. return PLUGIN_HANDLED;
  185. new arg[2];
  186. read_argv(1, arg, sizeof(arg));
  187.  
  188. new iArg = str_to_num(arg);
  189.  
  190. set_pcvar_num(g_iTeamMode, clamp(iArg, 0, 2));
  191. server_cmd("sv_restart 0");
  192.  
  193. return PLUGIN_HANDLED;
  194. }
  195.  
  196. public cmdGuns(id) //Renable Guns Menu
  197. {
  198. if(get_pcvar_num(g_iToggle) && g_bSave[id])
  199. {
  200. g_bSave[id] = false;
  201. client_print(id, print_chat, "[%s] Fegyvermenu a kovetkezo ujraeledesnel aktivalva lesz", g_szPrefixName);
  202. }
  203. }
  204.  
  205. public fwdPlayerSpawn(id)
  206. {
  207. if(is_user_alive(id) && get_pcvar_num(g_iToggle)) //Check if player alive and plugin is active
  208. {
  209. if(get_pcvar_num(g_iTeamMode))
  210. {
  211. if(g_iPlayerTeam[id] == g_MenuTeam)
  212. {
  213. switch(get_pcvar_num(g_iStripMode))
  214. {
  215. case 1: //Strip and keep bomb
  216. {
  217. StripUserWeapons(id); //Calls the Strip Function
  218. }
  219. case 2: // Strip Everything
  220. {
  221. strip_user_weapons(id); //Fun native to strip ALL weapons
  222. give_item(id, "weapon_knife"); //Fun native to give the knife back
  223. }
  224. }
  225. }
  226. }
  227. else
  228. {
  229. switch(get_pcvar_num(g_iStripMode))
  230. {
  231. case 1: //Strip and keep bomb
  232. {
  233. StripUserWeapons(id); //Calls the Strip Function
  234. }
  235. case 2: // Strip Everything
  236. {
  237. strip_user_weapons(id); //Fun native to strip ALL weapons
  238. give_item(id, "weapon_knife"); //Fun native to give the knife back
  239. }
  240. }
  241. }
  242.  
  243. if(g_bomb_targ && get_pcvar_num(g_iStripMode) == 1 && g_iPlayerTeam[id] == CS_TEAM_CT)
  244. {
  245. cs_set_user_defuse(id, 1); //If there is a bomb site and your a CT give you a Defuse kit
  246. }
  247.  
  248. if(get_pcvar_num(g_iHENade)) //Check if Grenades are enabled
  249. {
  250. //g_HeNadesLeft[id] = get_pcvar_num(g_iHENade);
  251. //Gives player the right amount of grenades
  252. give_item(id, "weapon_hegrenade");
  253. cs_set_user_bpammo(id, CSW_HEGRENADE, get_pcvar_num(g_iHENade));
  254. }
  255.  
  256. if(get_pcvar_num(g_iFlash)) //Checks if Flashbangs are enabled
  257. {
  258. //Gives player the correct amount of flashbangs
  259. give_item(id, "weapon_flashbang");
  260. cs_set_user_bpammo(id, CSW_FLASHBANG, get_pcvar_num(g_iFlash));
  261. }
  262.  
  263. if(get_pcvar_num(g_iSmoke)) //Checks if smoke is enabled
  264. {
  265. //Gives Player the correct amount of Smoke Grenades
  266. give_item(id, "weapon_smokegrenade");
  267. cs_set_user_bpammo(id, CSW_SMOKEGRENADE, get_pcvar_num(g_iSmoke));
  268. }
  269.  
  270. //Gives the player the amount of armor based on the cvar above.
  271. cs_set_user_armor(id, get_pcvar_num(g_iArmorAmount), CS_ARMOR_VESTHELM);
  272.  
  273. if(get_pcvar_num(g_iNVG)) //Night Vision enabled?
  274. {
  275. cs_set_user_nvg(id, 1); //Gives the user night vision
  276. }
  277.  
  278. if(get_pcvar_num(g_iTeamMode))
  279. {
  280. if(g_iPlayerTeam[id] == g_MenuTeam)
  281. {
  282. if(!is_user_bot(id))
  283. {
  284. if(!g_bSave[id]) //Checks weather you have saved your previous weapons or not.
  285. {
  286. menu_display(id, g_SpawnMenu); //Shows the menu if you havn't saved your previous
  287. }
  288. else
  289. {
  290. PreviousWeapons(id); //Gives you the weapons you saved in from the menu
  291. }
  292. }
  293. else
  294. {
  295. new iPrimaryArraySize = ArraySize(g_PrimaryWeapons);
  296. new iSecondaryArraySize = ArraySize(g_SecondaryWeapons);
  297. for(new i=0; i< 2; i++)
  298. {
  299. new WeaponName[32], szArrayData[32];
  300. if(i == 0)
  301. {
  302. ArrayGetString(g_PrimaryWeapons, iPrimaryArraySize, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
  303. }
  304. else
  305. {
  306. ArrayGetString(g_SecondaryWeapons, iSecondaryArraySize, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
  307. }
  308.  
  309. replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
  310. format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
  311. strtolower(WeaponName);//Converts all to lower case
  312. GiveWeapons(id, WeaponName); //Gives secondary weapon
  313. }
  314. }
  315. }
  316. }
  317. else
  318. {
  319. if(!is_user_bot(id))
  320. {
  321. if(!g_bSave[id]) //Checks weather you have saved your previous weapons or not.
  322. {
  323. menu_display(id, g_SpawnMenu); //Shows the menu if you havn't saved your previous
  324. }
  325. else
  326. {
  327. PreviousWeapons(id); //Gives you the weapons you saved in from the menu
  328. }
  329. }
  330. else
  331. {
  332. new iPrimaryWeapon = random_num(0, ArraySize(g_PrimaryWeapons)-1);
  333. new iSecondaryWeapon = random_num(0, ArraySize(g_SecondaryWeapons)-1);
  334. for(new i=0; i< 2; i++)
  335. {
  336. new WeaponName[32], szArrayData[32];
  337. if(i == 0)
  338. {
  339. ArrayGetString(g_PrimaryWeapons, iPrimaryWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
  340. }
  341. else
  342. {
  343. ArrayGetString(g_SecondaryWeapons, iSecondaryWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
  344. }
  345.  
  346. replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
  347. format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
  348. strtolower(WeaponName);//Converts all to lower case
  349. GiveWeapons(id, WeaponName); //Gives secondary weapon
  350. }
  351. }
  352. }
  353. }
  354. }
  355.  
  356. public eCurWeapon(id)
  357. {
  358. if(!get_pcvar_num(g_iToggle) || !get_pcvar_num(g_iUnlimitedAmmo))
  359. return PLUGIN_HANDLED;
  360.  
  361. new iWeapon = read_data(2); //Gets current Weapon ID CSW weapon constraints
  362.  
  363. if(g_WeaponSlots[iWeapon] == 1 || g_WeaponSlots[iWeapon] == 2)
  364. {
  365. if(cs_get_user_bpammo(id, iWeapon) < g_WeaponBPAmmo[iWeapon])
  366. {
  367. cs_set_user_bpammo(id, iWeapon, g_WeaponBPAmmo[iWeapon]); //If your bp ammo is lower then the max then set it to the max
  368. }
  369. }
  370. return PLUGIN_CONTINUE;
  371. }
  372.  
  373. public blockDrop(id) //Blocks weapon drop
  374. {
  375. if(get_pcvar_num(g_iToggle) && get_pcvar_num(g_iBlockDrop) && get_user_weapon(id) != CSW_C4)
  376. {
  377. if(get_pcvar_num(g_iTeamMode))
  378. {
  379. if(g_iPlayerTeam[id] == g_MenuTeam)
  380. {
  381. client_print(id, print_center, "You are not allowed to drop your weapons.");
  382. return PLUGIN_HANDLED;
  383. }
  384. }
  385. else
  386. {
  387. client_print(id, print_center, "You are not allowed to drop your weapons.");
  388. return PLUGIN_HANDLED;
  389. }
  390. }
  391. return PLUGIN_CONTINUE;
  392. }
  393.  
  394. public HandleSpawnMenu(id, iMenu, iItem)
  395. {
  396. new szKey[3], Dummy;
  397. menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the selection off the menu
  398.  
  399. switch(str_to_num(szKey))
  400. {
  401. case OPTION_NEW:
  402. {
  403. menu_display(id, g_pWeaponMenu); //Displays primary weapons menu
  404. }
  405. case OPTION_OLD:
  406. {
  407. PreviousWeapons(id); //Gives your previous weapons
  408. }
  409. case OPTION_SAVE:
  410. {
  411. PreviousWeapons(id); //Same as OPTION_OLD but saves it so you get these weapons each spawn.
  412. g_bSave[id] = true;
  413. client_print(id, print_chat, "[%s] Irj /guns hogy aktivald a fegyvermenut.", g_szPrefixName);
  414. }
  415. }
  416. return PLUGIN_CONTINUE;
  417. }
  418.  
  419. public PreviousWeapons(id) //Access the array to give you the previous weapons used by you.
  420. {
  421. new szpData[32], szsData[32];
  422. ArrayGetString(g_PrimaryWeapons, g_ipPreviousWeapons[id], szpData, charsmax(szpData)); //Gets the array item of your previous primary weapon
  423. ArrayGetString(g_SecondaryWeapons, g_isPreviousWeapons[id], szsData, charsmax(szsData)); //Gets the array item of your previous secondary weapon
  424. strtolower(szpData); //Converts it all to lower case
  425. strtolower(szsData); //Converts it all to lower case
  426. replace_all(szpData, charsmax(szpData), " ", ""); //Removes spaces from the array text.
  427. replace_all(szsData, charsmax(szsData), " ", ""); //Removes spaces from the array text.
  428. format(szpData, charsmax(szpData), "weapon_%s", szpData); //adds weapon_ infront of the array text.
  429. format(szsData, charsmax(szsData), "weapon_%s", szsData);//adds weapon_ infront of the array text.
  430. GiveWeapons(id, szpData); //Gives player previous primary weapon
  431. GiveWeapons(id, szsData); //Gives player previous Secondary Weapon
  432. }
  433.  
  434. public CreateWeaponsArray()
  435. {
  436. get_configsdir(g_szWepFile, charsmax(g_szWepFile)); //gets addons/amxmodx/configs directory
  437. format(g_szWepFile, charsmax(g_szWepFile), "%s/DM_WeaponOrder.ini", g_szWepFile); //formats the file name for the Weapons order INI
  438. g_FilePointer = fopen(g_szWepFile, "r"); //Opens the file
  439. //Arrays
  440. g_PrimaryWeapons = ArrayCreate(15); //Creates the Primary Weapons Array
  441. g_SecondaryWeapons = ArrayCreate(15); //Creates the Secondary Weapons Array
  442.  
  443. //Weapon Menus
  444. g_pWeaponMenu = menu_create(g_szPriMenuTitle, "HandlePrimaryWeapons"); //Creates the Primary Weapon Menu
  445. g_sWeaponMenu = menu_create(g_szSecMenuTitle, "HandleSecondaryWeapons"); //Creates the Secondary Weapon Menu
  446.  
  447. new szData[32], szWeaponName[32], szpNum[3], szsNum[3];
  448. new pCounter, sCounter;
  449. if(g_FilePointer) //Makes sure the files open
  450. {
  451. while(!feof(g_FilePointer))
  452. {
  453. fgets(g_FilePointer, szData, charsmax(szData)); //Reads a line of the file
  454. trim(szData); //Removes '^n' new line character from the end of the line
  455. if(containi(szData, ";") != -1) //Checks to see if its a comment and then ignores it
  456. continue;
  457. //Check Weapon Slot for Menu Placement
  458. copy(szWeaponName, charsmax(szWeaponName), szData); //Copys the file data into a new variable to alter it
  459. replace_all(szWeaponName, charsmax(szWeaponName), " ", ""); //Removes Spaces from the Text
  460. format(szWeaponName, charsmax(szWeaponName), "weapon_%s", szWeaponName); //Adds Weapon_ to the text
  461. strtolower(szWeaponName); //converts the whole thing to lower case
  462. new iWeaponID = get_weaponid(szWeaponName); //Gets the CSW weapon constraint for that weapon
  463.  
  464. switch(g_WeaponSlots[iWeaponID]) //Checks which slot the weapon is for
  465. {
  466. case 1: //Primary Slot
  467. {
  468. ArrayPushString(g_PrimaryWeapons, szData); //Adds the original text to the array
  469. num_to_str(pCounter, szpNum, charsmax(szpNum));
  470. menu_additem(g_pWeaponMenu, szData, szpNum, 0); //Adds item to the primary weapons menu
  471. ++pCounter;
  472. }
  473. case 2: //Secondary Slot
  474. {
  475. ArrayPushString(g_SecondaryWeapons, szData); //Adds the original text to the array
  476. num_to_str(sCounter, szsNum, charsmax(szsNum));
  477. menu_additem(g_sWeaponMenu, szData, szsNum, 0);//Adds item to the Secondary Weapons Menu
  478. ++sCounter;
  479. }
  480. }
  481. }
  482. }
  483. else
  484. {
  485. set_fail_state("Failed to Open Weapons List");
  486. }
  487. //Blocks exit for both primary and secondary menus
  488. menu_setprop(g_pWeaponMenu , MPROP_EXIT , MEXIT_NEVER);
  489. menu_setprop(g_sWeaponMenu , MPROP_EXIT , MEXIT_NEVER);
  490.  
  491. fclose(g_FilePointer); //Closes the file
  492. }
  493.  
  494. public HandlePrimaryWeapons(id, iMenu, iItem)
  495. {
  496. new szKey[3], iSelectedWeapon, Dummy;
  497. menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the primary weapon selected.
  498.  
  499. iSelectedWeapon = str_to_num(szKey);
  500. g_ipPreviousWeapons[id] = iSelectedWeapon; //Stores the selected weapon for option 2 and 3 on the main menu
  501.  
  502. new WeaponName[32], szArrayData[32];
  503. ArrayGetString(g_PrimaryWeapons, iSelectedWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
  504. replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
  505. format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
  506. strtolower(WeaponName);//Converts all to lower case
  507. GiveWeapons(id, WeaponName); //Gives primary weapon
  508.  
  509. menu_display(id, g_sWeaponMenu); //Displays secondary weapons menu
  510. }
  511.  
  512. public HandleSecondaryWeapons(id, iMenu, iItem)
  513. {
  514. new szKey[3], iSelectedWeapon, Dummy;
  515. menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the secondary weapon selected
  516.  
  517. iSelectedWeapon = str_to_num(szKey);
  518. g_isPreviousWeapons[id] = iSelectedWeapon; //Stores the selected weapon for option 2 and 3 on the main menu
  519.  
  520. new WeaponName[32], szArrayData[32];
  521. ArrayGetString(g_SecondaryWeapons, iSelectedWeapon, szArrayData, charsmax(szArrayData)); //Gets the weapon name from the array
  522. replace_all(szArrayData, charsmax(szArrayData), " ", ""); //removes the spaces
  523. format(WeaponName, charsmax(WeaponName), "weapon_%s", szArrayData); //adds weapon_ to the weapon name
  524. strtolower(WeaponName);//Converts all to lower case
  525. GiveWeapons(id, WeaponName); //Gives secondary weapon
  526. }
  527.  
  528. public grenade_throw(id , greindex , wId) //When a grenade is thrown switch to last inv automatically
  529. {
  530. if(get_pcvar_num(g_iToggle) && get_pcvar_num(g_iFastSwitch))
  531. {
  532. client_cmd(id, "lastinv");
  533. }
  534. }
  535.  
  536. stock GiveWeapons(id, szWeapon[])
  537. {
  538. if(is_user_connected(id))
  539. {
  540. new iWeaponId = get_weaponid(szWeapon); //Get the weapon id of the weapon given
  541. give_item(id, szWeapon); //Give the weapon
  542. cs_set_user_bpammo(id, iWeaponId, g_WeaponBPAmmo[iWeaponId]); //Set the ammo to max ammo
  543. }
  544. }
  545.  
  546. stock StripUserWeapons(id)
  547. {
  548. new iC4Ent = get_pdata_cbase(id, OFFSET_C4_SLOT); //Gets the slot for C4
  549.  
  550. if( iC4Ent > 0 ) //If you have the C4
  551. {
  552. set_pdata_cbase(id, OFFSET_C4_SLOT, FM_NULLENT); //Remove it
  553. }
  554.  
  555. strip_user_weapons(id); //Strip User weapons
  556. give_item(id, "weapon_knife"); //Give the knife
  557. set_pdata_int(id, OFFSET_PRIMARYWEAPON, 0); //Set primary weapon offset to 0
  558.  
  559. if( iC4Ent > 0 ) //if you had the c4
  560. {
  561. set_pev(id, pev_weapons, pev(id, pev_weapons) | (1<<CSW_C4)); //Give it back
  562. set_pdata_cbase(id, OFFSET_C4_SLOT, iC4Ent); //Set the offset back to normal
  563. cs_set_user_bpammo(id, CSW_C4, 1); //Give the backpack
  564. cs_set_user_plant(id, 1); //Allow user to plant it
  565. }
  566. return PLUGIN_HANDLED;
  567. }
  568.  
  569. public eTeamInfo()
  570. {
  571. if(!get_pcvar_num(g_iToggle))
  572. return PLUGIN_HANDLED;
  573.  
  574. new id = read_data(1);
  575. new szTeam[2];
  576. read_data(2, szTeam, charsmax(szTeam));
  577. switch(szTeam[0])
  578. {
  579. case 'T':
  580. {
  581. g_iPlayerTeam[id] = CS_TEAM_T;
  582. }
  583. case 'C':
  584. {
  585. g_iPlayerTeam[id] = CS_TEAM_CT;
  586. }
  587. }
  588.  
  589. return PLUGIN_HANDLED;
  590. }
  591.  
  592. public cmdAdminMenu(id)
  593. {
  594. if(!get_pcvar_num(g_iToggle))
  595. return PLUGIN_HANDLED;
  596.  
  597. new iAdminMenu = menu_create("WM Admin Menu", "HandleAdminMenu");
  598.  
  599. switch(get_pcvar_num(g_iTeamMode))
  600. {
  601. case 1:
  602. {
  603. menu_additem(iAdminMenu, "TeamMode:\r T", "0", 0);
  604. }
  605. case 2:
  606. {
  607. menu_additem(iAdminMenu, "TeamMode:\r CT", "0", 0);
  608. }
  609. default:
  610. {
  611. menu_additem(iAdminMenu, "TeamMode:\r Both", "0", 0);
  612. }
  613. }
  614.  
  615. menu_additem(iAdminMenu, "Save and Exit", "1", 0);
  616.  
  617. menu_setprop(iAdminMenu , MPROP_EXIT , MEXIT_NEVER); //Dont allow Menu to exit
  618.  
  619. menu_display(id, iAdminMenu);
  620.  
  621. return PLUGIN_HANDLED;
  622. }
  623.  
  624. public ChangeTeamMode(id, CsTeams:iTeam, iValue)
  625. {
  626. set_pcvar_num(g_iTeamMode, iValue);
  627. g_MenuTeam = iTeam;
  628. switch(iTeam)
  629. {
  630. case CS_TEAM_T: client_print(id, print_center, "Team Mode changed to T");
  631. case CS_TEAM_CT: client_print(id, print_center, "Team Mode changed to CT");
  632. default: client_print(id, print_center, "Team Mode changed to Both");
  633. }
  634. }
  635.  
  636. public HandleAdminMenu(id, iMenu, iItem)
  637. {
  638. new szKey[3], bool:bUpdateMenu, Dummy;
  639. menu_item_getinfo(iMenu, iItem, Dummy, szKey, 2, "", 0, Dummy); //Gets the primary weapon selected.
  640.  
  641. switch(str_to_num(szKey))
  642. {
  643. case 0:
  644. {
  645. switch(get_pcvar_num(g_iTeamMode))
  646. {
  647. case 1:
  648. {
  649. ChangeTeamMode(id, CS_TEAM_CT, 2);
  650. bUpdateMenu = true;
  651. }
  652. case 2:
  653. {
  654. ChangeTeamMode(id, CS_TEAM_UNASSIGNED, 0);
  655. bUpdateMenu = true;
  656. }
  657. default:
  658. {
  659. ChangeTeamMode(id, CS_TEAM_T, 1);
  660. bUpdateMenu = true;
  661. }
  662. }
  663. }
  664. case 1:
  665. {
  666. server_cmd("sv_restart 1");
  667. }
  668. }
  669.  
  670. if(bUpdateMenu)
  671. {
  672. menu_destroy(iMenu);
  673. cmdAdminMenu(id);
  674. }
  675. else
  676. {
  677. menu_destroy(iMenu);
  678. }
  679. }

_________________
Soldiers.~
37.221.209.96:27228


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 1 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 90 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole