hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 12:22



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Bing [Bot] 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  [ 3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: fegyvermenü Hiba
HozzászólásElküldve: 2014.08.25. 19:53 
Eszt ki lehet javítani ne ilyen csunya legyen az Ő-betü?
+nem hoza fel a fegyvermenüt ha beírom a parancsot


Csatolmányok:
de_dust20000.jpg
de_dust20000.jpg [ 65.37 KiB | Megtekintve 1186 alkalommal ]
Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: fegyvermenü Hiba
HozzászólásElküldve: 2014.08.25. 23:46 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.16. 18:17
Hozzászólások: 347
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 30 alkalommal
Szia egy ms-t dopbsz ,akkor javítom neked a parancsot ,ja és az "ő" bető ,asszem csak a stockal lesz olyan szép ,vagyis rendes.:)

_________________
Kép

Ők köszönték meg golden15 nek ezt a hozzászólást: spice (2014.08.26. 09:29)
  Népszerűség: 2.27%


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


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  [ 3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 30 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