Advertisement
macquid123560

Top Jailbreak | Shop

Mar 23rd, 2016
4,091
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 85.68 KB | None | 0 0
  1. #define USE_FVAULT
  2. #define MAX_KNIFE_SNDS 9
  3.  
  4. /* Includes */
  5.  
  6. #include < amxmodx >
  7. #include < amxmisc >
  8. #include < fakemeta_util >
  9. #include < cstrike >
  10. #include < hamsandwich >
  11. #include < engine >
  12. #include < fvault >
  13. #include < dhudmessage >
  14. #include < fun >
  15. #include < unixtime >
  16.  
  17. #if defined USE_FVAULT
  18. #include < fvault >
  19. #else
  20. #include < nvault >
  21. #endif
  22.  
  23. #include < regex >
  24.  
  25. /* Defines */
  26.  
  27.  
  28. #define REGEX_IP_PATTERN    "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
  29. #define REGEX_STEAMID_PATTERN   "^^STEAM_0:(0|1):\d+$"
  30.  
  31. #define CASH_KILL       250
  32. #define CASH_HS         500
  33. #define CASH_NEXT       1500
  34. #define NEXT_CASH_TIME      5
  35.  
  36. #define XP_KILL         1
  37. #define XP_HS           2
  38.  
  39. #define GAMBLE_CHANCE       40
  40. #define GAMBLE_CHANCE_PREMIUM   5
  41. #define GAMBLE_CHANCE_ALLIN 2
  42. #define TAX         30
  43.  
  44. #define BANK_TAX        10
  45. #define BANK_TAX_PREMIUM    5
  46.  
  47. /* Natives */
  48.  
  49. native bool: is_lr_start();
  50. native get_ruuning_day();
  51. native get_user_gang_nextcash( const index );
  52. native is_running_vote();
  53.  
  54. native get_user_tickets(index);
  55. native set_user_tickets(index,amount);
  56.  
  57. /* Enums */
  58.  
  59. enum _:g_mData {
  60.     CASH,
  61.     BANK,
  62.     KNIFE,
  63.     gKNIFE,
  64.     gXP,
  65.     gLVL
  66. };
  67.  
  68. enum _:g_fData {
  69.     Float: GAMETIME,
  70.     Float: NEXTCASH
  71. };
  72.  
  73. enum _:g_mMenus {
  74.     g_mName[ 32 ],
  75.     g_mClass[ 32 ],
  76.     g_mPrice,
  77.     g_mTime,
  78.     g_mWeapon
  79. };
  80.  
  81. enum _:g_mKnives {
  82.     g_kName[ 32 ],
  83.     g_kHealth,
  84.     g_kArmor,
  85.     g_mDamage,
  86.     g_kCash,
  87.     g_kPrice,
  88.     g_kPlayerModel,
  89.     g_kPremium,
  90.     g_kSzPlayerModel[ 128 ],
  91.     g_kSzTheModel[ 64 ],
  92.     g_kLevelNeeded
  93. }
  94.  
  95. enum _:g_mKnivesModels {
  96.     V_MODEL[ 128 ],
  97.     P_MODEL[ 128 ]
  98. };
  99.  
  100. /* Constants & Others */
  101.  
  102. new const szPrefix[ ] = "Top JailBreak";
  103. new const szChatPrefix[ ] = "^4[^1 Top jailbreak ^4]^1";
  104.  
  105. new g_iPlayTime[ 32 ], g_iLastUpdateTime[ 32 ];
  106.  
  107. new const g_szBeacon[ ][ ] = {
  108.     "fvox/blip.wav",
  109.     "sprites/zbeam2.spr"
  110. };
  111.  
  112. new const g_szExplosion[ ] = "sprites/zerogxplode.spr";
  113.  
  114. new const g_szGrenades[ ][ g_mMenus ] = {
  115.     { "Explosive", "weapon_hegrenade", 10000, 0, CSW_HEGRENADE },
  116.     { "Flashbang", "weapon_flashbang", 10000, 0, CSW_FLASHBANG },
  117.     { "Gas", "weapon_smokegrenade", 10000, 0, CSW_SMOKEGRENADE }
  118. };
  119.  
  120. new const g_szPowerups[ ][ g_mMenus ] = {
  121.     { "Godmode", "taskRemoveGodmode", 7000, 5 },
  122.     { "Stealth", "taskRemoveStealth", 9000, 5 },
  123.     { "Camouflage", "taskRemoveCamouflage", 9000, 10 },
  124.     { "Low Gravity", "taskRemoveGravity", 4000, 10 },
  125.     { "Suicide Bomber", "", 6000, 3 },
  126.     { "Super Speed", "taskRemoveSpeed",5000, 5 }
  127. };
  128.  
  129.  
  130. new const g_szKnives[ 22 ][ g_mKnives ] = {
  131.     // Name         HP  AP      DMG B.Cash  Price       P.M Premium P.Fol               P.Msz   Level
  132.     { "Starter",        0,  0,      000,      00"", "", 0 },
  133.     { "Bayonet Safari", 3,  4,      2130,    18000,      00"", "", 0 },
  134.     { "Far-Cry 3",      3,  6,      2140,    30000,      00"", "", 0 },
  135.     { "Falchion",       6,  7,      3150,    60000,      00"", "", 0 },
  136.     { "Incorp",     7,  10,     3160,    100000,     00"", "", 3 },
  137.     { "Gut",        8,  12,     4170,    125000,     00"", "", 5 },
  138.     { "Diamond Staff"10,  14,    4180,    170000,     00"", "", 6 },
  139.     { "Dagger",     11,  16,    5190,    200000,     00"", "", 7 },
  140.     { "Crowbar",        12,  17,    6200,    230000,     00"", "", 9 },
  141.     { "Shadow Carbon"13,  18,    6210,    260000,     00"", "", 9 },
  142.     { "Balrog",     13,  19,    7220,    300000,     00"", "", 10 },
  143.     { "Katana",     16,  19,    9225,    340000,     00"", "", 11 },
  144.     { "Katana2",        18,  20,    10, 230,    375000,     00"", "", 13 },
  145.     { "Butterfly Asiimov"19,  22,    12, 235,    405000,     00"", "", 15 },
  146.     { "Tribal Butterfly",   20,  24,    14, 240,    440000,     00"", "", 17 },
  147.     { "Rambo",      22,  26,    16, 250,    490000,     00"", "", 20 },
  148.     { "Riddick",        22,  26,    16, 250,    510000,     00"", "", 25 },
  149.     { "Hammer",     22,  26,    16, 250,    550000,     00"", "", 35 },
  150.     { "Janus",      23,  27,    18, 260,    600000,     00"", "", 40 },
  151.     { "Stars War",      24,  28,    20, 270,    650000,     00"", "", 45 },
  152.     { "Defibrillator"25,  29,    22, 270,    700000,     00"", "", 50 },
  153.     { "Dragon Sword",   26,  30,    24, 280,    740000,     00"", "", 55 }
  154. };
  155.  
  156. new const g_szKnivesModels[ 22 ][ ] = {
  157.     "models/Top/JB/Shop/knives_v2/v_starter.mdl",
  158.     "models/Top/JB/Shop/knives_v2/v_bayonet_safari.mdl",
  159.     "models/Top/JB/Shop/knives_v2/v_farcry3.mdl",
  160.     "models/Top/JB/Shop/knives_v2/v_falchion.mdl",
  161.     "models/Top/JB/Shop/knives_v2/v_incorp.mdl",
  162.     "models/Top/JB/Shop/knives_v2/v_gut.mdl",
  163.     "models/Top/JB/Shop/knives_v2/v_diamond_staff.mdl",
  164.     "models/Top/JB/Shop/knives_v2/v_dagger.mdl",
  165.     "models/Top/JB/Shop/knives_v2/v_crowbar.mdl",
  166.     "models/Top/JB/Shop/knives_v2/v_shadow_carbon.mdl",
  167.     "models/Top/JB/Shop/knives_v2/v_balrog.mdl",
  168.     "models/Top/JB/Shop/knives_v2/v_katana.mdl",
  169.     "models/Top/JB/Shop/knives_v2/v_katana2.mdl",
  170.     "models/Top/JB/Shop/knives_v2/v_butterfly_asiimov.mdl",
  171.     "models/Top/JB/Shop/knives_v2/v_tribal_butterfly.mdl",
  172.     "models/Top/JB/Shop/knives_v2/v_rambo.mdl",
  173.     "models/Top/JB/Shop/knives_v2/v_riddick.mdl",
  174.     "models/Top/JB/Shop/knives_v2/v_hammer.mdl",
  175.     "models/Top/JB/Shop/knives_v2/v_janus.mdl",
  176.     "models/Top/JB/Shop/knives_v2/v_star_war.mdl",
  177.     "models/Top/JB/Shop/knives_v2/v_defibrillator.mdl",
  178.     "models/Top/JB/Shop/knives_v2/v_dragon_sword1.mdl"
  179. };
  180.  
  181. new const gXPLevels[ 58 ] = {
  182.     25,
  183.     30,
  184.     40,
  185.     50,
  186.     65,
  187.     75,
  188.     90,
  189.     100,
  190.     125,
  191.     145,
  192.     150,
  193.     175,
  194.     200,
  195.     225,
  196.     250,
  197.     300,
  198.     350,
  199.     375,
  200.     425,
  201.     500,
  202.     550,
  203.     575,
  204.     650,
  205.     725,
  206.     775,
  207.     825,
  208.     850,
  209.     900,
  210.     950,
  211.     1000,
  212.     1050,
  213.     1100,
  214.     1150,
  215.     1250,
  216.     1350,
  217.     1500,
  218.     1750,
  219.     2000,
  220.     2225,
  221.     2500,
  222.     2750,
  223.     3000,
  224.     3250,
  225.     3750,
  226.     4000,
  227.     4500,
  228.     5000,
  229.     5200,
  230.     5500,
  231.     6000,
  232.     6400,
  233.     7000,
  234.     7500,
  235.     8000,
  236.     8500,
  237.     9000,
  238.     9500,
  239.     10000
  240. };
  241.  
  242. new SoundKnife1[MAX_KNIFE_SNDS][] = {
  243.     "Top/JB/Shop/knives/gut_v1/knife_deploy1.wav",
  244.     "Top/JB/Shop/knives/gut_v1/knife_hit1.wav",
  245.     "Top/JB/Shop/knives/gut_v1/knife_hit2.wav",
  246.     "Top/JB/Shop/knives/gut_v1/knife_hit3.wav",
  247.     "Top/JB/Shop/knives/gut_v1/knife_hit4.wav",
  248.     "Top/JB/Shop/knives/gut_v1/knife_hitwall1.wav",
  249.     "Top/JB/Shop/knives/gut_v1/knife_slash1.wav",
  250.     "Top/JB/Shop/knives/gut_v1/knife_slash2.wav",
  251.     "Top/JB/Shop/knives/gut_v1/knife_stab.wav"
  252. }
  253.  
  254. new SoundKnife2[MAX_KNIFE_SNDS][] = {
  255.     "Top/JB/Shop/knives/janus_v1/knife_deploy1.wav",
  256.     "Top/JB/Shop/knives/janus_v1/knife_hit1.wav",
  257.     "Top/JB/Shop/knives/janus_v1/knife_hit2.wav",
  258.     "Top/JB/Shop/knives/janus_v1/knife_hit3.wav",
  259.     "Top/JB/Shop/knives/janus_v1/knife_hit4.wav",
  260.     "Top/JB/Shop/knives/janus_v1/knife_hitwall1.wav",
  261.     "Top/JB/Shop/knives/janus_v1/knife_slash1.wav",
  262.     "Top/JB/Shop/knives/janus_v1/knife_slash2.wav",
  263.     "Top/JB/Shop/knives/janus_v1/knife_stab.wav"
  264. }
  265.  
  266. new SoundKnife3[MAX_KNIFE_SNDS][] = {
  267.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_draw.wav",
  268.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
  269.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
  270.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
  271.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
  272.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_hitwall1.wav",
  273.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_slash1.wav",
  274.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_slash2.wav",
  275.     "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav"
  276. }
  277.  
  278. new SoundKnife4[MAX_KNIFE_SNDS][] = {
  279.     "Top/JB/Shop/knives/balrog_v2/balrog9_draw.wav",
  280.     "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
  281.     "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
  282.     "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
  283.     "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
  284.     "Top/JB/Shop/knives/balrog_v2/balrog_hitwall12.wav",
  285.     "Top/JB/Shop/knives/balrog_v2/balrog9_slash1.wav",
  286.     "Top/JB/Shop/knives/balrog_v2/balrog9_slash2.wav",
  287.     "Top/JB/Shop/knives/balrog_v2/balrog9_hit2.wav"
  288. }
  289.  
  290. new SoundKnife5[MAX_KNIFE_SNDS][] = {
  291.     "Top/JB/Shop/knives/butterfly_asiimov/knife_deploy1.wav",
  292.     "Top/JB/Shop/knives/butterfly_asiimov/knife_hit1.wav",
  293.     "Top/JB/Shop/knives/butterfly_asiimov/knife_hit2.wav",
  294.     "Top/JB/Shop/knives/butterfly_asiimov/knife_hit3.wav",
  295.     "Top/JB/Shop/knives/butterfly_asiimov/knife_hit4.wav",
  296.     "Top/JB/Shop/knives/butterfly_asiimov/knife_hitwall1.wav",
  297.     "Top/JB/Shop/knives/butterfly_asiimov/knife_slash1.wav",
  298.     "Top/JB/Shop/knives/butterfly_asiimov/knife_slash2.wav",
  299.     "Top/JB/Shop/knives/butterfly_asiimov/knife_stab.wav"
  300. }
  301.  
  302. new SoundKnife6[MAX_KNIFE_SNDS][] = {
  303.     "Top/JB/Shop/knives/hammer/stormgiant_draw.wav",
  304.     "Top/JB/Shop/knives/hammer/knife_hit3.wav",
  305.     "Top/JB/Shop/knives/hammer/knife_hit4.wav",
  306.     "Top/JB/Shop/knives/hammer/knife_hit3.wav",
  307.     "Top/JB/Shop/knives/hammer/knife_hit4.wav",
  308.     "Top/JB/Shop/knives/hammer/knife_hitwall1.wav",
  309.     "Top/JB/Shop/knives/hammer/knife_hit1.wav",
  310.     "Top/JB/Shop/knives/hammer/knife_hit2.wav",
  311.     "Top/JB/Shop/knives/hammer/knife_stab.wav"
  312. }
  313.  
  314. new SoundKnife7[MAX_KNIFE_SNDS][] = {
  315.     "Top/JB/Shop/knives/katana/knife_deploy1.wav",
  316.     "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
  317.     "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
  318.     "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
  319.     "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
  320.     "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
  321.     "Top/JB/Shop/knives/katana/knife_slash1.wav",
  322.     "Top/JB/Shop/knives/katana/knife_slash2.wav",
  323.     "Top/JB/Shop/knives/katana/knife_hitwall1.wav"
  324. }
  325.  
  326. new SoundKnife8[MAX_KNIFE_SNDS][] = {
  327.     "Top/JB/Shop/knives/rambo/knife_deploy1.wav",
  328.     "Top/JB/Shop/knives/rambo/knife_hit1.wav",
  329.     "Top/JB/Shop/knives/rambo/knife_hit1.wav",
  330.     "Top/JB/Shop/knives/rambo/knife_hit3.wav",
  331.     "Top/JB/Shop/knives/rambo/knife_hit3.wav",
  332.     "Top/JB/Shop/knives/rambo/knife_hitwall1.wav",
  333.     "Top/JB/Shop/knives/rambo/knife_slash1.wav",
  334.     "Top/JB/Shop/knives/rambo/knife_slash2.wav",
  335.     "Top/JB/Shop/knives/rambo/knife_stab.wav"
  336. }
  337.  
  338. new SoundKnife9[MAX_KNIFE_SNDS][] = {
  339.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_deploy1.wav",
  340.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit1.wav",
  341.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit1.wav",
  342.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit3.wav",
  343.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit3.wav",
  344.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hitwall1.wav",
  345.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_slash1.wav",
  346.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_slash2.wav",
  347.     "Top/JB/Shop/knives/tribal_butterfly_v1/knife_stab.wav"
  348. }
  349.  
  350. new SoundKnife10[MAX_KNIFE_SNDS][] = {
  351.     "Top/JB/Shop/knives/laser/knife_deploy1.wav",
  352.     "Top/JB/Shop/knives/laser/knife_hit1.wav",
  353.     "Top/JB/Shop/knives/laser/knife_hit2.wav",
  354.     "Top/JB/Shop/knives/laser/knife_hit3.wav",
  355.     "Top/JB/Shop/knives/laser/knife_hit4.wav",
  356.     "Top/JB/Shop/knives/laser/knife_hitwall1.wav",
  357.     "Top/JB/Shop/knives/laser/knife_slash1.wav",
  358.     "Top/JB/Shop/knives/laser/knife_slash2.wav",
  359.     "Top/JB/Shop/knives/laser/knife_stab.wav"
  360. }
  361.  
  362. new SoundKnife11[MAX_KNIFE_SNDS][] = {
  363.     "Top/JB/Shop/knives/defibrillator_v1/knife_deploy1.wav",
  364.     "Top/JB/Shop/knives/defibrillator_v1/knife_hit1.wav",
  365.     "Top/JB/Shop/knives/defibrillator_v1/knife_hit2.wav",
  366.     "Top/JB/Shop/knives/defibrillator_v1/knife_hit3.wav",
  367.     "Top/JB/Shop/knives/defibrillator_v1/knife_hit4.wav",
  368.     "Top/JB/Shop/knives/defibrillator_v1/knife_hitwall1.wav",
  369.     "Top/JB/Shop/knives/defibrillator_v1/knife_slash1.wav",
  370.     "Top/JB/Shop/knives/defibrillator_v1/knife_slash2.wav",
  371.     "Top/JB/Shop/knives/defibrillator_v1/knife_stab.wav"
  372. }
  373.  
  374. new SoundKnife12[MAX_KNIFE_SNDS][] = {
  375.     "Top/JB/Shop/knives/dragonsword/dragonsword_draw.wav",
  376.     "Top/JB/Shop/knives/dragonsword/dragonsword_hit1.wav",
  377.     "Top/JB/Shop/knives/dragonsword/dragonsword_hit2.wav",
  378.     "Top/JB/Shop/knives/dragonsword/dragonsword_hit2.wav",
  379.     "Top/JB/Shop/knives/dragonsword/dragonsword_hit1.wav",
  380.     "Top/JB/Shop/knives/dragonsword/dragonsword_wall.wav",
  381.     "Top/JB/Shop/knives/dragonsword/dragonsword_slash1.wav",
  382.     "Top/JB/Shop/knives/dragonsword/dragonsword_slash2.wav",
  383.     "Top/JB/Shop/knives/dragonsword/dragonsword_stab_hit.wav"
  384. }
  385.  
  386.  
  387. new OldKnifeSound[MAX_KNIFE_SNDS][] = {
  388.     "weapons/knife_deploy1.wav",
  389.     "weapons/knife_hit1.wav",
  390.     "weapons/knife_hit2.wav",
  391.     "weapons/knife_hit3.wav",
  392.     "weapons/knife_hit4.wav",
  393.     "weapons/knife_hitwall1.wav",
  394.     "weapons/knife_slash1.wav",
  395.     "weapons/knife_slash2.wav",
  396.     "weapons/knife_stab.wav"
  397. }
  398.  
  399. new const g_szHealthStart   = 5000;
  400. new const g_szArmorStart    = 100;
  401.  
  402. new const g_szHealth        = 100;
  403. new const g_szArmor     = 100;
  404.  
  405. new const g_szHealthAmount  = 25;
  406. new const g_szArmorAmount   = 25;
  407.  
  408. new const g_szHealthMax     = 6;
  409. new const g_szArmorMax      = 6;
  410.  
  411. new const g_szVault[ ] = "ShopFinished123";
  412.  
  413. new g_szBeaconSpirte
  414. new g_szExplosionSprite;
  415. #if !defined USE_FVAULT
  416. new g_mVault;
  417. #endif
  418.  
  419. /* Regex */
  420.  
  421. new Regex: gSteamPattern;
  422. new Regex: gIPattern;
  423. new gRegexReturn;
  424.  
  425. /* Booleans */
  426.  
  427. new bool: bPowerup[ 33 ];
  428. new bool: bSpeed[ 33 ];
  429. new bool: bMessage[ 33 ];
  430.  
  431. /* Floats */
  432.  
  433. new Float: fIndex[ 33 ][ g_fData ];
  434.  
  435. /* Misc */
  436.  
  437. new szItem[ 512 ];
  438. new gIndex[ 33 ][ g_mData ];
  439.  
  440. /* Plugin Starts */
  441.  
  442. public plugin_init()
  443. {
  444.    
  445.     register_plugin( "JailBreak New Shop", "1.0", "Built by Rejack || Edit by @.TheBomB`" );
  446.    
  447.     /* Forwards */
  448.    
  449.     register_forward(FM_EmitSound , "EmitSound");
  450.    
  451.     RegisterHam( Ham_Item_Deploy, "weapon_knife", "FwdItemDeployKnife", 1 );
  452.    
  453.     RegisterHam( Ham_TakeDamage, "player", "FwdTakeDamage", 0 );
  454.    
  455.     RegisterHam( Ham_Spawn, "player", "FwdHamSpawn", 1 );
  456.    
  457.     /* Client Commands */
  458.    
  459.     register_clcmd( "say", "CmdSay" );
  460.    
  461.     /* Events */
  462.    
  463.     register_event( "CurWeapon", "evCurWeapon", "be", "1=1" );
  464.    
  465.     register_event( "DeathMsg", "evDeathMsg", "a" );
  466.    
  467.     /* Regex */
  468.    
  469.     new error[ 2 ];
  470.     gSteamPattern   = regex_compile( REGEX_STEAMID_PATTERN, gRegexReturn, error, charsmax( error ) );
  471.    
  472.     /* Commands */
  473.    
  474.     register_concmd( "_deposit", "CmdDeposit" );
  475.    
  476.     register_concmd( "_withdraw", "CmdWithdraw" );
  477.    
  478. }
  479.  
  480. public EmitSound( id, channel, sample[ ] )
  481. {
  482.     if(gIndex[ id ][ gKNIFE ] == 5)
  483.     {
  484.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  485.         {
  486.             return FMRES_IGNORED;
  487.         }
  488.        
  489.         if( get_user_weapon( id ) == CSW_KNIFE )
  490.         {
  491.             new i;
  492.            
  493.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  494.             {
  495.                 if( equal( sample, OldKnifeSound[ i ] ) )
  496.                 {
  497.                     emit_sound( id, CHAN_WEAPON, SoundKnife1[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  498.                    
  499.                     return FMRES_SUPERCEDE;
  500.                 }
  501.             }
  502.         }
  503.     }
  504.     if(gIndex[ id ][ gKNIFE ] == 18)
  505.     {
  506.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  507.         {
  508.             return FMRES_IGNORED;
  509.         }
  510.        
  511.         if( get_user_weapon( id ) == CSW_KNIFE )
  512.         {
  513.             new i;
  514.            
  515.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  516.             {
  517.                 if( equal( sample, OldKnifeSound[ i ] ) )
  518.                 {
  519.                     emit_sound( id, CHAN_WEAPON, SoundKnife2[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  520.                    
  521.                     return FMRES_SUPERCEDE;
  522.                 }
  523.             }
  524.         }
  525.     }
  526.     if(gIndex[ id ][ gKNIFE ] == 8)
  527.     {
  528.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  529.         {
  530.             return FMRES_IGNORED;
  531.         }
  532.        
  533.         if( get_user_weapon( id ) == CSW_KNIFE )
  534.         {
  535.             new i;
  536.            
  537.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  538.             {
  539.                 if( equal( sample, OldKnifeSound[ i ] ) )
  540.                 {
  541.                     emit_sound( id, CHAN_WEAPON, SoundKnife3[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  542.                    
  543.                     return FMRES_SUPERCEDE;
  544.                 }
  545.             }
  546.         }
  547.     }
  548.     if(gIndex[ id ][ gKNIFE ] == 10)
  549.     {
  550.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  551.         {
  552.             return FMRES_IGNORED;
  553.         }
  554.        
  555.         if( get_user_weapon( id ) == CSW_KNIFE )
  556.         {
  557.             new i;
  558.            
  559.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  560.             {
  561.                 if( equal( sample, OldKnifeSound[ i ] ) )
  562.                 {
  563.                     emit_sound( id, CHAN_WEAPON, SoundKnife4[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  564.                    
  565.                     return FMRES_SUPERCEDE;
  566.                 }
  567.             }
  568.         }
  569.     }
  570.     if(gIndex[ id ][ gKNIFE ] == 13)
  571.     {
  572.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  573.         {
  574.             return FMRES_IGNORED;
  575.         }
  576.        
  577.         if( get_user_weapon( id ) == CSW_KNIFE )
  578.         {
  579.             new i;
  580.            
  581.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  582.             {
  583.                 if( equal( sample, OldKnifeSound[ i ] ) )
  584.                 {
  585.                     emit_sound( id, CHAN_WEAPON, SoundKnife5[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  586.                    
  587.                     return FMRES_SUPERCEDE;
  588.                 }
  589.             }
  590.         }
  591.     }
  592.     if(gIndex[ id ][ gKNIFE ] == 17)
  593.     {
  594.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  595.         {
  596.             return FMRES_IGNORED;
  597.         }
  598.        
  599.         if( get_user_weapon( id ) == CSW_KNIFE )
  600.         {
  601.             new i;
  602.            
  603.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  604.             {
  605.                 if( equal( sample, OldKnifeSound[ i ] ) )
  606.                 {
  607.                     emit_sound( id, CHAN_WEAPON, SoundKnife6[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  608.                    
  609.                     return FMRES_SUPERCEDE;
  610.                 }
  611.             }
  612.         }
  613.     }
  614.     if(gIndex[ id ][ gKNIFE ] == 11)
  615.     {
  616.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  617.         {
  618.             return FMRES_IGNORED;
  619.         }
  620.        
  621.         if( get_user_weapon( id ) == CSW_KNIFE )
  622.         {
  623.             new i;
  624.            
  625.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  626.             {
  627.                 if( equal( sample, OldKnifeSound[ i ] ) )
  628.                 {
  629.                     emit_sound( id, CHAN_WEAPON, SoundKnife7[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  630.                    
  631.                     return FMRES_SUPERCEDE;
  632.                 }
  633.             }
  634.         }
  635.     }
  636.     if(gIndex[ id ][ gKNIFE ] == 12)
  637.     {
  638.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  639.         {
  640.             return FMRES_IGNORED;
  641.         }
  642.        
  643.         if( get_user_weapon( id ) == CSW_KNIFE )
  644.         {
  645.             new i;
  646.            
  647.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  648.             {
  649.                 if( equal( sample, OldKnifeSound[ i ] ) )
  650.                 {
  651.                     emit_sound( id, CHAN_WEAPON, SoundKnife7[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  652.                    
  653.                     return FMRES_SUPERCEDE;
  654.                 }
  655.             }
  656.         }
  657.     }
  658.     if(gIndex[ id ][ gKNIFE ] == 15)
  659.     {
  660.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  661.         {
  662.             return FMRES_IGNORED;
  663.         }
  664.        
  665.         if( get_user_weapon( id ) == CSW_KNIFE )
  666.         {
  667.             new i;
  668.            
  669.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  670.             {
  671.                 if( equal( sample, OldKnifeSound[ i ] ) )
  672.                 {
  673.                     emit_sound( id, CHAN_WEAPON, SoundKnife8[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  674.                    
  675.                     return FMRES_SUPERCEDE;
  676.                 }
  677.             }
  678.         }
  679.     }
  680.     if(gIndex[ id ][ gKNIFE ] == 14)
  681.     {
  682.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  683.         {
  684.             return FMRES_IGNORED;
  685.         }
  686.        
  687.         if( get_user_weapon( id ) == CSW_KNIFE )
  688.         {
  689.             new i;
  690.            
  691.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  692.             {
  693.                 if( equal( sample, OldKnifeSound[ i ] ) )
  694.                 {
  695.                     emit_sound( id, CHAN_WEAPON, SoundKnife9[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  696.                    
  697.                     return FMRES_SUPERCEDE;
  698.                 }
  699.             }
  700.         }
  701.     }
  702.     if(gIndex[ id ][ gKNIFE ] == 19)
  703.     {
  704.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  705.         {
  706.             return FMRES_IGNORED;
  707.         }
  708.        
  709.         if( get_user_weapon( id ) == CSW_KNIFE )
  710.         {
  711.             new i;
  712.            
  713.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  714.             {
  715.                 if( equal( sample, OldKnifeSound[ i ] ) )
  716.                 {
  717.                     emit_sound( id, CHAN_WEAPON, SoundKnife10[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  718.                    
  719.                     return FMRES_SUPERCEDE;
  720.                 }
  721.             }
  722.         }
  723.     }
  724.    
  725.     if(gIndex[ id ][ gKNIFE ] == 20)
  726.     {
  727.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  728.         {
  729.             return FMRES_IGNORED;
  730.         }
  731.        
  732.         if( get_user_weapon( id ) == CSW_KNIFE )
  733.         {
  734.             new i;
  735.            
  736.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  737.             {
  738.                 if( equal( sample, OldKnifeSound[ i ] ) )
  739.                 {
  740.                     emit_sound( id, CHAN_WEAPON, SoundKnife11[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  741.                    
  742.                     return FMRES_SUPERCEDE;
  743.                 }
  744.             }
  745.         }
  746.     }
  747.     if(gIndex[ id ][ gKNIFE ] == 21)
  748.     {
  749.         if( !is_user_alive( id ) || !is_user_connected( id ) )
  750.         {
  751.             return FMRES_IGNORED;
  752.         }
  753.        
  754.         if( get_user_weapon( id ) == CSW_KNIFE )
  755.         {
  756.             new i;
  757.            
  758.             for( i = 0; i < sizeof OldKnifeSound; i++ )
  759.             {
  760.                 if( equal( sample, OldKnifeSound[ i ] ) )
  761.                 {
  762.                     emit_sound( id, CHAN_WEAPON, SoundKnife12[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  763.                    
  764.                     return FMRES_SUPERCEDE;
  765.                 }
  766.             }
  767.         }
  768.     }
  769.     return FMRES_IGNORED;
  770. }
  771.  
  772. #if !defined USE_FVAULT
  773. public plugin_cfg()
  774.     g_mVault    = nvault_open( g_szVault );
  775.  
  776. public plugin_end()
  777.     nvault_close( g_mVault );
  778. #endif
  779.  
  780. public plugin_precache()
  781. {  
  782.     static i;
  783.    
  784.     for( new i = 0 ; i < sizeof SoundKnife1 ; i ++ )
  785.         precache_sound( SoundKnife1[ i ] )
  786.        
  787.     for( new i = 0 ; i < sizeof SoundKnife2 ; i ++ )
  788.         precache_sound( SoundKnife2[ i ] )
  789.        
  790.     for( new i = 0 ; i < sizeof SoundKnife3 ; i ++ )
  791.         precache_sound( SoundKnife3[ i ] )
  792.        
  793.     for( new i = 0 ; i < sizeof SoundKnife4 ; i ++ )
  794.         precache_sound( SoundKnife4[ i ] )
  795.        
  796.     for( new i = 0 ; i < sizeof SoundKnife5 ; i ++ )
  797.         precache_sound( SoundKnife5[ i ] )
  798.        
  799.     for( new i = 0 ; i < sizeof SoundKnife6 ; i ++ )
  800.         precache_sound( SoundKnife6[ i ] )
  801.        
  802.     for( new i = 0 ; i < sizeof SoundKnife7 ; i ++ )
  803.         precache_sound( SoundKnife7[ i ] )
  804.        
  805.     for( new i = 0 ; i < sizeof SoundKnife8 ; i ++ )
  806.         precache_sound( SoundKnife8[ i ] )
  807.        
  808.     for( new i = 0 ; i < sizeof SoundKnife9 ; i ++ )
  809.         precache_sound( SoundKnife9[ i ] )
  810.        
  811.     for( new i = 0 ; i < sizeof SoundKnife10 ; i ++ )
  812.         precache_sound( SoundKnife10[ i ] )
  813.        
  814.     for( new i = 0 ; i < sizeof SoundKnife11 ; i ++ )
  815.         precache_sound( SoundKnife11[ i ] )
  816.        
  817.     for( new i = 0 ; i < sizeof SoundKnife12 ; i ++ )
  818.         precache_sound( SoundKnife12[ i ] )
  819.    
  820.     precache_sound( g_szBeacon[ 0 ] );
  821.    
  822.     g_szBeaconSpirte    = precache_model( g_szBeacon[ 1 ] );
  823.    
  824.     g_szExplosionSprite = precache_model( g_szExplosion );
  825.    
  826.     for ( i = 0; i < sizeof g_szKnivesModels; i++ )
  827.         precache_model( g_szKnivesModels[ i ] );
  828.    
  829.     for ( i = 0; i < sizeof g_szKnives; i++ )
  830.     {
  831.         if ( g_szKnives[ i ][ g_kPlayerModel ] == 1 )
  832.             precache_model( g_szKnives[ i ][ g_kSzPlayerModel ] );
  833.     }
  834.    
  835.     precache_sound( "Top/JB/Shop/lol.wav" );
  836.     precache_model( "models/Top/knife_days/v_dance.mdl" );
  837. }
  838.  
  839. public plugin_natives( )
  840. {
  841.     register_native( "jb_get_user_knife", "_get_knife" );
  842.     register_native( "jb_set_user_knife", "_set_knife" );
  843.     register_native( "jb_get_last_knife", "_get_lastknife" )
  844.     register_native( "get_user_knife_level", "_get_knife" )
  845.     register_native( "get_user_knife_health", "_get_knife_health" )
  846.    
  847.     register_native( "jb_get_user_cash", "_get_cash" );
  848.     register_native( "jb_set_user_cash", "_set_cash" );
  849.    
  850.     register_native( "get_user_cash", "_get_cash" );
  851.     register_native( "set_user_cash", "_set_cash" );
  852.    
  853.     register_native( "set_client_cash", "_get_cash" );
  854.     register_native( "get_client_cash", "_set_cash" );
  855.    
  856.     register_native( "get_user_bank", "_get_bank" );
  857.     register_native( "set_user_bank", "_set_bank" );
  858.    
  859.     register_native( "get_user_xp", "_get_xp" );
  860.     register_native( "set_user_xp", "_set_xp" );
  861.    
  862.     register_native( "get_rank_cash", "_get_rank_cash" );
  863. }
  864.  
  865. /* Natives */
  866.  
  867. public _get_knife( plugin, params )
  868. {
  869.     if ( !is_user_connected( get_param( 1 ) ) )
  870.     {
  871.         log_amx( "[ShopSystem] Index (%i) is currently not connected.", get_param( 1 ) );
  872.        
  873.         return 0;
  874.        
  875.     }
  876.    
  877.     return gIndex[ get_param( 1 ) ][ gKNIFE ];
  878. }
  879.  
  880. public _get_knife_health( plugin, params )
  881. {
  882.     static index;
  883.    
  884.     index   = get_param( 1 );
  885.    
  886.     return g_szKnives[ gIndex[ index ][ gKNIFE ] ][ g_kHealth ];
  887. }
  888.  
  889. public _set_knife( plugin, params )
  890. {
  891.     static index, knife;
  892.    
  893.     index = get_param( 1 );
  894.    
  895.     if ( !is_user_connected( index ) )
  896.     {
  897.         log_amx( "[ShopSystem] Index (%i) is currently not connected.", index );
  898.        
  899.         return 0;
  900.     }
  901.    
  902.     knife = get_param( 2 );
  903.    
  904.     gIndex[ index ][ KNIFE ] = knife;
  905.    
  906.     gIndex[ index ][ gKNIFE ] = knife;
  907.    
  908.    
  909.     return gIndex[ index ][ KNIFE ];
  910. }
  911.  
  912. public _get_lastknife( plugin, params )
  913. {
  914.     static index;
  915.    
  916.     index = get_param( 1 );
  917.    
  918.     if ( !is_user_connected( index ) )
  919.     {
  920.         log_amx( "[ShopSystem] Index (%i) is currently not connected.", index );
  921.        
  922.         return 0;
  923.     }
  924.    
  925.     return gIndex[ index ][ KNIFE ];
  926.    
  927. }
  928.  
  929. public _get_cash( plugin, params ) 
  930.     return get_user_cash( get_param( 1 ) );
  931.  
  932. public _set_cash( plugin, params )
  933. {
  934.     set_user_cash( get_param( 1 ), get_param( 2 ) );
  935.    
  936.     return get_user_cash( get_param( 1 ) );
  937. }
  938.  
  939. public _get_xp( plugin, params )   
  940.     return get_user_xp( get_param( 1 ) );
  941.  
  942. public _set_xp( plugin, params )
  943. {
  944.     set_user_xp( get_param( 1 ), get_param( 2 ) );
  945.    
  946.     return get_user_xp( get_param( 1 ) );
  947. }
  948.  
  949. public _get_bank( plugin, params )
  950.     return gIndex[ get_param( 1 ) ][ BANK ];
  951.  
  952. public _set_bank( plugin, params )
  953. {
  954.     static index, amount;
  955.    
  956.     index   = get_param( 1 );
  957.    
  958.     amount  = get_param( 2 );
  959.    
  960.     gIndex[ index ][ BANK ] = amount;
  961.    
  962.     if ( gIndex[ index ][ BANK ] < 0 )
  963.         gIndex[ index ][ BANK ] = 0;
  964.    
  965.     return gIndex[ get_param( 1 ) ][ BANK ];
  966. }
  967.  
  968. public _get_rank_cash( plugin, params )
  969.     return ( (gIndex[ get_param( 1 ) ][ CASH ]) + (gIndex[ get_param( 1 ) ][ BANK ]) );
  970.  
  971. /* Events */
  972.  
  973. public evCurWeapon( client )
  974. {      
  975.    
  976.     if( is_running_vote() )
  977.     {
  978.         new String[ 220 ];
  979.         formatex( String, charsmax( String ), "models/Top/knife_days/v_dance.mdl" );
  980.         entity_set_string( client, EV_SZ_viewmodel, String );
  981.     }
  982.    
  983.    
  984.     if ( !is_user_alive( client ) || !is_user_connected( client ) )
  985.         return 0;
  986.    
  987.     if ( bSpeed[ client ] )
  988.         fm_set_user_maxspeed( client, fm_get_user_maxspeed( client ) * 2 );
  989.    
  990.     return 0;
  991. }
  992.  
  993. public evDeathMsg(id)
  994. {      
  995.     if( get_playersnum() < 4 && get_user_team(id) ==1)
  996.         return ColorPrint( 0, "^4*5 players^1 must be online to get^3 cash^1" )
  997.    
  998.     static iKiller, iVictim, iHeadshot, CsTeams: iTeam[ 2 ], Amount;
  999.    
  1000.     iKiller = read_data( 1 );
  1001.     iVictim = read_data( 2 );
  1002.     iHeadshot = read_data( 3 );
  1003.    
  1004.     iTeam[ 0 ] = cs_get_user_team( iKiller );
  1005.    
  1006.     iTeam[ 1 ] = cs_get_user_team( iVictim );
  1007.    
  1008.     if ( iTeam[ 0 ] == iTeam[ 1 ] || iTeam[ 0 ] != CS_TEAM_T || iTeam[ 1 ] != CS_TEAM_CT )
  1009.         return 0;
  1010.    
  1011.     Amount      = CASH_KILL;
  1012.    
  1013.    
  1014.     if ( iHeadshot )
  1015.     {
  1016.         Amount      = CASH_HS;
  1017.     }
  1018.    
  1019.    
  1020.     Amount += g_szKnives[ gIndex[ iKiller ][ gKNIFE ] ][ g_kCash ];
  1021.    
  1022.     remove_task( iVictim );
  1023.    
  1024.     bSpeed[ iVictim ] = false;
  1025.    
  1026.     bPowerup[ iVictim ] = false;
  1027.    
  1028.     set_user_cash( iKiller, get_user_cash( iKiller ) + CASH_KILL );
  1029.    
  1030.     set_user_xp( iKiller, get_user_xp( iKiller ) + XP_KILL );
  1031.    
  1032.     ColorPrint( iKiller, "You gained^3 %i^1 cash and^3 %i^1 xp, for killing^4 %s^1.", CASH_KILL, XP_KILL, szName( iVictim ) );
  1033.     ColorPrint( 0, "^4%s^1 gained^3 %i^1 cash and^3 %i^1 xp, for killing^4 %s^1.",szName( iKiller ), CASH_KILL, XP_KILL, szName( iVictim ) );
  1034.    
  1035.     return 0;
  1036. }
  1037. public evRoundStart()
  1038. {
  1039.     static Players[ 32 ], iNum, iPlayer;
  1040.    
  1041.     get_players( Players, iNum, "ch" );
  1042.    
  1043.     for ( new i; i < iNum; i++ )
  1044.     {
  1045.         iPlayer = Players[ i ];
  1046.        
  1047.         remove_task( iPlayer );
  1048.        
  1049.         fm_set_user_godmode( iPlayer, 0 );
  1050.        
  1051.         bSpeed[ iPlayer ] = bPowerup[ iPlayer ] = false;
  1052.     }
  1053. }
  1054.  
  1055. /* Forwards */
  1056.  
  1057. public FwdHamSpawn( const client )
  1058. {
  1059.     if ( !is_user_alive( client ) || !is_user_connected( client ) )
  1060.         return 1;
  1061.    
  1062.     static Float: fMins;
  1063.    
  1064.     fMins = (get_gametime()/60) - (fIndex[ client ][ NEXTCASH ]/60);
  1065.    
  1066.     if ( CountPlayers() >= 0 )
  1067.     {
  1068.         new iYears, iMonths, iDays, iHours, iMinutes, iSeconds;
  1069.         UnixToTime( 60*5 - g_iPlayTime[ client ], iYears, iMonths, iDays, iHours, iMinutes, iSeconds );
  1070.         iYears -= 1970;
  1071.         iMonths -= 1;
  1072.         iDays -= 1;
  1073.         if ( fMins <= NEXT_CASH_TIME )
  1074.             ColorPrint( client, "You will get^4 %i^1 cash in^3 %02d:%02d^1 minutes!", get_user_nextcash( client ) + get_user_gang_nextcash( client ), iMinutes, iSeconds );
  1075.     }
  1076.    
  1077.     bSpeed[ client ] = false;
  1078.    
  1079.     bPowerup[ client ] = false;
  1080.    
  1081.     fm_set_user_rendering( client );
  1082.    
  1083.     static iHealth, iArmor;
  1084.    
  1085.     iHealth = g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kHealth ];
  1086.    
  1087.     iArmor  = g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kArmor ];
  1088.    
  1089.     fm_set_user_armor( client, 100 + iArmor );
  1090.    
  1091.     fm_set_user_health( client, 100 + iHealth );
  1092.    
  1093.     if ( cs_get_user_team( client ) == CS_TEAM_T )
  1094.     {
  1095.        
  1096.     }
  1097.    
  1098.     return 1;
  1099. }
  1100.  
  1101.  
  1102. public FwdItemDeployKnife( ent )
  1103. {
  1104.     static client;  client = get_pdata_cbase( ent, 41, 4 );
  1105.    
  1106.     if ( is_user_alive( client ) )
  1107.         set_pev( client, pev_viewmodel2, g_szKnivesModels[ gIndex[ client ][ gKNIFE ] ][ V_MODEL ] );
  1108. }
  1109.  
  1110. public FwdTakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage, iDmgBits )
  1111. {
  1112.     if ( !is_user_connected( iAttacker ) || !is_user_connected( iVictim ) || !is_user_alive( iAttacker ) || !is_user_alive( iVictim ) )
  1113.         return 1;
  1114.    
  1115.     if ( iVictim == iAttacker )
  1116.         return 1;
  1117.    
  1118.     if ( get_user_weapon( iAttacker ) == CSW_KNIFE && iDmgBits & DMG_NEVERGIB && !(iDmgBits&(1<<24)) )
  1119.     {
  1120.         static Float: g_fDamage, CsTeams: iTeam[ 2 ], Float: fPunchAngle[ 3 ], i;
  1121.        
  1122.         g_fDamage = fDamage + g_szKnives[ gIndex[ iAttacker ][ gKNIFE ] ][ g_mDamage ];
  1123.        
  1124.         iTeam[ 0 ] = cs_get_user_team( iVictim );
  1125.        
  1126.         iTeam[ 1 ] = cs_get_user_team( iAttacker );
  1127.        
  1128.         SetHamParamFloat( 4, g_fDamage );
  1129.        
  1130.         if ( get_cvar_num( "mp_friendlyfire" ) == 0 && iTeam[ 0 ] == iTeam[ 1 ] )
  1131.             return 1;
  1132.        
  1133.         if ( gIndex[ iAttacker ][ gKNIFE ] == 0 )
  1134.             return 1;
  1135.        
  1136.         for ( i = 0; i < sizeof fPunchAngle; i++ )
  1137.             fPunchAngle[ i ] = 6.0 * gIndex[ iAttacker ][ gKNIFE ];
  1138.        
  1139.         set_pev( iVictim, pev_punchangle, fPunchAngle );
  1140.        
  1141.         SetHamParamFloat( 4, g_fDamage );
  1142.     }
  1143.    
  1144.     return 1;
  1145. }
  1146.  
  1147. /* Knives Menu */
  1148.  
  1149. public CmdKnivesMenu( const client )
  1150. {
  1151.     formatex( szItem, charsmax( szItem ), "\r[\d%s\r]\w Knives Shop^nYou have\y %i\w Cash^n^nYou are using:\y %s^n\wYou own:\y %s^n\wPage:\r", szPrefix, get_user_cash( client ), g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kName ], g_szKnives[ gIndex[ client ][ KNIFE ] ][ g_kName ] );
  1152.    
  1153.     static Menu; Menu = menu_create( szItem, "HandlerKnivesMenu" );
  1154.    
  1155.     static iKnife, gKnife, szText[ 32 ];
  1156.    
  1157.     iKnife = gIndex[ client ][ KNIFE ];
  1158.     gKnife = gIndex[ client ][ gKNIFE ];
  1159.    
  1160.     for ( new i; i < sizeof g_szKnives; i++ )
  1161.     {
  1162.         szText = "";
  1163.        
  1164.         if ( g_szKnives[ i ][ g_kPremium ] == 1 )
  1165.             szText  = "\d-\r [ Premiums Only ]";
  1166.        
  1167.        
  1168.         if ( gKnife == i )
  1169.             szText  = "\d-\r [ Your ]";
  1170.        
  1171.         if( i > iKnife )
  1172.             formatex( szText, charsmax( szText ), "\d- \d[\wLOCK\d]" );
  1173.        
  1174.         if( i < iKnife && i != gKnife)
  1175.             formatex( szText, charsmax( szText ), "\d- \d[\wUNLOCK\d]" );
  1176.        
  1177.         if ( iKnife + 1 == i )
  1178.             formatex( szText, charsmax( szText ), "\d- \d[\wNEXT UNLOCK\d]", g_szKnives[ i ][ g_kPrice ] );
  1179.        
  1180.         if ( gKnife )
  1181.             formatex( szText, charsmax( szText ), "\d- [\y %i\w Cash \d]", g_szKnives[ i ][ g_kPrice ] );
  1182.        
  1183.         formatex( szItem, charsmax( szItem ), "%s%s %s %s %s", (iKnife+1<i) ? "\d" : "\w", g_szKnives[ i ][ g_kName ],(iKnife<i) ? "\r[LOCKED]" : "\y[UNLOCKED]", gKnife == i ? "\d, Currect Knife." : "", g_szKnives[ i ][ g_kPremium ] == 1 ? "\r(\yPremium only\r)" : "" );
  1184.        
  1185.         menu_additem( Menu, szItem );
  1186.     }
  1187.    
  1188.     menu_setprop( Menu, MPROP_EXITNAME, "Back" );
  1189.    
  1190.     menu_display( client, Menu );
  1191.    
  1192.     return 1;
  1193. }
  1194.  
  1195. public HandlerKnivesMenu( client, Menu, Item )
  1196. {
  1197.     if ( Item == MENU_EXIT )
  1198.     {
  1199.         menu_destroy( Menu );
  1200.        
  1201.         return CmdMainMenu( client );
  1202.     }
  1203.    
  1204.     static iItem;
  1205.    
  1206.     iItem = Item;
  1207.    
  1208.     menu_destroy( Menu );
  1209.    
  1210.     CmdKnivesItemsMenu( client, iItem );
  1211.    
  1212.     return 1;
  1213. }
  1214.  
  1215. public CmdKnivesItemsMenu( const client, const Item )
  1216. {
  1217.     static szPrice[ 28 ], szKey[ 3 ];
  1218.    
  1219.     formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w Knives Shop^nYou have\y %i\w Cash^n^nYou are using:\y %s^n\wYou own:\y %s^n^n\wYou are viewing:\r %s ",
  1220.     szPrefix, get_user_cash( client ), g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kName ],
  1221.     g_szKnives[ gIndex[ client ][ KNIFE ] ][ g_kName ], g_szKnives[ Item ][ g_kName ] );
  1222.    
  1223.     new Menu = menu_create( szItem, "HandlerKnivesItemsMenu" );
  1224.    
  1225.     num_to_str( Item, szKey, charsmax( szKey ) );
  1226.    
  1227.     formatex( szItem, charsmax( szItem ), "\yLevel Needed:\d %i", g_szKnives[ Item ][ g_kLevelNeeded ] );
  1228.    
  1229.     menu_additem( Menu, szItem, szKey );
  1230.    
  1231.     menu_additem( Menu, "Use", szKey, 0, menu_makecallback( "CallBackUse_CmdKnivesItems" ) );
  1232.    
  1233.     formatex( szPrice, charsmax( szPrice ), "- [\y %i\w Cash \d]", g_szKnives[ Item ][ g_kPrice ] );
  1234.    
  1235.     formatex( szItem, charsmax( szItem ), "Purchase Knife\d %s^n", (gIndex[ client ][ KNIFE ]<Item) ? szPrice : "" );
  1236.    
  1237.     menu_additem( Menu, szItem, szKey, 0, menu_makecallback( "CallBackPurchase_CmdKnivesItems" ) );
  1238.    
  1239.     menu_additem( Menu, "View Knife Stats", szKey );
  1240.    
  1241.     menu_setprop( Menu, MPROP_EXITNAME, "Back" );
  1242.    
  1243.     menu_display( client, Menu );
  1244.    
  1245.     return 1;
  1246. }
  1247.  
  1248. public HandlerKnivesItemsMenu( client, Menu, Item )
  1249. {
  1250.     if ( Item == MENU_EXIT )
  1251.     {
  1252.         menu_destroy( Menu );
  1253.        
  1254.         return CmdKnivesMenu( client );
  1255.     }
  1256.    
  1257.     static mData[ 6 ], Trash, Key, iKnife, mKnife, iLevel, NeededLevel;
  1258.    
  1259.     menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _,_, Trash );
  1260.    
  1261.     Key = str_to_num( mData );
  1262.    
  1263.     iKnife = gIndex[ client ][ KNIFE ];
  1264.    
  1265.     mKnife = gIndex[ client ][ gKNIFE ];
  1266.    
  1267.     iLevel = gIndex[ client ][ gLVL ];
  1268.    
  1269.     NeededLevel = g_szKnives[ Key ][ g_kLevelNeeded ];
  1270.    
  1271.     if ( Item == 0 )
  1272.         return CmdKnivesItemsMenu( client, Key );
  1273.    
  1274.     else if ( Item == 1 ) /* USE */
  1275.     {
  1276.         if ( Key > iKnife )
  1277.         {
  1278.             ColorPrint( client, "You haven't bought that knife yet." );
  1279.            
  1280.             return CmdKnivesItemsMenu( client, Key );
  1281.         }
  1282.        
  1283.         if ( Key == mKnife )
  1284.         {
  1285.             ColorPrint( client, "You're already using this knife." );
  1286.            
  1287.             return CmdKnivesMenu( client );
  1288.         }
  1289.        
  1290.         gIndex[ client ][ gKNIFE ] = Key;
  1291.        
  1292.         if ( user_has_weapon( client, CSW_KNIFE ) )
  1293.         {
  1294.             HamStripWeapon( client, "weapon_knife" );
  1295.            
  1296.             fm_give_item( client, "weapon_knife" );
  1297.         }
  1298.     }
  1299.    
  1300.     else if ( Item == 2 )   /* Purchase */
  1301.     {
  1302.         if ( g_szKnives[ Key ][ g_kPremium ] == 1 )
  1303.         {
  1304.             ColorPrint( client, "You need to be a^3 Premium Member^1 in order to purchase this knife." );
  1305.            
  1306.             return CmdKnivesItemsMenu( client, Key );
  1307.         }
  1308.        
  1309.         if ( iLevel < NeededLevel - 1 )
  1310.         {
  1311.             ColorPrint( client, "Your level is too low, You need to reach level^4 %i^1.", NeededLevel )
  1312.            
  1313.             return CmdKnivesItemsMenu( client, Key );
  1314.         }
  1315.        
  1316.         if ( iKnife+1 < Key )
  1317.         {
  1318.             ColorPrint( client, "You can't purchase the^3 %s^1 yet.", g_szKnives[ Key ][ g_kName ] );
  1319.            
  1320.             return CmdKnivesMenu( client );
  1321.         }
  1322.        
  1323.         if ( iKnife >= Key )
  1324.         {
  1325.             ColorPrint( client, "You already own the^3 %s^1.", g_szKnives[ Key ][ g_kName ] );
  1326.            
  1327.             return CmdKnivesMenu( client );
  1328.         }
  1329.        
  1330.         if ( get_user_cash( client ) < g_szKnives[ Key ][ g_kPrice ] )
  1331.         {
  1332.             ColorPrint( client, "You're missing^3 %i Cash^1 to purchase the^4 %s^1.", g_szKnives[ Key ][ g_kPrice ] - get_user_cash( client ), g_szKnives[ Key ][ g_kName ] );
  1333.            
  1334.             return CmdKnivesMenu( client );
  1335.         }
  1336.        
  1337.         gIndex[ client ][ KNIFE ] = Key;
  1338.        
  1339.         gIndex[ client ][ gKNIFE ] = Key;
  1340.        
  1341.         set_user_cash( client, get_user_cash( client ) - g_szKnives[ Key ][ g_kPrice ] );
  1342.        
  1343.         if ( user_has_weapon( client, CSW_KNIFE ) )
  1344.         {
  1345.             HamStripWeapon( client, "weapon_knife" );
  1346.            
  1347.             fm_give_item( client, "weapon_knife" );
  1348.         }
  1349.        
  1350.         ColorPrint( 0, "^3%s^1 purchased the^4 %s^1 for^3 %i Cash^1!^4 Good Luck^1.", szName( client ), g_szKnives[ Key ][ g_kName ], g_szKnives[ Key ][ g_kPrice ] );
  1351.        
  1352.         log_amx( "%s ( %s | %s | %i Cash ) just purchased %s", szName( client ), szAuth( client ), szAddress( client ), get_user_cash( client ), g_szKnives[ Key ][ g_kName ] );
  1353.     }
  1354.    
  1355.     else if ( Item == 3 )   /* View Stats */
  1356.     {
  1357.         static iMenu, cb;
  1358.        
  1359.         formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w Knives Shop^n^nYou are using:\y %s\d/\y%s^n^n\r%s\w Stats:", szPrefix,
  1360.         g_szKnives[ mKnife ][ g_kName ], g_szKnives[ iKnife ][ g_kName ], g_szKnives[ Key ][ g_kName ] );
  1361.        
  1362.         iMenu = menu_create( szItem, "HandlerSubKnivesStats" );
  1363.        
  1364.         cb = menu_makecallback( "MenuItemDisable" );
  1365.        
  1366.         formatex( szItem, charsmax( szItem ), "\yHealth Bonus:\d +%i", g_szKnives[ Key ][ g_kHealth ] );
  1367.        
  1368.         menu_additem( iMenu, szItem, mData, 0, cb );
  1369.        
  1370.         formatex( szItem, charsmax( szItem ), "\yArmor Bonus:\d +%i", g_szKnives[ Key ][ g_kArmor ] );
  1371.        
  1372.         menu_additem( iMenu, szItem, mData, 0, cb );
  1373.        
  1374.         formatex( szItem, charsmax( szItem ), "\yDamage Bonus:\d +%i", g_szKnives[ Key ][ g_mDamage ] );
  1375.        
  1376.         menu_additem( iMenu, szItem, mData, 0, cb );
  1377.        
  1378.         formatex( szItem, charsmax( szItem ), "\yCash Bonus:\d +%i", g_szKnives[ Key ][ g_kCash ] );
  1379.        
  1380.         menu_additem( iMenu, szItem, mData, 0, cb );
  1381.        
  1382.         formatex( szItem, charsmax( szItem ), "\ySlag:\d +%i.0%%", Key * 6 );
  1383.        
  1384.         menu_additem( iMenu, szItem, mData, 0, cb );
  1385.        
  1386.         formatex( szItem, charsmax( szItem ), "\yPlayer Model: %s", (g_szKnives[ Key ][ g_kPlayerModel ]==1) ? "\rYes" : "\dNo" );
  1387.        
  1388.         menu_additem( iMenu, szItem, mData, 0, cb );
  1389.        
  1390.         menu_setprop( iMenu, MPROP_EXITNAME, "Back" );
  1391.        
  1392.         menu_display( client, iMenu );
  1393.        
  1394.         menu_destroy( Menu );
  1395.        
  1396.         return 1;
  1397.     }
  1398.    
  1399.     menu_destroy( Menu );
  1400.    
  1401.     CmdKnivesMenu( client );
  1402.    
  1403.     return 1;
  1404. }
  1405.  
  1406.  
  1407. public HandlerSubKnivesStats( client, Menu, Item )
  1408. {
  1409.     static mData[ 6 ], Trash, Key;
  1410.    
  1411.     menu_item_getinfo( Menu, 0, Trash, mData, charsmax( mData ), _,_, Trash );
  1412.    
  1413.     Key = str_to_num( mData );
  1414.    
  1415.     menu_destroy( Menu )
  1416.    
  1417.     return CmdKnivesItemsMenu( client, Key );
  1418. }
  1419.  
  1420. /* Client Side */
  1421.  
  1422. public client_disconnect( client )
  1423.     SaveVaultKey( client );
  1424.  
  1425. public client_putinserver( client )
  1426. {
  1427.     CheckAuthOnline( client );
  1428.    
  1429.     for ( new i; i < g_mData; i++ )
  1430.         gIndex[ client ][ i ]   = 0;
  1431.    
  1432.     LoadVaultKey( client );
  1433.    
  1434.     bPowerup[ client ]      = false;
  1435.    
  1436.     bSpeed[ client ]        = false;
  1437.    
  1438.     bMessage[ client ]      = false;
  1439.    
  1440.     fIndex[ client ][ GAMETIME ]    = get_gametime();
  1441.    
  1442.     fIndex[ client ][ NEXTCASH ]    = get_gametime();
  1443.    
  1444.     ColorPrint( 0, "^3%s^1 has connected to the server! has^3 %i^1 cash, with^4 %s^1!", szName( client ), get_user_cash( client ), g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kName ] );
  1445. }
  1446.  
  1447. public CmdSay( client )
  1448. {
  1449.     new szMsg[ 192 ], szArgs[ 3 ][ 32 ];
  1450.    
  1451.     read_argv( 1, szMsg, charsmax( szMsg ) );
  1452.    
  1453.     parse( szMsg, szArgs[ 0 ], 31, szArgs[ 1 ], 31, szArgs[ 2 ], 31 );
  1454.    
  1455.     if ( equali( szMsg, "/shop" ) )
  1456.         return CmdMainMenu( client );
  1457.    
  1458.     if ( equali( szMsg, "/knife" ) )
  1459.         return CmdKnivesMenu( client );
  1460.    
  1461.     if ( equali( szMsg, "/bank" ) )
  1462.         return CmdBankMenu( client );
  1463.    
  1464.     if ( equali( szMsg, "/msg" ) || equali( szMsg, "/messages" ) )
  1465.     {
  1466.         bMessage[ client ] = !bMessage[ client ];
  1467.        
  1468.         ColorPrint( client, "You just^3 %s^1 the gamble messages.", bMessage[ client ] ? "Deactivated" : "Activated" );
  1469.        
  1470.         return 1;
  1471.     }
  1472.    
  1473.     if ( equali( szMsg, "/nc" ) || equali( szMsg, "/nextcash" ) )
  1474.     {
  1475.         if ( CountPlayers() < 0 )
  1476.             return ColorPrint( client, "^3NextCash^1 requires at least^4 5^1 Players." );
  1477.        
  1478.         UpdateOnlinePlayers_Time();
  1479.        
  1480.         g_iPlayTime[ client ] += get_user_time( client, 1 ) - g_iLastUpdateTime[ client ];
  1481.         g_iLastUpdateTime[ client ] = get_user_time( client, 1 );
  1482.        
  1483.         new iYears, iMonths, iDays, iHours, iMinutes, iSeconds;
  1484.         UnixToTime( 60*5 - g_iPlayTime[ client ], iYears, iMonths, iDays, iHours, iMinutes, iSeconds );
  1485.         iYears -= 1970;
  1486.         iMonths -= 1;
  1487.         iDays -= 1;
  1488.         if ( g_iPlayTime[ client ] <= 60*5 )
  1489.         {
  1490.             ColorPrint( client, "You have played ^3%02d:%02d,^1 You must play more^3 %02d:%02d^1 on the server, to earn ^3%i cash^1.", g_iPlayTime[ client ] / 60%60, g_iPlayTime[ client ] % 60, iMinutes, iSeconds, get_user_nextcash( client ) + get_user_gang_nextcash( client ) );
  1491.            
  1492.             return 1;
  1493.         }
  1494.        
  1495.         g_iPlayTime[ client ] = 0;
  1496.        
  1497.         set_user_cash( client, get_user_cash( client ) +  get_user_nextcash( client ) + get_user_gang_nextcash( client ));
  1498.         SaveVaultKey( client );
  1499.         return ColorPrint( client, "You played^4 05:00^1 Minutes, you earn^3 %i cash^1 from nextcash!", get_user_nextcash( client ) + get_user_gang_nextcash( client ) );
  1500.     }
  1501.    
  1502.     if ( equali( szArgs[ 0 ], "/level" ) || equali( szArgs[ 0 ], "/lvl" ) || equali( szArgs[ 0 ], "/xp" ) || equali( szArgs[ 0 ], "/exp" ) )
  1503.     {
  1504.         static iPlayer;
  1505.        
  1506.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1507.        
  1508.         if ( equali( szMsg, "/level" ) || equali( szMsg, "/lvl" ) || equali( szMsg, "/xp" ) || equali( szMsg, "/exp" ) )
  1509.             iPlayer = client;
  1510.        
  1511.         if ( !iPlayer )
  1512.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1513.        
  1514.         if ( iPlayer == client )
  1515.             return ColorPrint( client, "You're on level^4 %i^1 with^3 %i^1 xp!", get_user_level( client ) + 1, get_user_xp( client ) );
  1516.        
  1517.         ColorPrint( client, "^3%s^1 is on level^4 %i^1 with^3 %i^1 xp!", szName( iPlayer ), get_user_level( iPlayer ) + 1, get_user_xp( iPlayer ) );
  1518.        
  1519.         return 1;
  1520.     }
  1521.    
  1522.     if ( equali( szArgs[ 0 ], "/next" ) )
  1523.     {
  1524.         static iPlayer;
  1525.        
  1526.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1527.        
  1528.         if ( equali( szMsg, "/next" ) )
  1529.             iPlayer = client;
  1530.        
  1531.         if ( !iPlayer )
  1532.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1533.        
  1534.         if ( iPlayer == client )
  1535.             return ColorPrint( client, "Your missing^3 %i^1 xp to levelup to level^4 %i^1!", gXPLevels[ get_user_level( client ) ] - get_user_xp( client ), get_user_level( client ) + 1 );
  1536.        
  1537.         ColorPrint( client, "^3%s^1 is missing^3 %i^1 xp to levelup to level^4 %i^1!", szName( iPlayer ), gXPLevels[ get_user_level( iPlayer ) ] - get_user_xp( iPlayer ), get_user_level( iPlayer ) + 1 );
  1538.        
  1539.         return 1;
  1540.     }
  1541.    
  1542.     if ( equali( szArgs[ 0 ], "/cash" ) )
  1543.     {
  1544.         static iPlayer;
  1545.        
  1546.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1547.        
  1548.         if ( equali( szMsg, "/cash" ) )
  1549.             iPlayer = client;
  1550.        
  1551.         if ( !iPlayer )
  1552.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1553.        
  1554.         if ( iPlayer == client )
  1555.             return ColorPrint( client, "You have^4 %i^1 cash,^3 %i^1 in the bank and ^3%i^1 tickets, You using a^4 %s^1.",
  1556.         get_user_cash( client ), gIndex[ client ][ BANK ],get_user_tickets(client), g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kName ] );
  1557.        
  1558.         ColorPrint( client, "^3%s^1 have^3 %i^1 cash,^3 %i^1 in the bank and ^3%i^1 tickets, using a^3 %s^1.",
  1559.         szName( iPlayer ), get_user_cash( iPlayer ), gIndex[ iPlayer ][ BANK ],get_user_tickets(client), g_szKnives[ gIndex[ iPlayer ][ gKNIFE ] ][ g_kName ] );
  1560.        
  1561.         return 1;
  1562.     }
  1563.    
  1564.     if ( equali( szArgs[ 0 ], "/gamble" ) )
  1565.     {
  1566.        
  1567.         static Amount, bool: bAllin;
  1568.        
  1569.         bAllin = false;
  1570.        
  1571.         Amount = str_to_num( szArgs[ 1 ] );
  1572.        
  1573.         if ( equali( szArgs[ 1 ], "allin" ) || equali( szArgs[ 1 ], "all" ) || Amount == get_user_cash( client ) )
  1574.         {
  1575.             Amount = get_user_cash( client );
  1576.            
  1577.             bAllin = true;
  1578.         }
  1579.        
  1580.         else if ( equali( szMsg, "/gamble" ) || !is_str_num( szArgs[ 1 ] ) )
  1581.             return ColorPrint( client, "Syntax: /^4gamble^1 <^3amount^1>" );
  1582.        
  1583.         if ( Amount > get_user_cash( client ) )
  1584.             return ColorPrint( client, "You're missing^3 %i^1 cash to gamble on^4 %i^1 cash.", Amount - get_user_cash( client ), Amount );
  1585.        
  1586.         if ( Amount < 300 )
  1587.             return ColorPrint( client, "You need to gamble on a minimum of^4 300 Cash^1 at a time." );
  1588.        
  1589.         static bool: bGamble;
  1590.         static iTotal, bonus, chance;
  1591.         static szBonus[ 12 ];
  1592.        
  1593.         bGamble = false;
  1594.         iTotal  = get_user_cash( client );
  1595.        
  1596.         set_user_cash( client, iTotal - Amount );
  1597.        
  1598.         chance  = GAMBLE_CHANCE;
  1599.        
  1600.         bonus   = 0;
  1601.        
  1602.         szBonus = "";
  1603.        
  1604.         if ( get_user_flags( client ) & ADMIN_LEVEL_C )
  1605.             bonus += GAMBLE_CHANCE_PREMIUM;
  1606.        
  1607.         if ( bAllin && get_user_bank( client ) == 0 )
  1608.             bonus += GAMBLE_CHANCE_ALLIN;
  1609.        
  1610.         if( bonus )
  1611.             formatex( szBonus, charsmax( szBonus ), "(+^4%i%%^1)", bonus );
  1612.        
  1613.         if ( chance + bonus >= random( 99 ) )
  1614.         {
  1615.             bGamble = true;
  1616.            
  1617.             set_user_cash( client, iTotal + Amount );
  1618.         }
  1619.        
  1620.         static Players[ 32 ], iNum;
  1621.        
  1622.         get_players( Players, iNum, "ch" );
  1623.        
  1624.         for ( new i; i < iNum; i++ )
  1625.         {
  1626.             if ( bMessage[ Players[ i ] ] && Players[ i ] != client )
  1627.                 continue;
  1628.            
  1629.             ColorPrint( Players[ i ], "^3%s^1 just gambled^3%s^1 on^4 %i^1 cash and^3 %s^1! %s", szName( client ), bAllin ? " All-In" : "", Amount, bGamble ? "won" : "lost", szBonus );
  1630.         }
  1631.        
  1632.         log_amx( "%s (%s|%s) gambled on %i cash and he %s. (%i cash left)", szName( client ), szAuth( client ), szAddress( client ), Amount, bGamble ? "won" : "lost", get_user_cash( client ) );
  1633.        
  1634.         return 1;
  1635.     }
  1636.    
  1637.     if ( equali( szArgs[ 0 ], "/transfer" ) )
  1638.     {
  1639.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/transfer" ) )
  1640.             return ColorPrint( client, "Syntax: /^4transfer^1 <^4player^1> <^4amount^1>" );
  1641.        
  1642.         static iPlayer;
  1643.        
  1644.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1645.        
  1646.         if ( !iPlayer )
  1647.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1648.        
  1649.         if ( iPlayer == client )
  1650.             return ColorPrint( client, "You can't transfer cash to yourself." );
  1651.        
  1652.         new Amount = str_to_num( szArgs[ 2 ] );
  1653.        
  1654.         if ( Amount > get_user_cash( client ) )
  1655.             return ColorPrint( client, "You don't have enough cash." );
  1656.        
  1657.         if ( Amount < 300 )
  1658.             return ColorPrint( client, "You can't transfer less than^4 300 Cash^1." );
  1659.            
  1660.         if ( get_user_flags( client ) & ADMIN_LEVEL_C )
  1661.         {
  1662.             if ( get_user_cash( client ) + get_user_bank( client ) > 10000000000000 )
  1663.                 return ColorPrint( client, "aaa" );
  1664.         }
  1665.  
  1666.        
  1667.         if ( get_user_cash( client ) + get_user_bank( client ) > 70000 )
  1668.             return ColorPrint( client, "You can't transfer cash if you have more than^3 70,000^1 cash." );
  1669.        
  1670.         if ( get_user_cash( client ) + get_user_bank( client ) > 70000 )
  1671.             return ColorPrint( client, "You can't transfer cash if you have more than^3 70,000^1 cash." );
  1672.        
  1673.         if ( cs_get_user_team( client ) != CS_TEAM_T )
  1674.             return ColorPrint( client, "You can't transfer while being a^3 Counter-Terrorist^1." );
  1675.        
  1676.         static Amount2, Tax;
  1677.        
  1678.         Tax = TAX;
  1679.        
  1680.         if ( get_user_flags( client ) && ADMIN_LEVEL_C || get_user_flags( iPlayer ) && ADMIN_LEVEL_C )
  1681.             Tax =   10;
  1682.        
  1683.         Amount2 = Amount;
  1684.        
  1685.         Amount2 = Amount - (Amount / 100 * Tax);
  1686.        
  1687.         set_user_cash( client, get_user_cash( client ) - Amount );
  1688.        
  1689.         set_user_cash( iPlayer, get_user_cash( iPlayer ) + Amount2 );
  1690.        
  1691.         log_amx( "%s ( %s | %s | %i Cash ) transfer %i cash to %s ( %s | %s | %i ). He received %i cash because of the tax rate.",
  1692.         szName( client ), szAuth( client ), szAddress( client ), get_user_cash( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ), Amount2 );
  1693.        
  1694.         //ColorPrint( 0, "^4%s^1 transfered^3 %i^1 cash to^3 %s^1, he received^4 %i^1 cash (^3%i%% Tax^1)", szName( client ), Amount, szName( iPlayer ), Amount2, Tax );
  1695.         return ColorPrint( 0, "^4%s^1 transfered^3 %s^4 %i^1 cash,^3 %s^1 recieved^4 %i^1. (^3TAX^1:^4 %i%%^1)", szName( client ), szName( iPlayer ), Amount, szName( iPlayer ), Amount2, Tax );
  1696.     }
  1697.    
  1698.     if ( equali( szArgs[ 0 ], "/give" ) )
  1699.     {
  1700.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1701.             return 0;
  1702.        
  1703.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/give" ) )
  1704.             return ColorPrint( client, "Syntax: /^4give^1 <^4player^1> <^4amount^1>" );
  1705.        
  1706.         static iPlayer, Amount;
  1707.        
  1708.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1709.        
  1710.         if ( !iPlayer )
  1711.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1712.        
  1713.         Amount = str_to_num( szArgs[ 2 ] );
  1714.        
  1715.         if ( Amount < 0 )
  1716.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  1717.        
  1718.         set_user_cash( iPlayer, get_user_cash( iPlayer ) + Amount );
  1719.        
  1720.         log_amx( "ADMIN: %s (%s|%s) gave %i cash to %s (%s|%s| %i cash)", szName( client ), szAuth( client ), szAddress( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ) );
  1721.        
  1722.         ColorPrint( client, "You gave^3 %i^1 cash to^4 %s^1.", Amount, szName( iPlayer ) );
  1723.        
  1724.         ColorPrint( iPlayer, "You were given^3 %i^1 cash by the admin^4 %s^1.", Amount, szName( client ) );
  1725.        
  1726.         return 1;
  1727.     }
  1728.    
  1729.     if ( equali( szArgs[ 0 ], "/take" ) )
  1730.     {
  1731.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1732.             return 0;
  1733.        
  1734.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/take" ) )
  1735.             return ColorPrint( client, "Syntax: /^4take^1 <^4player^1> <^4amount^1>" );
  1736.        
  1737.         static iPlayer, Amount;
  1738.        
  1739.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1740.        
  1741.         if ( !iPlayer )
  1742.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1743.        
  1744.         Amount = str_to_num( szArgs[ 2 ] );
  1745.        
  1746.         if ( Amount < 0 )
  1747.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  1748.        
  1749.         set_user_cash( iPlayer, get_user_cash( iPlayer ) - Amount );
  1750.        
  1751.         log_amx( "ADMIN: %s (%s|%s) took %i cash from %s (%s|%s| %i cash)", szName( client ), szAuth( client ), szAddress( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ) );
  1752.        
  1753.         ColorPrint( client, "You took^3 %i^1 cash from^4 %s^1.", Amount, szName( iPlayer ) );
  1754.        
  1755.         ColorPrint( iPlayer, "You were taken^3 %i^1 cash by the admin^4 %s^1.", Amount, szName( client ) );
  1756.        
  1757.         return 1;
  1758.     }
  1759.    
  1760.     if ( equali( szArgs[ 0 ], "/set" ) || equali( szArgs[ 0 ], "/setcash" ) )
  1761.     {
  1762.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1763.             return 0;
  1764.        
  1765.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/set" ) || equali( szMsg, "/setcash" ) )
  1766.             return ColorPrint( client, "Syntax: /^3setcash^1 <^4player^1> <^4amount^1>" );
  1767.        
  1768.         static iPlayer, Amount;
  1769.        
  1770.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1771.        
  1772.         if ( !iPlayer )
  1773.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1774.        
  1775.         Amount = str_to_num( szArgs[ 2 ] );
  1776.        
  1777.         if ( Amount < 0 )
  1778.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  1779.        
  1780.         set_user_cash( iPlayer, get_user_cash( iPlayer ) + Amount );
  1781.        
  1782.         log_amx( "ADMIN: %s (%s|%s) set %s (%s|%s) cash to %i cash.", szName( client ), szAuth( client ), szAddress( client ), szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), Amount );
  1783.        
  1784.         ColorPrint( client, "You set^3 %s's^1 cash to^4 %i^1 cash^1.", szName( iPlayer ), Amount );
  1785.        
  1786.         ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your cash to^4 %i^1 cash^1.", szName( client ), Amount );
  1787.        
  1788.         SaveVaultKey( client );
  1789.        
  1790.         return 1;
  1791.     }
  1792.    
  1793.     if ( equali( szArgs[ 0 ], "/setlucky" ) || equali( szArgs[ 0 ], "/settickets" ) )
  1794.     {
  1795.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1796.             return 0;
  1797.        
  1798.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/setlucky" ) || equali( szMsg, "/settickets" ) )
  1799.             return ColorPrint( client, "Syntax: /^3setlucky^1 <^4player^1> <^4amount^1>" );
  1800.        
  1801.         static iPlayer, Amount;
  1802.        
  1803.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1804.        
  1805.         if ( !iPlayer )
  1806.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1807.        
  1808.         Amount = str_to_num( szArgs[ 2 ] );
  1809.        
  1810.         if ( Amount < 0 )
  1811.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  1812.        
  1813.         if ( Amount > 150 )
  1814.             return ColorPrint( client, "You can set less^3 150^1 tickets." );
  1815.        
  1816.         set_user_tickets( iPlayer, get_user_tickets( iPlayer ) + Amount );
  1817.        
  1818.         log_amx( "ADMIN: %s (%s|%s) set %s (%s|%s) tickets to %i tickets.", szName( client ), szAuth( client ), szAddress( client ), szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), Amount );
  1819.        
  1820.         ColorPrint( client, "You set^3 %s's^1 Tickets to^4 %i^1 tickets^1.", szName( iPlayer ), Amount );
  1821.        
  1822.         ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your tickets to^4 %i^1 tickets^1.", szName( client ), Amount );
  1823.        
  1824.         return 1;
  1825.     }
  1826.    
  1827.     if ( equali( szArgs[ 0 ], "/tt" ) )
  1828.     {
  1829.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/tt" ) )
  1830.             return ColorPrint( client, "Syntax: /^4tt^1 <^4player^1> <^4amount^1>" );
  1831.        
  1832.         static iPlayer;
  1833.        
  1834.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1835.        
  1836.         if ( !iPlayer )
  1837.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1838.        
  1839.         if ( iPlayer == client )
  1840.             return ColorPrint( client, "You can't transfer tickets to yourself." );
  1841.        
  1842.         new Amount = str_to_num( szArgs[ 2 ] );
  1843.        
  1844.         if ( Amount > get_user_tickets( client ) )
  1845.             return ColorPrint( client, "You don't have enough cash." );
  1846.        
  1847.         if ( cs_get_user_team( client ) != CS_TEAM_T )
  1848.             return ColorPrint( client, "You can't transfer while being a^3 Counter-Terrorist^1." );
  1849.        
  1850.         static Amount2;
  1851.        
  1852.         Amount2 = Amount;
  1853.        
  1854.         set_user_tickets( client, get_user_tickets( client ) - Amount );
  1855.        
  1856.         set_user_tickets( iPlayer, get_user_tickets( iPlayer ) + Amount2 );
  1857.        
  1858.         log_amx( "%s ( %s | %s | %i Tickets ) transfer %i tickets to %s ( %s | %s | %i ). He received %i cash because of the tax rate.",
  1859.         szName( client ), szAuth( client ), szAddress( client ), get_user_cash( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ), Amount2 );
  1860.        
  1861.         //ColorPrint( 0, "^4%s^1 transfered^3 %i^1 cash to^3 %s^1, he received^4 %i^1 cash (^3%i%% Tax^1)", szName( client ), Amount, szName( iPlayer ), Amount2, Tax );
  1862.         return ColorPrint( 0, "^4%s^1 transfered^3 %s^4 %i^1 tickets.", szName( client ), szName( iPlayer ), Amount );
  1863.     }
  1864.    
  1865.     if ( equali( szArgs[ 0 ], "/setknife" ) || equali( szArgs[ 0 ], "/sk" ) )
  1866.     {
  1867.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1868.             return 0;
  1869.        
  1870.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/setknife" ) || equali( szMsg, "/sk" ) )
  1871.             return ColorPrint( client, "Syntax: /^4setknife^1 <^4player^1> <^4amount^1>" );
  1872.        
  1873.         static iPlayer, Amount;
  1874.        
  1875.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1876.        
  1877.         if ( !iPlayer )
  1878.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1879.        
  1880.         Amount = str_to_num( szArgs[ 2 ] );
  1881.        
  1882.         if ( Amount < -1 )
  1883.             return ColorPrint( client, "You can't use a value lower than^4 -1^1." );
  1884.        
  1885.         if ( Amount > charsmax( g_szKnives ) )
  1886.             return ColorPrint( client, "You can't use a value higher than^4 %i^1.", charsmax( g_szKnives ) );
  1887.        
  1888.         gIndex[ iPlayer ][ KNIFE ]  = Amount;
  1889.        
  1890.         gIndex[ iPlayer ][ gKNIFE ] = Amount;
  1891.        
  1892.         SaveVaultKey( iPlayer );
  1893.        
  1894.         if ( user_has_weapon( iPlayer, CSW_KNIFE ) )
  1895.         {
  1896.             HamStripWeapon( iPlayer, "weapon_knife" );
  1897.            
  1898.             fm_give_item( iPlayer, "weapon_knife" );
  1899.         }
  1900.        
  1901.         log_amx( "ADMIN:%s (%s|%s) set %s (%s|%s) knife level to %s (%i).", szName( client ), szAuth( client ), szAddress( client ), szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), g_szKnives[ Amount ][ g_kName ], Amount );
  1902.        
  1903.         ColorPrint( client, "You set^3 %s's^1 knife level to^4 %s ^1(^3%i^1).", szName( iPlayer ), g_szKnives[ Amount ][ g_kName ], Amount );
  1904.        
  1905.         ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your knife level to^4 %s ^1(^3%i^1).", szName( client ), g_szKnives[ Amount ][ g_kName ], Amount );
  1906.        
  1907.         return 1;
  1908.     }
  1909.    
  1910.     if ( equali( szArgs[ 0 ], "/setbank" ) || equali( szArgs[ 0 ], "/sb" ) )
  1911.     {
  1912.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1913.             return 0;
  1914.        
  1915.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/setbank" ) || equali( szMsg, "/sb" ) )
  1916.             return ColorPrint( client, "Syntax: /^4setbank^1 <^4player^1> <^4amount^1>" );
  1917.        
  1918.         static iPlayer, Amount;
  1919.        
  1920.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1921.        
  1922.         if ( !iPlayer )
  1923.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1924.        
  1925.         Amount = str_to_num( szArgs[ 2 ] );
  1926.        
  1927.         if ( Amount < 0 )
  1928.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  1929.        
  1930.         set_user_bank( iPlayer, Amount );
  1931.        
  1932.         log_amx( "ADMIN: %s (%s|%s) set %s (%s|%s) bank cash to %i cash.", szName( client ), szAuth( client ), szAddress( client ), szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), Amount );
  1933.        
  1934.         ColorPrint( client, "You set^3 %s's^1 bank cash to^4 %i^1 cash^1.", szName( iPlayer ), Amount );
  1935.        
  1936.         ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your bank cash to^4 %i^1 cash^1.", szName( client ), Amount );
  1937.        
  1938.         return 1;
  1939.     }
  1940.    
  1941.     if ( equali( szArgs[ 0 ], "/givebank" ) || equali( szArgs[ 0 ], "/gb" ) )
  1942.     {
  1943.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1944.             return 0;
  1945.        
  1946.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/givebank" ) || equali( szMsg, "/tb" ) )
  1947.             return ColorPrint( client, "Syntax: /^4givebank^1 <^4player^1> <^4amount^1>" );
  1948.        
  1949.         static iPlayer, Amount;
  1950.        
  1951.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1952.        
  1953.         if ( !iPlayer )
  1954.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1955.        
  1956.         Amount = str_to_num( szArgs[ 2 ] );
  1957.        
  1958.         if ( Amount < 0 )
  1959.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  1960.        
  1961.         set_user_bank( iPlayer, get_user_bank( iPlayer ) + Amount );
  1962.        
  1963.         log_amx( "ADMIN: %s (%s|%s) gave %i bank cash to %s (%s|%s| %i cash)", szName( client ), szAuth( client ), szAddress( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ) );
  1964.        
  1965.         ColorPrint( client, "You gave^3 %i^1 bank cash to^4 %s^1.", Amount, szName( iPlayer ) );
  1966.        
  1967.         ColorPrint( iPlayer, "You were given^3 %i^1 bank cash by the admin^4 %s^1.", Amount, szName( client ) );
  1968.        
  1969.         return 1;
  1970.     }
  1971.    
  1972.     if ( equali( szArgs[ 0 ], "/takebank" ) || equali( szArgs[ 0 ], "/tb" ) )
  1973.     {
  1974.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  1975.             return 0;
  1976.        
  1977.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/takebank" ) || equali( szMsg, "/tb" ) )
  1978.             return ColorPrint( client, "Syntax: /^4takebank^1 <^4player^1> <^4amount^1>" );
  1979.        
  1980.         static iPlayer, Amount;
  1981.        
  1982.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  1983.        
  1984.         if ( !iPlayer )
  1985.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  1986.        
  1987.         Amount = str_to_num( szArgs[ 2 ] );
  1988.        
  1989.         if ( Amount < 0 )
  1990.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  1991.        
  1992.         set_user_bank( iPlayer, get_user_bank( iPlayer ) - Amount );
  1993.        
  1994.         log_amx( "ADMIN: %s (%s|%s) took %i bank cash from %s (%s|%s| %i cash)", szName( client ), szAuth( client ), szAddress( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ) );
  1995.        
  1996.         ColorPrint( client, "You took^3 %i^1 bank cash from^4 %s^1.", Amount, szName( iPlayer ) );
  1997.        
  1998.         ColorPrint( iPlayer, "You were taken^3 %i^1 bank cash by the admin^4 %s^1.", Amount, szName( client ) );
  1999.        
  2000.         return 1;
  2001.     }
  2002.    
  2003.     if ( equali( szArgs[ 0 ], "/setlevel" ) || equali( szArgs[ 0 ], "/sl" ) )
  2004.     {
  2005.         if ( !( get_user_flags( client ) & ADMIN_RCON ) )
  2006.             return 0;
  2007.        
  2008.         if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/give" ) || equali( szMsg, "/sl" ) )
  2009.             return ColorPrint( client, "Syntax: /^4setlevel^1 <^4player^1> <^4amount^1>" );
  2010.        
  2011.         static iPlayer, Amount;
  2012.        
  2013.         iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
  2014.        
  2015.         if ( !iPlayer )
  2016.             return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
  2017.        
  2018.         Amount = str_to_num( szArgs[ 2 ] );
  2019.        
  2020.         if ( Amount < 0 )
  2021.             return ColorPrint( client, "You can't use a value lower than^4 0^1." );
  2022.        
  2023.         if ( Amount > sizeof gXPLevels )
  2024.             return ColorPrint( client, "You can't use a value higher than^4 %i^1.", sizeof gXPLevels );
  2025.        
  2026.         if ( Amount != 1 )
  2027.         {
  2028.             set_user_level( iPlayer, Amount - 1 );
  2029.            
  2030.             set_user_xp( iPlayer, gXPLevels[ Amount - 1 ] );
  2031.         }
  2032.        
  2033.         else if ( Amount == 1 )
  2034.         {
  2035.             set_user_level( iPlayer, 0 );
  2036.            
  2037.             set_user_xp( iPlayer, 0 );
  2038.         }
  2039.        
  2040.         log_amx( "ADMIN: %s (%s|%s) set %s's (%s|%s) level to %i", szName( client ), szAuth( client ), szAddress( client ), szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), Amount );
  2041.        
  2042.         ColorPrint( client, "You set^3 %s's^1 level to^4 %i^1.", szName( iPlayer ), Amount );
  2043.        
  2044.         ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your level to^4 %i^1.", szName( client ), Amount );
  2045.        
  2046.         return 1;
  2047.     }
  2048.    
  2049.     return 0;
  2050. }
  2051.  
  2052. /* View Players */
  2053.  
  2054. public UpdateOnlinePlayers_Time()
  2055. {
  2056.     for( new i = 0; i < get_maxplayers(); i++ )
  2057.     {
  2058.         if( is_user_connected( i ) )
  2059.         {
  2060.             g_iPlayTime[ i ] += get_user_time( i, 1 ) - g_iLastUpdateTime[ i ];
  2061.             g_iLastUpdateTime[ i ] = get_user_time( i, 1 );
  2062.         }
  2063.     }
  2064. }
  2065.  
  2066. public CmdViewPlayers( const client )
  2067. {
  2068.     static Menu, Players[ 32 ], iNum, szTempid[ 10 ], i;
  2069.    
  2070.     get_players( Players, iNum, "ch" );
  2071.    
  2072.     formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w View\w Players", szPrefix );
  2073.    
  2074.     Menu = menu_create( szItem, "HandlerViewPlayers" );
  2075.    
  2076.     for ( i = 0; i < iNum; i++ )
  2077.     {
  2078.         num_to_str( Players[ i ], szTempid, charsmax( szTempid ) );
  2079.        
  2080.         menu_additem( Menu, szName( Players[ i ] ), szTempid );
  2081.     }
  2082.    
  2083.     menu_display( client, Menu );
  2084.    
  2085.     return 1;
  2086. }
  2087.  
  2088. public HandlerViewPlayers( client, Menu, Item )
  2089. {
  2090.     if ( Item == MENU_EXIT )
  2091.     {
  2092.         menu_destroy( Menu );
  2093.        
  2094.         return CmdMainMenu( client );
  2095.     }
  2096.    
  2097.     static mData[ 6 ], iPlayer, Trash, mName[ 32 ];
  2098.    
  2099.     menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), mName, charsmax( mName ), Trash );
  2100.    
  2101.     iPlayer = str_to_num( mData );
  2102.    
  2103.     if ( !iPlayer )
  2104.     {
  2105.         ColorPrint( client, "^3%s^1 is currently not connected.", mName );
  2106.        
  2107.         return CmdViewPlayers( client );
  2108.     }
  2109.    
  2110.     menu_destroy( Menu );
  2111.    
  2112.     return CmdViewThePlayer( client, iPlayer, mData );
  2113. }
  2114.  
  2115. public CmdViewThePlayer( const client, const iPlayer, Data[] )
  2116. {
  2117.     static Menu, Cash, Bank, iKnife, Knife;
  2118.    
  2119.     formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w View\w Players^n^nYou are viewing\r %s\d:", szPrefix, szName( iPlayer ) );
  2120.    
  2121.     Menu = menu_create( szItem, "HandlerViewThePlayer" );
  2122.    
  2123.     Cash        = get_user_cash( iPlayer );
  2124.     formatex( szItem, charsmax( szItem ), "\dPocket Cash:\y %i\w Cash", Cash );
  2125.     menu_additem( Menu, szItem, Data );
  2126.    
  2127.     Bank        = gIndex[ iPlayer ][ BANK ];
  2128.     formatex( szItem, charsmax( szItem ), "\dBank Cash:\y %i\w Cash", Bank );
  2129.     menu_additem( Menu, szItem, Data );
  2130.    
  2131.     iKnife      = gIndex[ iPlayer ][ gKNIFE ];
  2132.     formatex( szItem, charsmax( szItem ), "\dUsed Knife:\y %s \r(\w%i\r)", g_szKnives[ iKnife ][ g_kName ], iKnife );
  2133.     menu_additem( Menu, szItem, Data );
  2134.    
  2135.     Knife       = gIndex[ iPlayer ][ KNIFE ];
  2136.     formatex( szItem, charsmax( szItem ), "\dOwned Knife:\y %s \r(\w%i\r)", g_szKnives[ Knife ][ g_kName ], Knife );
  2137.     menu_additem( Menu, szItem, Data );
  2138.    
  2139.     formatex( szItem, charsmax( szItem ), "\dLevel:\y %i \r(\w%i\d/\w%i\r)", get_user_level( client ) + 1, get_user_xp( client ), gXPLevels[ get_user_level( client ) ]  );
  2140.     menu_additem( Menu, szItem, Data );
  2141.    
  2142.     menu_setprop( Menu, MPROP_EXITNAME, "Back" );
  2143.    
  2144.     menu_display( client, Menu );
  2145.    
  2146.     return 1;
  2147. }
  2148.  
  2149. public HandlerViewThePlayer( client, Menu, Item )
  2150. {
  2151.     if ( Item == MENU_EXIT )
  2152.     {
  2153.         menu_destroy( Menu );
  2154.        
  2155.         return CmdViewPlayers( client );
  2156.     }
  2157.    
  2158.     static Trash, mData[ 6 ], Key;
  2159.    
  2160.     menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _,_, Trash );
  2161.    
  2162.     Key = str_to_num( mData );
  2163.    
  2164.     menu_destroy( Menu );
  2165.    
  2166.     return CmdViewThePlayer( client, Key, mData );
  2167. }
  2168.  
  2169. /* Main Shop Menu */
  2170.  
  2171. public CmdMainMenu( const client )
  2172. {
  2173.     formatex( szItem, charsmax( szItem ), "\r[%s]\w Shop Menu^nYou have\y %i\w Cash", szPrefix, get_user_cash( client ) );
  2174.    
  2175.     new Menu = menu_create( szItem, "HandlerMainMenu" );
  2176.    
  2177.     menu_additem( Menu, "Grenades\y Shop" );
  2178.    
  2179.     menu_additem( Menu, "Health\y Shop" );
  2180.    
  2181.     menu_additem( Menu, "Armor\y Shop" );
  2182.    
  2183.     menu_additem( Menu, "Powers\y Shop^n" );
  2184.    
  2185.     menu_additem( Menu, "Knives\y Shop" );
  2186.    
  2187.     menu_additem( Menu, "View Players" );
  2188.    
  2189.     menu_display( client, Menu );
  2190.    
  2191.     return 1;
  2192. }
  2193.  
  2194. public HandlerMainMenu( client, Menu, Item )
  2195. {
  2196.     if ( Item == MENU_EXIT )
  2197.     {
  2198.         menu_destroy( Menu );
  2199.        
  2200.         return 1;
  2201.     }
  2202.    
  2203.     static iMenu, Float: price, szPremium[ 64 ];
  2204.    
  2205.     price           = 1.0
  2206.    
  2207.     szPremium       = "^n^nNote:\y Premium Members\d get a\r 10%\d discount!";
  2208.    
  2209.     if ( get_user_flags( client ) && ADMIN_LEVEL_C )
  2210.     {
  2211.         price       = 0.9;
  2212.        
  2213.         szPremium   = "^n^nYou're a\r Premium Member\w you get a\y 10%\w discount!";
  2214.     }
  2215.    
  2216.     switch ( Item )
  2217.     {
  2218.         case 0:
  2219.         {
  2220.             formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\y Grenades\w Menu^nYou have\y %i\w Cash%s", szPrefix, get_user_cash( client ), szPremium );
  2221.            
  2222.             iMenu = menu_create( szItem, "HandlerGrenadesMenu" );
  2223.            
  2224.             for ( new i; i < sizeof g_szGrenades; i++ )
  2225.             {
  2226.                 formatex( szItem, charsmax( szItem ), "\d%s Grenade\w for\r %i\w Cash", g_szGrenades[ i ][ g_mName ], floatround( g_szGrenades[ i ][ g_mPrice ] * price ) );
  2227.                
  2228.                 menu_additem( iMenu, szItem );
  2229.             }
  2230.         }  
  2231.        
  2232.         case 1:
  2233.         {  
  2234.             formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\y Health\w Menu^nYou have\y %i\w Cash%s", szPrefix, get_user_cash( client ), szPremium );
  2235.            
  2236.             iMenu = menu_create( szItem, "HandlerHealthMenu" );
  2237.            
  2238.             for ( new i; i < g_szHealthMax; i++ )
  2239.             {
  2240.                 formatex( szItem, charsmax( szItem ), "\d%i Health\w for\r %i\w Cash", (i+1)*g_szHealthAmount, floatround( ( (i*g_szHealth) + g_szHealthStart) * price ) );
  2241.                
  2242.                 menu_additem( iMenu, szItem );
  2243.             }
  2244.         }
  2245.        
  2246.         case 2:
  2247.         {
  2248.             formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\y Armor\w Menu^nYou have\y %i\w Cash%s", szPrefix, get_user_cash( client ), szPremium );
  2249.            
  2250.             iMenu = menu_create( szItem, "HandlerArmorMenu" );
  2251.            
  2252.             for ( new i; i < g_szArmorMax; i++ )
  2253.             {
  2254.                 formatex( szItem, charsmax( szItem ), "\d%i Armor\w for\r %i\w Cash", (i+1)*g_szArmorAmount, floatround( ((i*g_szArmor) + g_szArmorStart) * price ) );
  2255.                
  2256.                 menu_additem( iMenu, szItem );
  2257.             }
  2258.         }
  2259.        
  2260.         case 3:
  2261.         {
  2262.             formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\y Powerups\w Menu^nYou have\y %i\w Cash%s", szPrefix, get_user_cash( client ), szPremium );
  2263.            
  2264.             iMenu = menu_create( szItem, "HandlerPowerupsMenu" );
  2265.            
  2266.             for ( new i; i < sizeof g_szPowerups; i++ )
  2267.             {
  2268.                 formatex( szItem, charsmax( szItem ), "\d%s\w for\y %i\w seconds\d,\r %i\w Cash", g_szPowerups[ i ][ g_mName ], g_szPowerups[ i ][ g_mTime ], floatround( g_szPowerups[ i ][ g_mPrice ] * price ) );
  2269.                
  2270.                 menu_additem( iMenu, szItem );
  2271.             }
  2272.         }
  2273.        
  2274.         case 4:
  2275.             return CmdKnivesMenu( client );
  2276.        
  2277.         case 5:
  2278.             return CmdViewPlayers( client );
  2279.     }
  2280.    
  2281.    
  2282.     menu_setprop( iMenu, MPROP_EXITNAME, "Back" );
  2283.    
  2284.     menu_display( client, iMenu );
  2285.    
  2286.     menu_destroy( Menu );
  2287.    
  2288.     return 1;
  2289. }
  2290.  
  2291. /* Grenades Menu Handler */
  2292.  
  2293. public HandlerGrenadesMenu( client, Menu, Item )
  2294. {
  2295.     if ( Item == MENU_EXIT )
  2296.     {
  2297.         menu_destroy( Menu );
  2298.        
  2299.         return CmdMainMenu( client );
  2300.     }
  2301.    
  2302.     if ( !is_user_valid( client ) )
  2303.        
  2304.     if ( !is_user_valid( client ) )
  2305.         return ColorPrint( client, "%s", get_user_reason( client ) );
  2306.    
  2307.     if ( user_has_weapon( client, g_szGrenades[ Item ][ g_mWeapon ] ) )
  2308.     {
  2309.         ColorPrint( client, "You already have a%s^3 %s%s^1.", (Item==0) ? "n" : "", g_szGrenades[ Item ][ g_mName ], (Item==3) ? "" : " Grenade"  );
  2310.        
  2311.         return CmdMainMenu( client );
  2312.     }
  2313.    
  2314.     static Price;
  2315.    
  2316.     Price   = g_szGrenades[ Item ][ g_mPrice ];
  2317.    
  2318.     if ( get_user_flags( client ) && ADMIN_LEVEL_C )
  2319.         Price   = floatround( Price * 0.9 );
  2320.    
  2321.     if ( get_user_cash( client ) < Price )
  2322.     {
  2323.         ColorPrint( client, "You're missing^3 %i Cash^1 to purchase a%s^4 %s%s^1.", Price - get_user_cash( client ), (Item==0) ? "n" : "", g_szGrenades[ Item ][ g_mName ], (Item==3) ? "" : " Grenade"  );
  2324.        
  2325.         return CmdMainMenu( client );
  2326.     }
  2327.    
  2328.     fm_give_item( client, g_szGrenades[ Item ][ g_mClass ] );
  2329.    
  2330.     set_user_cash( client, get_user_cash( client ) - Price );
  2331.    
  2332.     ColorPrint( client, "You purchased a%s^3 %s%s^1.", (Item==0) ? "n" : "", g_szGrenades[ Item ][ g_mName ], (Item==3) ? "" : " Grenade" );
  2333.    
  2334.     return CmdMainMenu( client );
  2335. }
  2336.  
  2337. /* Health Menu */
  2338.  
  2339. public HandlerHealthMenu( client, Menu, Item )
  2340. {
  2341.     if ( Item == MENU_EXIT )
  2342.     {
  2343.         menu_destroy( Menu );
  2344.        
  2345.         return CmdMainMenu( client );
  2346.     }
  2347.    
  2348.     if ( !is_user_valid( client ) )
  2349.         return ColorPrint( client, "%s", get_user_reason( client ) );
  2350.    
  2351.     static Price, Amount;
  2352.    
  2353.     Price = (Item*g_szHealth) + g_szHealthStart;
  2354.    
  2355.     if ( get_user_flags( client ) && ADMIN_LEVEL_C )
  2356.         Price   = floatround( Price * 0.9 );
  2357.    
  2358.     Amount = (Item+1) * g_szHealthAmount;
  2359.    
  2360.     if ( get_user_cash( client ) < Price )
  2361.     {
  2362.         ColorPrint( client, "You're missing^3 %i Cash^1 to purchase a^4 %i Health Bonus^1.", Price - get_user_cash( client ), Amount );
  2363.        
  2364.         return CmdMainMenu( client );
  2365.     }
  2366.    
  2367.     fm_set_user_health( client, get_user_health( client ) + Amount );
  2368.    
  2369.     set_user_cash( client, get_user_cash( client ) - Price );
  2370.    
  2371.     ColorPrint( client, "You purchased a^3 %i Health Bonus^1.", Amount );
  2372.    
  2373.     return CmdMainMenu( client );
  2374. }
  2375.  
  2376. /* Armor Menu Handler */
  2377.  
  2378. public HandlerArmorMenu( client, Menu, Item )
  2379. {
  2380.     if ( Item == MENU_EXIT )
  2381.     {
  2382.         menu_destroy( Menu );
  2383.        
  2384.         return CmdMainMenu( client );
  2385.     }
  2386.    
  2387.     if ( !is_user_valid( client ) )
  2388.         return ColorPrint( client, "%s", get_user_reason( client ) );
  2389.    
  2390.     static Price, Amount;
  2391.    
  2392.     Price = (Item*g_szArmor) + g_szArmorStart;
  2393.    
  2394.     if ( get_user_flags( client ) && ADMIN_LEVEL_C )
  2395.         Price   = floatround( Price * 0.9 );
  2396.    
  2397.     Amount = (Item+1) * g_szArmorAmount;
  2398.    
  2399.     if ( get_user_cash( client ) < Price )
  2400.     {
  2401.         ColorPrint( client, "You're missing^3 %i Cash^1 to purchase a^4 %i Armor Bonus^1.", Price - get_user_cash( client ), Amount );
  2402.        
  2403.         return CmdMainMenu( client );
  2404.     }
  2405.    
  2406.     fm_set_user_armor( client, get_user_armor( client ) + Amount );
  2407.    
  2408.     set_user_cash( client, get_user_cash( client ) - Price );
  2409.    
  2410.     ColorPrint( client, "You purchased a^3 %i Armor Bonus^1.", Amount );
  2411.    
  2412.     return CmdMainMenu( client );
  2413. }
  2414.  
  2415. /* Powerups Menu Handler */
  2416.  
  2417. public HandlerPowerupsMenu( client, Menu, Item )
  2418. {
  2419.     if ( Item == MENU_EXIT )
  2420.     {
  2421.         menu_destroy( Menu );
  2422.        
  2423.         return CmdMainMenu( client );
  2424.     }
  2425.    
  2426.     if ( !is_user_valid( client ) )
  2427.         return ColorPrint( client, "%s", get_user_reason( client ) );
  2428.    
  2429.     if ( bPowerup[ client ] )
  2430.     {
  2431.         ColorPrint( client, "You can only be using^4 1 Powerup^1 at a time." );
  2432.        
  2433.         return CmdMainMenu( client );
  2434.     }
  2435.    
  2436.     static Price;
  2437.    
  2438.     Price = g_szPowerups[ Item ][ g_mPrice ];
  2439.    
  2440.     if ( get_user_flags( client ) && ADMIN_LEVEL_C )
  2441.         Price   = floatround( Price * 0.9 );
  2442.    
  2443.     if ( get_user_cash( client ) < Price )
  2444.     {
  2445.         ColorPrint( client, "You're missing^3 %i Cash^1 to purchase a^4 %s Powerup^1.", Price - get_user_cash( client ), g_szPowerups[ Item ][ g_mName ] );
  2446.        
  2447.         return CmdMainMenu( client );
  2448.     }
  2449.    
  2450.     switch ( Item )
  2451.     {
  2452.         case 0:
  2453.             fm_set_user_godmode( client, 1 );
  2454.        
  2455.         case 1:
  2456.             fm_set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0 );
  2457.        
  2458.         case 2:
  2459.             cs_set_user_model( client, "urban" );
  2460.        
  2461.         case 3:
  2462.             fm_set_user_gravity( client, 0.5 );
  2463.        
  2464.         case 4:
  2465.         {
  2466.             fIndex[ client ][ GAMETIME ] = get_gametime();
  2467.            
  2468.             CmdSuicideBomber( client );
  2469.         }
  2470.        
  2471.         case 5:
  2472.         {
  2473.             fm_set_user_maxspeed( client, fm_get_user_maxspeed( client ) * 2 );
  2474.            
  2475.             bSpeed[ client ] = true;
  2476.         }
  2477.     }
  2478.    
  2479.     if ( Item != 4 )
  2480.         set_task( float( g_szPowerups[ Item ][ g_mTime ] ), g_szPowerups[ Item ][ g_mClass ], client );
  2481.    
  2482.     set_user_cash( client, get_user_cash( client ) - Price );
  2483.    
  2484.     ColorPrint( client, "You purchased a^3 %s Powerup^4 %i^1 seconds.", g_szPowerups[ Item ][ g_mName ], g_szPowerups[ Item ][ g_mTime ] );
  2485.    
  2486.     bPowerup[ client ] = true;
  2487.    
  2488.     return CmdMainMenu( client );
  2489. }
  2490.  
  2491. /* Tasks for Powerups */
  2492.  
  2493. public taskRemoveGodmode( const client )
  2494. {
  2495.     if ( !bPowerup[ client ] )
  2496.         return 1;
  2497.    
  2498.     fm_set_user_godmode( client, 0 );
  2499.    
  2500.     bPowerup[ client ] = false;
  2501.    
  2502.     remove_task( client );
  2503.    
  2504.     return ColorPrint( client, "Your^3 Godmode Powerup^1 has been^4 removed^1." );
  2505. }
  2506.  
  2507. public taskRemoveStealth( const client  )
  2508. {
  2509.     if ( !bPowerup[ client ] )
  2510.         return 1;
  2511.    
  2512.     fm_set_user_rendering( client );
  2513.    
  2514.     bPowerup[ client ] = false;
  2515.    
  2516.     remove_task( client );
  2517.    
  2518.     return ColorPrint( client, "Your^3 Stealth Powerup^1 has been^4 removed^1." );
  2519. }
  2520.  
  2521. public taskRemoveCamouflage( const client )
  2522. {
  2523.     if ( !bPowerup[ client ] )
  2524.         return 1;
  2525.    
  2526.     cs_reset_user_model( client );
  2527.    
  2528.     bPowerup[ client ] = false;
  2529.    
  2530.     remove_task( client );
  2531.    
  2532.     return ColorPrint( client, "Your^3 Camouflage Powerup^1 has been^4 removed^1." );
  2533. }
  2534.  
  2535. public taskRemoveGravity( const client )
  2536. {
  2537.     if ( !bPowerup[ client ] )
  2538.         return 1;
  2539.    
  2540.     fm_set_user_gravity( client, 1.0 );
  2541.    
  2542.     bPowerup[ client ] = false;
  2543.    
  2544.     remove_task( client );
  2545.    
  2546.     return ColorPrint( client, "Your^3 Godmode Powerup^1 has been^4 removed^1." );
  2547. }
  2548.  
  2549. public taskRemoveSpeed( const client )
  2550. {
  2551.     if ( !bPowerup[ client ] )
  2552.         return 1;
  2553.    
  2554.     fm_set_user_maxspeed( client, 240.0 );
  2555.    
  2556.     bSpeed[ client ] = false;
  2557.    
  2558.     bPowerup[ client ] = false;
  2559.    
  2560.     remove_task( client );
  2561.    
  2562.     return ColorPrint( client, "Your^3 Speed Powerup^1 has been^4 removed^1." );
  2563. }
  2564.  
  2565. /* Suicide Bomber */
  2566.  
  2567. public CmdSuicideBomber( const client )
  2568. {
  2569.     if ( !is_user_valid( client ) )
  2570.         return 1;
  2571.    
  2572.     static iOrigin[ 3 ];
  2573.    
  2574.     get_user_origin( client, iOrigin );
  2575.    
  2576.     if ( fIndex[ client ][ GAMETIME ] < get_gametime() - g_szPowerups[ 4 ][ g_mTime ] )
  2577.     {
  2578.         message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin, 0 );
  2579.         write_byte( TE_EXPLOSION );     // TE ID
  2580.         write_coord( iOrigin[ 0 ] );        // X
  2581.         write_coord( iOrigin[ 1 ] );        // Y
  2582.         write_coord( iOrigin[ 2 ] - 20 );   // Z
  2583.         write_short( g_szExplosionSprite ); // Sprite
  2584.         write_byte( 40 );           // Scale in 0.1
  2585.         write_byte( 10 )            // Framerate
  2586.         write_byte( 0 );            // Flags
  2587.         message_end();  
  2588.        
  2589.         user_kill( client );
  2590.        
  2591.         static Players[ 32 ], iNum, iPlayer, fOrigin[ 3 ];
  2592.        
  2593.         get_players( Players, iNum, "ach" );
  2594.        
  2595.         for ( new i; i < iNum; i++ )
  2596.         {
  2597.             iPlayer = Players[ i ];
  2598.            
  2599.             get_user_origin( iPlayer, fOrigin );
  2600.            
  2601.             if ( get_distance( iOrigin, fOrigin ) <= 300 )
  2602.             {
  2603.                 make_deathmsg( client, iPlayer, 1, "weapon_hegrenade" );
  2604.                
  2605.                 user_silentkill( iPlayer );
  2606.                
  2607.                 if ( cs_get_user_team( iPlayer ) == CS_TEAM_CT )
  2608.                     set_user_cash( client, get_user_cash( client ) + CASH_KILL );
  2609.             }
  2610.         }
  2611.        
  2612.         bPowerup[ client ] = false;
  2613.        
  2614.         remove_task( client );
  2615.        
  2616.         return 1;
  2617.     }
  2618.    
  2619.     message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  2620.    
  2621.     write_byte( TE_BEAMCYLINDER );      // TE ID
  2622.    
  2623.     write_coord( iOrigin[ 0 ] );        // X
  2624.    
  2625.     write_coord( iOrigin[ 1 ] );        // Y
  2626.    
  2627.     write_coord( iOrigin[ 2 ] - 20 );   // Z
  2628.    
  2629.     write_coord( iOrigin[ 0 ] );        // X AXIS
  2630.    
  2631.     write_coord( iOrigin[ 1 ] );        // Y AXIS
  2632.    
  2633.     write_coord( iOrigin[ 2 ] + 300 )// Z AXIS
  2634.    
  2635.     write_short( g_szBeaconSpirte );    // Sprite
  2636.    
  2637.     write_byte( 0 );            // Startframe
  2638.    
  2639.     write_byte( 1 );            // Framerate
  2640.    
  2641.     write_byte( 9 );            // Life
  2642.    
  2643.     write_byte( 50 );           // Width
  2644.    
  2645.     write_byte( 1 );            // Noise
  2646.    
  2647.     write_byte( 250 );          // Red
  2648.    
  2649.     write_byte( 0 );            // Green
  2650.    
  2651.     write_byte( 0 );            // Blue
  2652.    
  2653.     write_byte( 200 );          // Brightness
  2654.    
  2655.     write_byte( 0 );            // Speed
  2656.    
  2657.     message_end();
  2658.    
  2659.     emit_sound( client, CHAN_ITEM, g_szBeacon[ 0 ], 1.0, ATTN_NONE, 0, PITCH_NORM );
  2660.    
  2661.     set_task( 0.6, "CmdSuicideBomber", client );
  2662.    
  2663.     return 1;
  2664. }
  2665.  
  2666. /* Callbacks */
  2667.  
  2668. public CallBackUse_CmdKnivesItems( client, Menu, Item )
  2669. {
  2670.     static mData[ 6 ], Trash, Key;
  2671.    
  2672.     menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _, _, Trash );
  2673.    
  2674.     Key = str_to_num( mData );
  2675.    
  2676.     if ( gIndex[ client ][ gKNIFE ] == Key )
  2677.         return ITEM_DISABLED;
  2678.    
  2679.     if ( gIndex[ client ][ KNIFE ] < Key )
  2680.         return ITEM_DISABLED;
  2681.    
  2682.     return ITEM_ENABLED;
  2683. }
  2684.  
  2685. public CallBackPurchase_CmdKnivesItems( client, Menu, Item )
  2686. {
  2687.     static mData[ 6 ], Trash, Key;
  2688.    
  2689.     menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _, _, Trash );
  2690.    
  2691.     Key = str_to_num( mData );
  2692.    
  2693.     if ( gIndex[ client ][ KNIFE ] + 1 != Key )
  2694.         return ITEM_DISABLED;
  2695.    
  2696.     if ( get_user_cash( client ) < g_szKnives[ Key ][ g_kPrice ] )
  2697.         return ITEM_DISABLED;
  2698.    
  2699.     if ( get_user_level( client ) < g_szKnives[ Key ][ g_kLevelNeeded ] -1 )
  2700.         return ITEM_DISABLED;
  2701.    
  2702.     return ITEM_ENABLED;
  2703. }
  2704.  
  2705. public MenuItemDisable( client, Menu, Item )
  2706.     return ITEM_DISABLED;  
  2707.  
  2708. /* Bank */
  2709.  
  2710. public CmdBankMenu( client )
  2711. {
  2712.     static cash, bank, Menu;
  2713.    
  2714.     cash    = get_user_cash( client );
  2715.     bank    = get_user_bank( client );
  2716.    
  2717.     formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w Bank System Menu", szPrefix );
  2718.    
  2719.     Menu = menu_create( szItem, "SubBankMenu" );
  2720.    
  2721.     formatex( szItem, charsmax( szItem ), "%sDeposit\y Cash", (get_user_cash( client )<=0) ? "\d" : "" );
  2722.    
  2723.     menu_additem( Menu, szItem );
  2724.    
  2725.     formatex( szItem, charsmax( szItem ), "%sWithdraw\y Cash^n", (get_user_bank( client )<=0) ? "\d" : "" );
  2726.    
  2727.     menu_additem( Menu, szItem );
  2728.    
  2729.     menu_addtext( Menu, "\wAccount\y Bank\w Statement:" );
  2730.    
  2731.     formatex( szItem, charsmax( szItem ), "\y- \dAccount Balance:\y %i\w Cash^n\y- \dPocket Cash:\y %i\w Cash^n\y- \dTotal Cash:\y %i\w Cash",bank, cash, bank + cash );
  2732.    
  2733.     menu_addtext( Menu, szItem );
  2734.    
  2735.     menu_display( client, Menu );
  2736.    
  2737.     return 1;
  2738. }
  2739.  
  2740. public SubBankMenu( client, Menu, Item )
  2741. {
  2742.     if ( Item == MENU_EXIT )
  2743.     {
  2744.         menu_destroy( Menu );
  2745.        
  2746.         return 1;
  2747.     }
  2748.    
  2749.     switch ( Item )
  2750.     {
  2751.         case 0:
  2752.         {
  2753.             if ( get_user_cash( client ) <= 0 )
  2754.                 return CmdBankMenu( client );
  2755.            
  2756.             client_cmd( client, "messagemode _deposit" );
  2757.         }
  2758.        
  2759.         case 1:
  2760.         {
  2761.             if ( get_user_bank( client ) <= 0 )
  2762.                 return CmdBankMenu( client );
  2763.            
  2764.             client_cmd( client, "messagemode _withdraw" );
  2765.         }
  2766.     }
  2767.    
  2768.     menu_destroy( Menu );
  2769.    
  2770.     return 1;
  2771. }
  2772.  
  2773. public CmdDeposit( client )
  2774. {
  2775.     static szArgs[ 128 ], Amount;
  2776.    
  2777.     read_args( szArgs, charsmax( szArgs ) );
  2778.    
  2779.     remove_quotes( szArgs );
  2780.    
  2781.     Amount = str_to_num( szArgs );
  2782.    
  2783.     if ( !is_str_num( szArgs ) )
  2784.     {
  2785.         client_cmd( client, "messagemode _deposit" );
  2786.        
  2787.         return ColorPrint( client, "Please use valid numbers." );
  2788.     }
  2789.    
  2790.     if ( Amount > get_user_cash( client ) )
  2791.     {
  2792.         client_cmd( client, "messagemode _deposit" );
  2793.        
  2794.         return ColorPrint( client, "You don't have this amount of cash." );
  2795.     }
  2796.    
  2797.     if ( Amount < 300 )
  2798.         return ColorPrint( client, "You need to deposit a^3 minimum^1 of^4 300^1 cash." );
  2799.    
  2800.     set_user_bank( client, get_user_bank( client ) + Amount );
  2801.    
  2802.     set_user_cash( client, get_user_cash( client ) - Amount );
  2803.    
  2804.     ColorPrint( client, "You made a^3 deposit^1 of^4 %i^1 cash to the bank.", Amount );
  2805.    
  2806.     return CmdBankMenu( client );
  2807. }
  2808.  
  2809. public CmdWithdraw( client )
  2810. {
  2811.     static szArgs[ 128 ], Amount;
  2812.    
  2813.     read_args( szArgs, charsmax( szArgs ) );
  2814.    
  2815.     remove_quotes( szArgs );
  2816.    
  2817.     Amount = str_to_num( szArgs );
  2818.    
  2819.     if ( !is_str_num( szArgs ) )
  2820.     {
  2821.         client_cmd( client, "messagemode _withdraw" );
  2822.        
  2823.         return ColorPrint( client, "Please use valid numbers." );
  2824.     }
  2825.    
  2826.     if ( Amount > get_user_bank( client ) )
  2827.     {
  2828.         client_cmd( client, "messagemode _withdraw" );
  2829.        
  2830.         return ColorPrint( client, "You don't have this amount of cash in the bank." );
  2831.     }
  2832.    
  2833.     if ( Amount < 300 )
  2834.         return ColorPrint( client, "You need to withdraw a^3 minimum^1 of^4 300^1 cash." );
  2835.    
  2836.     static Tax, Amount2;
  2837.    
  2838.     Tax = BANK_TAX;
  2839.    
  2840.     if ( get_user_flags( client ) && ADMIN_LEVEL_C )
  2841.         Tax = BANK_TAX_PREMIUM;
  2842.    
  2843.     Amount2 = Amount - (Amount / 100 * Tax);
  2844.    
  2845.     set_user_bank( client, get_user_bank( client ) - Amount );
  2846.    
  2847.     set_user_cash( client, get_user_cash( client ) + Amount2 );
  2848.    
  2849.     ColorPrint( client, "You made a^3 withdraw^1 of^4 %i^1 cash from the bank, and you recieved^3 %i^1 cash. (^4%i%%^1)", Amount, Amount2, Tax );
  2850.    
  2851.     return CmdBankMenu( client );
  2852. }
  2853. /* FVault */
  2854.  
  2855. #if defined USE_FVAULT
  2856.  
  2857. stock SaveVaultKey( const index )
  2858. {
  2859.     new szKey[ 64 ], szData[ 256 ];
  2860.    
  2861.     formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
  2862.    
  2863.     if ( IsValidAuthid( szAuth( index ) ) )
  2864.         formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
  2865.    
  2866.     formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
  2867.     gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
  2868.    
  2869.     fvault_set_data( g_szVault, szKey, szData );
  2870. }
  2871.  
  2872. stock LoadVaultKey( const index )
  2873. {
  2874.     new szKey[ 64 ], szData[ 256 ];
  2875.    
  2876.     formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
  2877.    
  2878.     if ( IsValidAuthid( szAuth( index ) ) )
  2879.         formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
  2880.    
  2881.     formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
  2882.     gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
  2883.    
  2884.     if ( fvault_get_data( g_szVault, szKey, szData, charsmax( szData ) ) == 1 )
  2885.     {
  2886.         replace_all( szData, charsmax( szData ), "#", " " );
  2887.        
  2888.         static iData[ 6 ][ 32 ];
  2889.        
  2890.         parse( szData, iData[ 0 ], 31, iData[ 1 ], 31, iData[ 2 ], 31, iData[ 3 ], 31, iData[ 4 ], 31, iData[ 5 ], 31 );
  2891.        
  2892.         gIndex[ index ][ CASH ]         = str_to_num( iData[ 0 ] );
  2893.         gIndex[ index ][ BANK ]         = str_to_num( iData[ 1 ] );
  2894.         gIndex[ index ][ KNIFE ]            = str_to_num( iData[ 2 ] );
  2895.         gIndex[ index ][ gKNIFE ]       = str_to_num( iData[ 3 ] );
  2896.         gIndex[ index ][ gXP ]          = str_to_num( iData[ 4 ] );
  2897.         gIndex[ index ][ gLVL ]         = str_to_num( iData[ 5 ] );
  2898.     }
  2899.    
  2900.     else
  2901.     {
  2902.         gIndex[ index ][ CASH ]         = 0;
  2903.         gIndex[ index ][ BANK ]         = 0;
  2904.         gIndex[ index ][ KNIFE ]            = 0;
  2905.         gIndex[ index ][ gKNIFE ]       = 0;
  2906.         gIndex[ index ][ gXP ]          = 0;
  2907.         gIndex[ index ][ gLVL ]         = 0;
  2908.     }
  2909.    
  2910. }
  2911.  
  2912. #else
  2913.  
  2914. /* NVault */
  2915.  
  2916. stock SaveVaultKey( const index )
  2917. {
  2918.     new szKey[ 64 ], szData[ 256 ];
  2919.    
  2920.     formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
  2921.    
  2922.     if ( IsValidAuthid( szAuth( index ) ) )
  2923.         formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
  2924.    
  2925.     formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
  2926.     gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
  2927.    
  2928.     nvault_set( g_mVault, szKey, szData );
  2929. }
  2930.  
  2931. stock LoadVaultKey( const index )
  2932. {
  2933.     new szKey[ 64 ], szData[ 256 ];
  2934.    
  2935.     formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
  2936.    
  2937.     if ( IsValidAuthid( szAuth( index ) ) )
  2938.         formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
  2939.    
  2940.     formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
  2941.     gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
  2942.    
  2943.     nvault_get( g_mVault, szKey, szData, charsmax( szData ) );
  2944.    
  2945.     replace_all( szData, charsmax( szData ), "#", " " );
  2946.    
  2947.     static iData[ 6 ][ 32 ];
  2948.    
  2949.     parse( szData, iData[ 0 ], 31, iData[ 1 ], 31, iData[ 2 ], 31, iData[ 3 ], 31, iData[ 4 ], 31, iData[ 5 ], 31 );
  2950.    
  2951.     gIndex[ index ][ CASH ]         = str_to_num( iData[ 0 ] );
  2952.     gIndex[ index ][ BANK ]         = str_to_num( iData[ 1 ] );
  2953.     gIndex[ index ][ KNIFE ]            = str_to_num( iData[ 2 ] );
  2954.     gIndex[ index ][ gKNIFE ]       = str_to_num( iData[ 3 ] );
  2955.     gIndex[ index ][ gXP ]          = str_to_num( iData[ 4 ] );
  2956.     gIndex[ index ][ gLVL ]         = str_to_num( iData[ 5 ] );
  2957. }
  2958. #endif
  2959.  
  2960. /* Stocks */
  2961.  
  2962. stock ColorPrint( const index, const string[], any:... )
  2963. {
  2964.     new szMsg[ 191 ], Players[ 32 ], PNum = 1;
  2965.    
  2966.     static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "%s^1 ", szChatPrefix );
  2967.    
  2968.     vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
  2969.    
  2970.     if ( index )
  2971.         Players[ 0 ] = index;
  2972.    
  2973.     else
  2974.         get_players( Players, PNum, "ch" );
  2975.    
  2976.     for ( new i; i < PNum; i++ )
  2977.     {
  2978.         if( is_user_connected( Players[ i ] ) )
  2979.         {
  2980.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
  2981.            
  2982.             write_byte( Players[ i ] );
  2983.            
  2984.             write_string( szMsg );
  2985.            
  2986.             message_end( );
  2987.         }
  2988.     }
  2989.    
  2990.     return 1;
  2991. }
  2992.  
  2993. stock get_user_xp( const index )
  2994.     return gIndex[ index ][ gXP ];
  2995.  
  2996. stock set_user_xp( const index, XP )
  2997. {
  2998.     if ( !is_user_connected( index ) )
  2999.         return -1;
  3000.    
  3001.     if ( XP < 0 )
  3002.         XP = 0;
  3003.    
  3004.     gIndex[ index ][ gXP ] = XP;
  3005.    
  3006.     CheckLevel( index );
  3007.    
  3008.     SaveVaultKey( index );
  3009.    
  3010.     return 1;
  3011. }
  3012.  
  3013. stock get_user_level( const index )
  3014.     return gIndex[ index ][ gLVL ];
  3015.  
  3016. stock set_user_level( const index, LVL )
  3017. {
  3018.     if ( !is_user_connected( index ) )
  3019.         return -1;
  3020.    
  3021.     if ( LVL < 0 )
  3022.         LVL = 0;
  3023.    
  3024.     gIndex[ index ][ gLVL ] = LVL;
  3025.    
  3026.     SaveVaultKey( index );
  3027.    
  3028.     return 1;
  3029. }
  3030.  
  3031. stock CheckLevel( const index )
  3032. {
  3033.     if ( get_user_level( index ) +1 >= sizeof gXPLevels )
  3034.         return 1;
  3035.    
  3036.     while ( get_user_xp( index ) >= gXPLevels[ get_user_level( index ) ] )
  3037.     {
  3038.         set_user_level( index, get_user_level( index ) + 1 );
  3039.        
  3040.         ColorPrint( index, "Congratulation! You are now at level^4 %i^1!", get_user_level( index ) + 1 );
  3041.        
  3042.         ColorPrint( 0, "^3%s^1 is now on level^4 %i^1!,^3 Congratulation!", szName( index ), get_user_level( index ) + 1 );
  3043.        
  3044.         break;
  3045.     }
  3046.    
  3047.     return 1;
  3048. }
  3049.  
  3050. stock get_user_cash( const index )
  3051.     return gIndex[ index ][ CASH ];
  3052.  
  3053. stock set_user_cash( const index, Cash )
  3054. {
  3055.     if ( !is_user_connected( index ) )
  3056.         return 1;
  3057.    
  3058.     if ( Cash < 0 )
  3059.         Cash = 0;
  3060.    
  3061.     gIndex[ index ][ CASH ] = Cash;
  3062.    
  3063.     cs_set_user_money( index, Cash );
  3064.    
  3065.     SaveVaultKey( index );
  3066.    
  3067.     return 1;
  3068. }
  3069.  
  3070. stock get_user_bank( const index )
  3071.     return gIndex[ index ][ BANK ];
  3072.  
  3073. stock set_user_bank( const index, Cash )
  3074. {
  3075.     if ( !is_user_connected( index ) )
  3076.         return 1;
  3077.    
  3078.     if ( Cash < 0 )
  3079.         Cash = 0;
  3080.    
  3081.     gIndex[ index ][ BANK ] = Cash;
  3082.    
  3083.     SaveVaultKey( index );
  3084.    
  3085.     return 1;
  3086. }
  3087.  
  3088. stock szName( const index )
  3089. {
  3090.     static g_szName[ 32 ];
  3091.    
  3092.     get_user_name( index, g_szName, charsmax( g_szName ) );
  3093.    
  3094.     return g_szName;
  3095. }
  3096.  
  3097. stock szAuth( const index )
  3098. {
  3099.     static g_szAuthID[ 35 ];
  3100.    
  3101.     get_user_authid( index, g_szAuthID, charsmax( g_szAuthID ) );
  3102.    
  3103.     return g_szAuthID;
  3104. }
  3105.  
  3106. stock szAddress( const index )
  3107. {
  3108.     static g_szAddress[ 32 ];
  3109.    
  3110.     get_user_ip( index, g_szAddress, charsmax( g_szAddress ), 1 );
  3111.    
  3112.     return g_szAddress;
  3113. }
  3114.  
  3115. stock bool: IsValidAuthid( const szIndexAuth[] )
  3116.     return regex_match_c( szIndexAuth, gSteamPattern, gRegexReturn) > 0;
  3117.  
  3118. stock bool: IsValidIP( const szIndexIP[] )
  3119.     return regex_match_c( szIndexIP, gIPattern, gRegexReturn ) > 0;
  3120.  
  3121. stock bool: is_user_valid( const index )
  3122. {
  3123.     if ( !is_user_alive( index ) )
  3124.         return false;
  3125.    
  3126.     if ( cs_get_user_team( index ) != CS_TEAM_T )
  3127.         return false;
  3128.    
  3129.     if ( get_ruuning_day() != -1 )
  3130.         return false;
  3131.    
  3132.     if ( is_lr_start() )
  3133.         return false;
  3134.    
  3135.     return true;
  3136. }
  3137.  
  3138. stock get_user_reason( const index )
  3139. {
  3140.     static szReason[ 128 ];
  3141.    
  3142.     if ( !is_user_alive( index ) )
  3143.         formatex( szReason, charsmax( szReason ), "You need to be^3 Alive^1." );
  3144.    
  3145.     else if ( cs_get_user_team( index ) != CS_TEAM_T )
  3146.         formatex( szReason, charsmax( szReason ), "You need to be a^3 Prisoner^1." );
  3147.    
  3148.     else if ( get_ruuning_day( ) != -1 )
  3149.         formatex( szReason, charsmax( szReason ), "You can't use the shop in^3 Days^1." );
  3150.    
  3151.     else if ( is_lr_start( ) )
  3152.         formatex( szReason, charsmax( szReason ), "You can't use the shop in a^3 Last-Request^1." );
  3153.    
  3154.     return szReason
  3155. }
  3156.  
  3157. stock HamStripWeapon( const client, const szWeapon[] )
  3158. {
  3159.     if ( !equal( szWeapon, "weapon_", 7 ) )
  3160.         return 0;
  3161.    
  3162.     new WeaponID = get_weaponid( szWeapon );
  3163.    
  3164.     if ( !WeaponID )
  3165.         return 0;
  3166.    
  3167.     new ent;
  3168.    
  3169.     while ( ( ent = engfunc( EngFunc_FindEntityByString, ent, "classname", szWeapon ) ) && pev( ent, pev_owner ) != client ) {}
  3170.    
  3171.     if ( !ent )
  3172.         return 0;
  3173.    
  3174.     if ( get_user_weapon( client ) == WeaponID )
  3175.         ExecuteHamB( Ham_Weapon_RetireWeapon, ent );
  3176.    
  3177.     if ( !ExecuteHamB( Ham_RemovePlayerItem, client, ent ) )
  3178.         return 0;
  3179.    
  3180.     ExecuteHamB( Ham_Item_Kill, ent );
  3181.    
  3182.     set_pev( client, pev_weaponanim, pev( client, pev_weapons ) & ~(1<<WeaponID) );
  3183.    
  3184.     return 1;
  3185. }
  3186.  
  3187. stock CountPlayers()
  3188. {
  3189.     static Players[ 32 ], iNum;
  3190.    
  3191.     get_players( Players, iNum, "ch" );
  3192.    
  3193.     return iNum;
  3194. }
  3195.  
  3196. stock CheckAuthOnline( const index )
  3197. {
  3198.     static Players[ 32 ], iNum, i, iPlayer;
  3199.    
  3200.     get_players( Players, iNum, "ch" );
  3201.    
  3202.     for ( i = 0; i < iNum; i++ )
  3203.     {
  3204.         iPlayer = Players[ i ];
  3205.        
  3206.         if ( equali( szAuth( index ), szAuth( iPlayer ) ) || equali( szAddress( index ), szAddress( iPlayer ) ) )
  3207.         {
  3208.             dc( index );
  3209.            
  3210.             break;
  3211.         }
  3212.     }
  3213. }
  3214.  
  3215. stock dc( const index )
  3216. {
  3217.     message_begin( MSG_ONE,SVC_DISCONNECT, { 0, 0, 0 }, index );
  3218.    
  3219.     write_string( "There is already a player with the same SteamID or IP Address as yours! Please contect an Admin!" );
  3220.    
  3221.     message_end();
  3222. }
  3223.  
  3224. stock get_user_nextcash( const index )
  3225. {
  3226.     static Amount;
  3227.    
  3228.     Amount  = CASH_NEXT;
  3229.    
  3230.     Amount  += get_user_gang_nextcash( index );
  3231.    
  3232.     if ( get_user_flags( index ) && ADMIN_LEVEL_C )
  3233.         Amount  += 500;
  3234.    
  3235.     return Amount;
  3236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement