Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.96 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #pragma tabsize 0
  5.  
  6. #define PLUGIN "Special Menu"
  7. #define VERSION "1.0"
  8. #define AUTHOR "eVo"
  9.  
  10. new Director[256],
  11. bool:ParolaSetata[33] = false,
  12. Cumparat[33],
  13. Data[200],
  14. Secunde[33] = 0,
  15. BuySlot [33],
  16. BuyThunderBolt[33],
  17. Buythanatos9[33],
  18. BuyGoldDeagle[33],
  19. Slot,
  20. Thunderbolt,
  21. thanatos9,
  22. GoldDeagle,
  23. Timp;
  24.  
  25. new Tag[] = "!g[BB.InDungi.Ro] ";
  26.  
  27. native fcs_get_user_credits ( id );
  28. native fcs_set_user_credits ( id, credits );
  29.  
  30. native give_thunderbolt(id)
  31. native give_zp_extra_thanatos9(id)
  32. native give_GoldDeagle(id)
  33.  
  34. native bb_is_build_phase()
  35.  
  36. public plugin_init()
  37. {
  38.  
  39. register_plugin(PLUGIN, VERSION, AUTHOR)
  40.  
  41. register_clcmd ( "say /special", "SpecialMenu" );
  42. register_clcmd ( "say_team /special", "SpecialMenu")
  43.  
  44. register_clcmd ( "Introdu_Parola", "cmdPassword" );
  45.  
  46. Slot = register_cvar ( "cvar_pret_slot", "25000" );
  47. Thunderbolt = register_cvar ( "cvar_pret_thunderbolt", "50000" );
  48. thanatos9 = register_cvar ( "cvar_pret_thanatos9", "50000" );
  49. GoldDeagle = register_cvar ( "cvar_pret_GoldDeagle", "50000" );
  50. Timp = register_cvar ( "cvar_timp_parola", "15" );
  51. }
  52.  
  53. public client_putinserver ( id )
  54. {
  55. Secunde [id] = 0;
  56.  
  57. ParolaSetata [id] = false;
  58. }
  59.  
  60. public client_disconnect ( id ) ParolaSetata [id] = false;
  61.  
  62. public SpecialMenu(id)
  63. {
  64. new Menu = menu_create ( "[BB.InDungi.Ro] Special Menu", "SpecialGiver" );
  65. new Credite = fcs_get_user_credits ( id );
  66.  
  67. formatex ( BuySlot, charsmax ( BuySlot ), "Cumpara SLOT \r[%d Euro]", get_pcvar_num ( Slot ) )
  68. formatex ( BuyThunderBolt, charsmax ( BuyThunderBolt ), "ThunderBolt \rCSO \r[%d Euro]", get_pcvar_num ( Thunderbolt ) )
  69. formatex ( Buythanatos9, charsmax ( Buythanatos9 ), "thanatos9 \rCSO \r[%d Euro]", get_pcvar_num ( thanatos9 ) )
  70. formatex ( BuyGoldDeagle, charsmax ( BuyGoldDeagle ), "Gold \rDeagle\r[%d Euro]", get_pcvar_num ( GoldDeagle ) )
  71.  
  72. if ( Credite < get_pcvar_num ( Slot ) || get_user_flags ( id ) & read_flags ( "b" ) )
  73. menu_additem ( Menu, "\dCumpara SLOT \r[Indisponibil]");
  74. else
  75. menu_additem ( Menu, BuySlot, "1");
  76.  
  77.  
  78. if ( Credite < get_pcvar_num ( Thunderbolt ) || get_user_team(id) == 1 || bb_is_build_phase() )
  79. menu_additem ( Menu, "\dThunderBolt \rCSO");
  80. else
  81. menu_additem ( Menu, BuyThunderBolt, "2");
  82.  
  83.  
  84. if ( Credite < get_pcvar_num ( thanatos9) || get_user_team(id) == 1 || bb_is_build_phase() )
  85. menu_additem ( Menu, "\dThanatos9 \rCSO \rKnife");
  86. else
  87. menu_additem ( Menu, Buythanatos9, "3");
  88.  
  89. if ( Credite < get_pcvar_num ( GoldDeagle ) || get_user_team(id) == 1 || bb_is_build_phase() )
  90. menu_additem ( Menu, "\dGold \rDeagle\");
  91. else
  92. menu_additem ( Menu, BuyGoldDeagle, "4");
  93.  
  94.  
  95. menu_setprop ( Menu, MPROP_EXIT, MEXIT_ALL );
  96. menu_display ( id, Menu, 0 );
  97. return PLUGIN_HANDLED;
  98.  
  99. }
  100. public SpecialGiver ( id, Menu, item )
  101. {
  102. if ( !is_user_connected ( id ) ) return PLUGIN_HANDLED;
  103.  
  104. if ( item == MENU_EXIT )
  105. {
  106. menu_destroy ( Menu );
  107. return PLUGIN_HANDLED;
  108. }
  109. new iData [6], iName [64];
  110. new access, callback;
  111.  
  112. menu_item_getinfo ( Menu, item, access, iData,5, iName, 63, callback );
  113.  
  114. new Key = str_to_num ( iData );
  115.  
  116. new Credite = fcs_get_user_credits ( id );
  117.  
  118. switch( Key )
  119. {
  120. case 1:
  121. {
  122. if ( get_user_flags ( id ) & read_flags ( "b" ) )
  123. {
  124. ChatColor ( id, "%s!team Ai deja !gSLOT!team!", Tag );
  125.  
  126. SpecialMenu ( id );
  127.  
  128. return PLUGIN_HANDLED
  129. }
  130.  
  131. if ( Credite < get_pcvar_num ( Slot ) )
  132. {
  133. ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
  134.  
  135. SpecialMenu ( id );
  136.  
  137. return PLUGIN_HANDLED;
  138. }
  139. else
  140. {
  141. client_cmd ( id, "messagemode Introdu_Parola" );
  142.  
  143. Secunde [id] = get_pcvar_num ( Timp );
  144.  
  145. Cumparat [id] = 1;
  146.  
  147. Cautare ( id );
  148.  
  149. ParolaSetata [id] = true;
  150.  
  151. }
  152. return PLUGIN_HANDLED;
  153. }
  154. case 2:
  155. {
  156. if ( Credite < get_pcvar_num ( Thunderbolt ) )
  157. {
  158. ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
  159.  
  160. SpecialMenu ( id );
  161.  
  162. return PLUGIN_HANDLED;
  163. }
  164. if( get_user_team(id) == 1 )
  165. {
  166. ChatColor ( id, "%s!team Doar pentru !gBuilders!team au acces la acest item!", Tag );
  167.  
  168. SpecialMenu ( id );
  169.  
  170. return PLUGIN_HANDLED;
  171. }
  172. if ( bb_is_build_phase() )
  173. {
  174. ChatColor ( id, "%s!team Puteti cumpara acest item doar in !gTimpul de Pregatire!team sau dupa acesta!", Tag );
  175.  
  176. SpecialMenu ( id );
  177.  
  178. return PLUGIN_HANDLED;
  179. }
  180. else
  181. {
  182. give_thunderbolt(id);
  183. fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( Thunderbolt ))
  184. ChatColor ( id, "%s!team Succes! Ai cumparat !gThunderBolt Sniper!team!", Tag );
  185. return 1;
  186. }
  187.  
  188. }
  189. case 3:
  190. {
  191. if ( Credite < get_pcvar_num ( thanatos9 ) )
  192. {
  193. ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
  194.  
  195. SpecialMenu ( id );
  196.  
  197. return PLUGIN_HANDLED;
  198. }
  199. if( get_user_team(id) == 1 )
  200. {
  201. ChatColor ( id, "%s!team Doar pentru !gBuilders!team au acces la acest item!", Tag );
  202.  
  203. SpecialMenu ( id );
  204.  
  205. return PLUGIN_HANDLED;
  206. }
  207. if ( bb_is_build_phase() )
  208. {
  209. ChatColor ( id, "%s!team Puteti cumpara acest item doar in !gTimpul de Pregatire!team sau dupa acesta!", Tag );
  210.  
  211. SpecialMenu ( id );
  212.  
  213. return PLUGIN_HANDLED;
  214. }
  215. else
  216. {
  217. give_zp_extra_thanatos9(id);
  218.  
  219. fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( thanatos9 ))
  220.  
  221. ChatColor ( id, "%s!team Succes! Ai cumparat !gM4a1 Magnum!team!", Tag );
  222.  
  223. return 1;
  224. }
  225. }
  226. case 4:
  227. {
  228. if ( Credite < get_pcvar_num ( GoldDeagle ) )
  229. {
  230. ChatColor ( id, "%s!team Nu ai destui !gEuro!team pentru a cumpara acest item!", Tag );
  231.  
  232. SpecialMenu ( id );
  233.  
  234. return PLUGIN_HANDLED;
  235. }
  236. if( get_user_team(id) == 1 )
  237. {
  238. ChatColor ( id, "%s!team Doar pentru !gBuilders!team au acces la acest item!", Tag );
  239.  
  240. SpecialMenu ( id );
  241.  
  242. return PLUGIN_HANDLED;
  243. }
  244. if ( bb_is_build_phase() )
  245. {
  246. ChatColor ( id, "%s!team Puteti cumpara acest item doar in !gTimpul de Pregatire!team sau dupa acesta!", Tag );
  247.  
  248. SpecialMenu ( id );
  249.  
  250. return PLUGIN_HANDLED;
  251. }
  252. else
  253. {
  254. give_GoldDeagle(id);
  255. fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( GoldDeagle ))
  256. ChatColor ( id, "%s!team Succes! Ai cumparat !gGoldDeagle wow!team!", Tag );
  257. return 1;
  258. }
  259.  
  260. }
  261.  
  262. }
  263. return PLUGIN_HANDLED;
  264. }
  265. public Cautare ( id )
  266. {
  267. if ( !is_user_connected ( id ) )
  268. Secunde [id] = 0;
  269. if ( Secunde [id] > 1 )
  270. {
  271. Secunde [id] --;
  272. set_hudmessage ( 0, 255, 0, 0.05, 0.25, 0, 6.0, 1.0 )
  273. show_hudmessage ( id, "Ai la dispozite %i secunde sa introduci parola !", Secunde [id] );
  274.  
  275. set_task ( 1.0, "Cautare", id );
  276. }
  277. else if ( Secunde [id] <= 1 )
  278. {
  279. ParolaSetata [id] = false;
  280. ChatColor ( id, "%s!team A expirat timpul! Inregistrarea a esuat! Nu ti-au fost retrasi Euro!", Tag );
  281. Secunde [id] = 0;
  282. }
  283. }
  284. public cmdPassword ( id )
  285. {
  286. new Password [32]; read_argv ( 1, Password, charsmax ( Password ) );
  287.  
  288. static Name [32]; get_user_name ( id, Name, charsmax ( Name ) );
  289.  
  290. get_configsdir ( Director, charsmax ( Director ) );
  291.  
  292. formatex ( Director, charsmax ( Director ), "%s/users.ini", Director );
  293.  
  294. if ( Cumparat [id] == 1 )
  295. {
  296. formatex ( Data, charsmax ( Data ), "^"%s^" ^"%s^" ^"b^" ^"a^" ; Acces Cumparat Din Special Menu", Name, Password );
  297. }
  298.  
  299.  
  300. if ( ParolaSetata [id] )
  301. {
  302. if ( Password [0] )
  303. {
  304. ParolaSetata [id] = false;
  305.  
  306. remove_task ( id );
  307.  
  308. CautareUser ( id );
  309.  
  310. write_file ( Director, Data );
  311.  
  312. set_user_info ( id, "_eVo", Password );
  313.  
  314. set_task ( 2.0, "ReloadAdmins" );
  315.  
  316. if ( Cumparat [id] == 1 )
  317. {
  318. fcs_set_user_credits ( id, fcs_get_user_credits ( id ) - get_pcvar_num ( Slot ))
  319. ChatColor ( id, "%s!team Ai cumparat !gSLOT!team cu succes! Nume:!g%s!team, Parola:!g%s!team ! ", Tag, Name, Password );
  320. }
  321. }
  322. else
  323. {
  324. ChatColor ( id, "%s!team Parola introdusa este invalida! Te rugam incearca din nou!", Tag );
  325. client_cmd ( id, "messagemode register" );
  326.  
  327. return PLUGIN_HANDLED;
  328. }
  329. }
  330. else
  331. {
  332. ChatColor ( id, "%s!team A expirat timpul deja! Te rugam sa incerci din nou!", Tag );
  333.  
  334. return PLUGIN_HANDLED;
  335. }
  336. return PLUGIN_HANDLED;
  337. }
  338. public ReloadAdmins ( ) server_cmd ( "amx_reloadadmins" );
  339. public CautareUser ( id )
  340. {
  341. new FileName [64]; get_configsdir ( FileName, charsmax ( FileName ) );
  342.  
  343. add ( FileName, charsmax ( FileName ), "/users.ini" );
  344.  
  345. new File, Line;
  346.  
  347. new Name [32]; get_user_name ( id, Name, charsmax ( Name ) );
  348.  
  349. ReadFile:
  350.  
  351. File = fopen ( FileName , "rt" );
  352.  
  353. Line = -1;
  354.  
  355. if ( File )
  356. {
  357. new Format [256], i, Key [32];
  358. while ( !feof ( File ) )
  359. {
  360. Line ++;
  361.  
  362. fgets ( File, Format, charsmax ( Format ) );
  363.  
  364. trim ( Format );
  365.  
  366. i = Format [0];
  367.  
  368. if ( i && i != '#' && i != ';' && !( i == '/' && Format [1] == '/' ) )
  369. {
  370. parse ( Format, Key, charsmax ( Key ) );
  371.  
  372. if ( equal ( Key, Name ) )
  373. {
  374. fclose ( File );
  375.  
  376. File = 0;
  377.  
  378. write_file ( FileName, "", Line );
  379.  
  380. goto ReadFile;
  381. }
  382. }
  383. }
  384.  
  385. fclose ( File );
  386.  
  387. File = 0;
  388. }
  389. }
  390. //********************STOCK-URI********************
  391. stock ChatColor(const id, const input[], any:...)
  392. {
  393. new count = 1, players[32]
  394. static msg[191]
  395. vformat(msg, 190, input, 3)
  396.  
  397. replace_all(msg, 190, "!g", "^4")
  398. replace_all(msg, 190, "!y", "^1")
  399. replace_all(msg, 190, "!team", "^3")
  400.  
  401. if (id) players[0] = id; else get_players(players, count, "ch")
  402. {
  403. for (new i = 0; i < count; i++)
  404. {
  405. if (is_user_connected(players[i]))
  406. {
  407. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  408. write_byte(players[i]);
  409. write_string(msg);
  410. message_end();
  411. }
  412. }
  413. }
  414. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement