Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.19 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include < amxmodx >
  4. #include < amxmisc >
  5. #include < hamsandwich >
  6. #include < fun >
  7. #include < cstrike >
  8. #include < fakemeta >
  9.  
  10. //Like in C ;)
  11. #pragma semicolon 1
  12.  
  13. //Take Damage
  14. #define IsPlayer(%0) ( 1 <= %0 <= g_iMaxPlayers )
  15. new g_iMaxPlayers;
  16.  
  17. //Prefix
  18. new const szPrefix [ ] = "[ Furien Shop ]";
  19.  
  20. //Sound
  21. new const PICK_GUN [ ] = "items/gunpickup2.wav";
  22.  
  23. //SK Models
  24. new const SK [ ] [ ] =
  25. {
  26. "models/furien_shop/v_superknifee.mdl",
  27. "models/p_knife.mdl"
  28. };
  29.  
  30. //Cvar's
  31. new sk_price, he_t_price, he_ct_price, defuse_price, hp_price, ap_price;
  32. new sk_damage, max_hp, max_ap;
  33.  
  34. //Bools
  35. new bool: HasSK[ 33 ];
  36.  
  37. //Init
  38. public plugin_init( )
  39. {
  40. register_plugin( "Furien Shop", "1.0", "Snow." );
  41.  
  42. //Open Shop
  43. register_clcmd( "say", "Func_Say" );
  44. register_clcmd( "say_team", "Func_Say" );
  45. register_clcmd( "/shop", "CheckTeam" );
  46. register_clcmd( "shop", "CheckTeam" );
  47.  
  48. //Cvar's
  49. sk_price = register_cvar( "fs_sk_price", "10000" );
  50. he_t_price = register_cvar( "fs_he_t_price", "3000" );
  51. he_ct_price = register_cvar( "fs_he_ct_price", "6000" );
  52. defuse_price = register_cvar( "fs_defuse_price", "500" );
  53. hp_price = register_cvar( "fs_hp_price", "3000" );
  54. ap_price = register_cvar( "fs_ap_price", "500" );
  55. sk_damage = register_cvar( "fs_sk_damage", "2.0" );
  56. max_hp = register_cvar( "fs_max_hp", "200" );
  57. max_ap = register_cvar( "fs_max_ap", "300" );
  58.  
  59. //Ham's
  60. RegisterHam( Ham_Killed, "player", "Ham_CBasePlayer_Killed_Post", true );
  61. RegisterHam( Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1 );
  62. RegisterHam( Ham_TakeDamage, "player", "Player_TakeDamage" );
  63.  
  64. //Curent Weapon
  65. register_event ( "CurWeapon", "Current_Weapon", "be", "1=1" );
  66.  
  67. //Max Players
  68. g_iMaxPlayers = get_maxplayers ( );
  69. }
  70.  
  71. //Precache
  72. public plugin_precache( )
  73. {
  74. static i;
  75. for( i = 0 ; i < sizeof ( SK ); i++ )
  76. precache_model( SK [ i ] );
  77.  
  78. precache_sound( PICK_GUN );
  79.  
  80. return PLUGIN_CONTINUE;
  81. }
  82.  
  83. //Killed
  84. public Ham_CBasePlayer_Killed_Post( id )
  85. HasSK[ id ] = false;
  86.  
  87. //Spawn
  88. public fwHamPlayerSpawnPost( id )
  89. {
  90. if( get_user_team(id) == 2 )
  91. HasSK[ id ] = false;
  92. }
  93.  
  94. //Put in Server
  95. public client_putinserver( id )
  96. HasSK[ id ] = false;
  97.  
  98. //Open Shop
  99. public Func_Say( id )
  100. {
  101. new szSaid[ 192 ];
  102. read_args( szSaid, sizeof( szSaid ) -1 );
  103.  
  104. remove_quotes( szSaid );
  105.  
  106. if( contain( szSaid, "shop" ) != -1 && !is_user_alive(id))
  107. {
  108. CheckTeam( id );
  109. return 1;
  110. }
  111. else if( contain( szSaid, "shop" ) != -1 && is_user_alive(id))
  112. CheckTeam( id );
  113. return 0;
  114. }
  115.  
  116. //Show Model
  117. public Current_Weapon( id )
  118. {
  119. new weapon = get_user_weapon( id );
  120.  
  121. if( weapon == CSW_KNIFE )
  122. {
  123. if( HasSK[ id ] == true )
  124. {
  125. set_pev ( id, pev_viewmodel2, SK[ 0 ] );
  126. set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
  127. }
  128. }
  129. }
  130.  
  131. //Damage
  132. public Player_TakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage )
  133. {
  134. if ( iInflictor == iAttacker && IsPlayer ( iAttacker ) && HasSK [ iAttacker ] )
  135. {
  136. SetHamParamFloat ( 4, fDamage * get_pcvar_float( sk_damage ) );
  137.  
  138. return HAM_HANDLED;
  139. }
  140.  
  141. return HAM_IGNORED;
  142.  
  143. }
  144.  
  145. //Check Team Shop
  146. public CheckTeam( id )
  147. {
  148. if( is_user_alive ( id ) )
  149. {
  150. if ( get_user_team ( id ) == 1 )
  151. ShowMenu_T( id );
  152. if ( get_user_team ( id ) == 2 )
  153. ShowMenu_CT( id );
  154. }
  155. }
  156.  
  157. //T Shop
  158. public ShowMenu_T( id )
  159. {
  160. new menu_t = menu_create( "\rFurien \yShop^n", "T_Menu" );
  161.  
  162. new iLine1 [ 200 ];
  163. new iLine2 [ 200 ];
  164. new iLine3 [ 200 ];
  165. new iLine4 [ 200 ];
  166.  
  167. formatex( iLine1 , sizeof ( iLine1 ) -1 , "SuperKnife\R\y%i" , get_pcvar_num( sk_price ) );
  168. formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_t_price ) );
  169. formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
  170. formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
  171.  
  172. menu_additem( menu_t, iLine1, "1" );
  173. menu_additem( menu_t, iLine2, "2" );
  174. menu_additem( menu_t, iLine3, "3" );
  175. menu_additem( menu_t, iLine4, "4" );
  176.  
  177. menu_setprop( menu_t, MPROP_EXIT, MEXIT_ALL );
  178. menu_setprop( menu_t, MPROP_NOCOLORS, 1 );
  179. menu_setprop( menu_t, MPROP_NUMBER_COLOR, "\y" );
  180.  
  181. menu_display( id, menu_t, 0 );
  182.  
  183. return PLUGIN_HANDLED;
  184. }
  185.  
  186. public T_Menu( id, menu_t, item )
  187. {
  188. if( item == MENU_EXIT || get_user_team( id ) != 1 )
  189. return PLUGIN_HANDLED;
  190.  
  191. new command[ 6 ], name[ 64 ], access, callback;
  192.  
  193. new price;
  194. price = cs_get_user_money( id );
  195.  
  196. menu_item_getinfo( menu_t, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
  197.  
  198. switch(item)
  199. {
  200. case 0:
  201. {
  202. if( price >= get_pcvar_num( sk_price ) )
  203. {
  204. if ( !HasSK [ id ] )
  205. {
  206. //Get Money
  207. cs_set_user_money( id, price - get_pcvar_num( sk_price ) );
  208.  
  209. //Pev SuperKnife
  210. if( get_user_weapon( id ) == CSW_KNIFE )
  211. {
  212. set_pev ( id, pev_viewmodel2, SK[ 0 ] );
  213. set_pev ( id, pev_weaponmodel2, SK[ 1 ] );
  214. }
  215. else
  216. engclient_cmd( id, "weapon_knife" );
  217.  
  218. //Give SuperKnife
  219. HasSK[ id ] = true;
  220.  
  221. //Sound
  222. emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  223. }
  224. else
  225. ColorChat( id, "^x04%s^x01 Ai deja^x03 SuperKnife !", szPrefix );
  226. }
  227. else
  228. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( sk_price ) );
  229. }
  230. case 1:
  231. {
  232. if( price >= get_pcvar_num( he_t_price ) )
  233. {
  234. if( ! user_has_weapon( id , CSW_HEGRENADE ) )
  235. {
  236. //Get Money
  237. cs_set_user_money( id, price - get_pcvar_num( he_t_price ) );
  238.  
  239. //Give He
  240. give_item( id, "weapon_hegrenade" );
  241.  
  242. }
  243. else
  244. ColorChat( id, "^x04%s^x01 Ai deja ^x03 He Grenade !", szPrefix );
  245. }
  246. else
  247. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_t_price ) );
  248. }
  249. case 2:
  250. {
  251. if( price >= get_pcvar_num( hp_price ) )
  252. {
  253. if( get_user_health( id ) < get_pcvar_num( max_hp ) )
  254. {
  255. //Get Money
  256. cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
  257.  
  258. //Give Health
  259. set_user_health( id, get_user_health ( id ) + 50 );
  260.  
  261. //Sound
  262. emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  263.  
  264. //Verify
  265. if( get_user_health( id ) > get_pcvar_num( max_hp ) )
  266. set_user_health( id, get_pcvar_num( max_hp ) );
  267. }
  268. else
  269. ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
  270. }
  271. else
  272. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );
  273. }
  274. case 3:
  275. {
  276. if( price >= get_pcvar_num( ap_price ) )
  277. {
  278. if( get_user_armor ( id ) < get_pcvar_num( max_ap ) )
  279. {
  280. //Get Money
  281. cs_set_user_money( id, price - get_pcvar_num( ap_price ) );
  282.  
  283. //Give AP
  284. set_user_armor( id, get_user_armor( id ) + 50 );
  285.  
  286. //Sound
  287. emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  288.  
  289. //Verify
  290. if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
  291. set_user_armor( id, get_pcvar_num( max_ap ) );
  292. }
  293. else
  294. ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
  295. }
  296. else
  297. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );
  298. }
  299. }
  300. menu_destroy( menu_t );
  301.  
  302. return PLUGIN_HANDLED;
  303. }
  304.  
  305. //CT Shop
  306. public ShowMenu_CT( id )
  307. {
  308. new menu_ct = menu_create( "\rAnti-Furien \yShop^n", "CT_Menu" );
  309.  
  310. new iLine1 [ 200 ];
  311. new iLine2 [ 200 ];
  312. new iLine3 [ 200 ];
  313. new iLine4 [ 200 ];
  314.  
  315. formatex( iLine1 , sizeof ( iLine1 ) -1 , "Defuse\R\y%i" , get_pcvar_num( defuse_price ) );
  316. formatex( iLine2 , sizeof ( iLine2 ) -1 , "He\R\y%i" , get_pcvar_num( he_ct_price ) );
  317. formatex( iLine3 , sizeof ( iLine3 ) -1 , "HP +50\R\y%i" , get_pcvar_num( hp_price ) );
  318. formatex( iLine4 , sizeof ( iLine4 ) -1 , "AP +50\R\y%i" , get_pcvar_num( ap_price ) );
  319.  
  320. menu_additem( menu_ct, iLine1, "1" );
  321. menu_additem( menu_ct, iLine2, "2" );
  322. menu_additem( menu_ct, iLine3, "3" );
  323. menu_additem( menu_ct, iLine4, "4" );
  324.  
  325. menu_setprop( menu_ct, MPROP_EXIT, MEXIT_ALL );
  326. menu_setprop( menu_ct, MPROP_NOCOLORS, 1 );
  327. menu_setprop( menu_ct, MPROP_NUMBER_COLOR, "\y" );
  328.  
  329. menu_display( id, menu_ct, 0 );
  330.  
  331. return PLUGIN_HANDLED;
  332. }
  333.  
  334. public CT_Menu( id, menu_ct, item )
  335. {
  336. if( item == MENU_EXIT || get_user_team( id ) != 2 )
  337. return PLUGIN_HANDLED;
  338.  
  339. new command[ 6 ], name[ 64 ], access, callback;
  340.  
  341. new price;
  342. price = cs_get_user_money( id );
  343.  
  344. menu_item_getinfo( menu_ct, item, access, command, sizeof command - 1, name, sizeof name - 1, callback );
  345.  
  346. switch(item)
  347. {
  348. case 0:
  349. {
  350. if( price >= get_pcvar_num( defuse_price ) )
  351. {
  352. if ( !cs_get_user_defuse( id ) )
  353. {
  354. //Get Money
  355. cs_set_user_money( id, price - get_pcvar_num( defuse_price ) );
  356.  
  357. //Give DefuseKit
  358. cs_set_user_defuse( id,1 );
  359.  
  360. //Sound
  361. emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  362. }
  363. else
  364. ColorChat( id, "^x04%s^x01 Ai deja^x03 DefuseKIT !", szPrefix );
  365. }
  366. else
  367. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( defuse_price ) );
  368. }
  369. case 1:
  370. {
  371. if( price >= get_pcvar_num( he_ct_price ) )
  372. {
  373. if( ! user_has_weapon( id , CSW_HEGRENADE ) )
  374. {
  375. //Get Money
  376. cs_set_user_money( id, price - get_pcvar_num( he_ct_price ) );
  377.  
  378. //Give He
  379. give_item( id, "weapon_hegrenade" );
  380. }
  381. else
  382. ColorChat( id, "^x04%s^x01 Ai deja^x03 He Grenade !", szPrefix );
  383. }
  384. else
  385. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( he_ct_price ) );
  386. }
  387. case 2:
  388. {
  389. if( price >= get_pcvar_num( hp_price ) )
  390. {
  391. if( get_user_health( id ) < get_pcvar_num( max_hp ) )
  392. {
  393. //Get Money
  394. cs_set_user_money( id, price - get_pcvar_num( hp_price ) );
  395.  
  396. //Give Health
  397. set_user_health ( id, get_user_health ( id ) + 50 );
  398.  
  399. //Sound
  400. emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  401.  
  402. //Verify
  403. if( get_user_health( id ) > get_pcvar_num( max_hp ) )
  404. set_user_health( id, get_pcvar_num( max_hp ) );
  405. }
  406. else
  407. ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d HP !", szPrefix, get_pcvar_num( max_hp ) );
  408. }
  409. else
  410. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( hp_price ) );
  411. }
  412. case 3:
  413. {
  414. if( price >= get_pcvar_num( ap_price ) )
  415. {
  416. if( get_user_armor( id ) < get_pcvar_num( max_ap ) )
  417. {
  418. //Get Money
  419. cs_set_user_money( id,price- get_pcvar_num( ap_price ) );
  420.  
  421. //Give AP
  422. set_user_armor( id, get_user_armor( id ) + 50 );
  423.  
  424. //Sound
  425. emit_sound( id, CHAN_ITEM, PICK_GUN, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  426.  
  427. //Verify
  428. if( get_user_armor( id ) > get_pcvar_num( max_ap ) )
  429. set_user_armor( id, get_pcvar_num( max_ap ) );
  430. }
  431. else
  432. ColorChat( id, "^x04%s^x01 Ai atins limita de^x03 %d AP !", szPrefix, get_pcvar_num( max_ap ) );
  433. }
  434. else
  435. ColorChat( id, "^x04%s^x01 Nu ai destui^x03 bani!^x01 Ai nevoie de^x03 %d$ !", szPrefix, get_pcvar_num( ap_price ) );
  436. }
  437. }
  438. menu_destroy( menu_ct );
  439.  
  440. return PLUGIN_HANDLED;
  441. }
  442.  
  443. //Stock ColorChat
  444. stock ColorChat( const id, const input[ ], any:... )
  445. {
  446. new count = 1, players[ 32 ];
  447. static msg[ 191 ];
  448. vformat( msg, 190, input, 3 );
  449.  
  450. replace_all( msg, 190, "!g", "^4" );
  451. replace_all( msg, 190, "!y", "^1" );
  452. replace_all( msg, 190, "!t", "^3" );
  453.  
  454. if( id ) players[ 0 ] = id;
  455. else get_players( players, count, "ch" );
  456. {
  457. for( new i = 0; i < count; i++ )
  458. {
  459. if( is_user_connected( players[ i ] ) )
  460. {
  461. message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
  462. write_byte( players[ i ] );
  463. write_string( msg );
  464. message_end( );
  465. }
  466. }
  467. }
  468. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement