Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define USE_FVAULT
- #define MAX_KNIFE_SNDS 9
- /* Includes */
- #include < amxmodx >
- #include < amxmisc >
- #include < fakemeta_util >
- #include < cstrike >
- #include < hamsandwich >
- #include < engine >
- #include < fvault >
- #include < dhudmessage >
- #include < fun >
- #include < unixtime >
- #if defined USE_FVAULT
- #include < fvault >
- #else
- #include < nvault >
- #endif
- #include < regex >
- /* Defines */
- #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"
- #define REGEX_STEAMID_PATTERN "^^STEAM_0:(0|1):\d+$"
- #define CASH_KILL 250
- #define CASH_HS 500
- #define CASH_NEXT 1500
- #define NEXT_CASH_TIME 5
- #define XP_KILL 1
- #define XP_HS 2
- #define GAMBLE_CHANCE 40
- #define GAMBLE_CHANCE_PREMIUM 5
- #define GAMBLE_CHANCE_ALLIN 2
- #define TAX 30
- #define BANK_TAX 10
- #define BANK_TAX_PREMIUM 5
- /* Natives */
- native bool: is_lr_start();
- native get_ruuning_day();
- native get_user_gang_nextcash( const index );
- native is_running_vote();
- native get_user_tickets(index);
- native set_user_tickets(index,amount);
- /* Enums */
- enum _:g_mData {
- CASH,
- BANK,
- KNIFE,
- gKNIFE,
- gXP,
- gLVL
- };
- enum _:g_fData {
- Float: GAMETIME,
- Float: NEXTCASH
- };
- enum _:g_mMenus {
- g_mName[ 32 ],
- g_mClass[ 32 ],
- g_mPrice,
- g_mTime,
- g_mWeapon
- };
- enum _:g_mKnives {
- g_kName[ 32 ],
- g_kHealth,
- g_kArmor,
- g_mDamage,
- g_kCash,
- g_kPrice,
- g_kPlayerModel,
- g_kPremium,
- g_kSzPlayerModel[ 128 ],
- g_kSzTheModel[ 64 ],
- g_kLevelNeeded
- }
- enum _:g_mKnivesModels {
- V_MODEL[ 128 ],
- P_MODEL[ 128 ]
- };
- /* Constants & Others */
- new const szPrefix[ ] = "Top JailBreak";
- new const szChatPrefix[ ] = "^4[^1 Top jailbreak ^4]^1";
- new g_iPlayTime[ 32 ], g_iLastUpdateTime[ 32 ];
- new const g_szBeacon[ ][ ] = {
- "fvox/blip.wav",
- "sprites/zbeam2.spr"
- };
- new const g_szExplosion[ ] = "sprites/zerogxplode.spr";
- new const g_szGrenades[ ][ g_mMenus ] = {
- { "Explosive", "weapon_hegrenade", 10000, 0, CSW_HEGRENADE },
- { "Flashbang", "weapon_flashbang", 10000, 0, CSW_FLASHBANG },
- { "Gas", "weapon_smokegrenade", 10000, 0, CSW_SMOKEGRENADE }
- };
- new const g_szPowerups[ ][ g_mMenus ] = {
- { "Godmode", "taskRemoveGodmode", 7000, 5 },
- { "Stealth", "taskRemoveStealth", 9000, 5 },
- { "Camouflage", "taskRemoveCamouflage", 9000, 10 },
- { "Low Gravity", "taskRemoveGravity", 4000, 10 },
- { "Suicide Bomber", "", 6000, 3 },
- { "Super Speed", "taskRemoveSpeed",5000, 5 }
- };
- new const g_szKnives[ 22 ][ g_mKnives ] = {
- // Name HP AP DMG B.Cash Price P.M Premium P.Fol P.Msz Level
- { "Starter", 0, 0, 0, 0, 0, 0, 0, "", "", 0 },
- { "Bayonet Safari", 3, 4, 2, 130, 18000, 0, 0, "", "", 0 },
- { "Far-Cry 3", 3, 6, 2, 140, 30000, 0, 0, "", "", 0 },
- { "Falchion", 6, 7, 3, 150, 60000, 0, 0, "", "", 0 },
- { "Incorp", 7, 10, 3, 160, 100000, 0, 0, "", "", 3 },
- { "Gut", 8, 12, 4, 170, 125000, 0, 0, "", "", 5 },
- { "Diamond Staff", 10, 14, 4, 180, 170000, 0, 0, "", "", 6 },
- { "Dagger", 11, 16, 5, 190, 200000, 0, 0, "", "", 7 },
- { "Crowbar", 12, 17, 6, 200, 230000, 0, 0, "", "", 9 },
- { "Shadow Carbon", 13, 18, 6, 210, 260000, 0, 0, "", "", 9 },
- { "Balrog", 13, 19, 7, 220, 300000, 0, 0, "", "", 10 },
- { "Katana", 16, 19, 9, 225, 340000, 0, 0, "", "", 11 },
- { "Katana2", 18, 20, 10, 230, 375000, 0, 0, "", "", 13 },
- { "Butterfly Asiimov", 19, 22, 12, 235, 405000, 0, 0, "", "", 15 },
- { "Tribal Butterfly", 20, 24, 14, 240, 440000, 0, 0, "", "", 17 },
- { "Rambo", 22, 26, 16, 250, 490000, 0, 0, "", "", 20 },
- { "Riddick", 22, 26, 16, 250, 510000, 0, 0, "", "", 25 },
- { "Hammer", 22, 26, 16, 250, 550000, 0, 0, "", "", 35 },
- { "Janus", 23, 27, 18, 260, 600000, 0, 0, "", "", 40 },
- { "Stars War", 24, 28, 20, 270, 650000, 0, 0, "", "", 45 },
- { "Defibrillator", 25, 29, 22, 270, 700000, 0, 0, "", "", 50 },
- { "Dragon Sword", 26, 30, 24, 280, 740000, 0, 0, "", "", 55 }
- };
- new const g_szKnivesModels[ 22 ][ ] = {
- "models/Top/JB/Shop/knives_v2/v_starter.mdl",
- "models/Top/JB/Shop/knives_v2/v_bayonet_safari.mdl",
- "models/Top/JB/Shop/knives_v2/v_farcry3.mdl",
- "models/Top/JB/Shop/knives_v2/v_falchion.mdl",
- "models/Top/JB/Shop/knives_v2/v_incorp.mdl",
- "models/Top/JB/Shop/knives_v2/v_gut.mdl",
- "models/Top/JB/Shop/knives_v2/v_diamond_staff.mdl",
- "models/Top/JB/Shop/knives_v2/v_dagger.mdl",
- "models/Top/JB/Shop/knives_v2/v_crowbar.mdl",
- "models/Top/JB/Shop/knives_v2/v_shadow_carbon.mdl",
- "models/Top/JB/Shop/knives_v2/v_balrog.mdl",
- "models/Top/JB/Shop/knives_v2/v_katana.mdl",
- "models/Top/JB/Shop/knives_v2/v_katana2.mdl",
- "models/Top/JB/Shop/knives_v2/v_butterfly_asiimov.mdl",
- "models/Top/JB/Shop/knives_v2/v_tribal_butterfly.mdl",
- "models/Top/JB/Shop/knives_v2/v_rambo.mdl",
- "models/Top/JB/Shop/knives_v2/v_riddick.mdl",
- "models/Top/JB/Shop/knives_v2/v_hammer.mdl",
- "models/Top/JB/Shop/knives_v2/v_janus.mdl",
- "models/Top/JB/Shop/knives_v2/v_star_war.mdl",
- "models/Top/JB/Shop/knives_v2/v_defibrillator.mdl",
- "models/Top/JB/Shop/knives_v2/v_dragon_sword1.mdl"
- };
- new const gXPLevels[ 58 ] = {
- 25,
- 30,
- 40,
- 50,
- 65,
- 75,
- 90,
- 100,
- 125,
- 145,
- 150,
- 175,
- 200,
- 225,
- 250,
- 300,
- 350,
- 375,
- 425,
- 500,
- 550,
- 575,
- 650,
- 725,
- 775,
- 825,
- 850,
- 900,
- 950,
- 1000,
- 1050,
- 1100,
- 1150,
- 1250,
- 1350,
- 1500,
- 1750,
- 2000,
- 2225,
- 2500,
- 2750,
- 3000,
- 3250,
- 3750,
- 4000,
- 4500,
- 5000,
- 5200,
- 5500,
- 6000,
- 6400,
- 7000,
- 7500,
- 8000,
- 8500,
- 9000,
- 9500,
- 10000
- };
- new SoundKnife1[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/gut_v1/knife_deploy1.wav",
- "Top/JB/Shop/knives/gut_v1/knife_hit1.wav",
- "Top/JB/Shop/knives/gut_v1/knife_hit2.wav",
- "Top/JB/Shop/knives/gut_v1/knife_hit3.wav",
- "Top/JB/Shop/knives/gut_v1/knife_hit4.wav",
- "Top/JB/Shop/knives/gut_v1/knife_hitwall1.wav",
- "Top/JB/Shop/knives/gut_v1/knife_slash1.wav",
- "Top/JB/Shop/knives/gut_v1/knife_slash2.wav",
- "Top/JB/Shop/knives/gut_v1/knife_stab.wav"
- }
- new SoundKnife2[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/janus_v1/knife_deploy1.wav",
- "Top/JB/Shop/knives/janus_v1/knife_hit1.wav",
- "Top/JB/Shop/knives/janus_v1/knife_hit2.wav",
- "Top/JB/Shop/knives/janus_v1/knife_hit3.wav",
- "Top/JB/Shop/knives/janus_v1/knife_hit4.wav",
- "Top/JB/Shop/knives/janus_v1/knife_hitwall1.wav",
- "Top/JB/Shop/knives/janus_v1/knife_slash1.wav",
- "Top/JB/Shop/knives/janus_v1/knife_slash2.wav",
- "Top/JB/Shop/knives/janus_v1/knife_stab.wav"
- }
- new SoundKnife3[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_draw.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_hitwall1.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_slash1.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_slash2.wav",
- "Top/JB/Shop/knives/crowbar_v1/crowbarcraft_stab.wav"
- }
- new SoundKnife4[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/balrog_v2/balrog9_draw.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog9_hit1.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog_hitwall12.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog9_slash1.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog9_slash2.wav",
- "Top/JB/Shop/knives/balrog_v2/balrog9_hit2.wav"
- }
- new SoundKnife5[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/butterfly_asiimov/knife_deploy1.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_hit1.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_hit2.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_hit3.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_hit4.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_hitwall1.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_slash1.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_slash2.wav",
- "Top/JB/Shop/knives/butterfly_asiimov/knife_stab.wav"
- }
- new SoundKnife6[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/hammer/stormgiant_draw.wav",
- "Top/JB/Shop/knives/hammer/knife_hit3.wav",
- "Top/JB/Shop/knives/hammer/knife_hit4.wav",
- "Top/JB/Shop/knives/hammer/knife_hit3.wav",
- "Top/JB/Shop/knives/hammer/knife_hit4.wav",
- "Top/JB/Shop/knives/hammer/knife_hitwall1.wav",
- "Top/JB/Shop/knives/hammer/knife_hit1.wav",
- "Top/JB/Shop/knives/hammer/knife_hit2.wav",
- "Top/JB/Shop/knives/hammer/knife_stab.wav"
- }
- new SoundKnife7[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/katana/knife_deploy1.wav",
- "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
- "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
- "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
- "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
- "Top/JB/Shop/knives/katana/knife_hitwall1.wav",
- "Top/JB/Shop/knives/katana/knife_slash1.wav",
- "Top/JB/Shop/knives/katana/knife_slash2.wav",
- "Top/JB/Shop/knives/katana/knife_hitwall1.wav"
- }
- new SoundKnife8[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/rambo/knife_deploy1.wav",
- "Top/JB/Shop/knives/rambo/knife_hit1.wav",
- "Top/JB/Shop/knives/rambo/knife_hit1.wav",
- "Top/JB/Shop/knives/rambo/knife_hit3.wav",
- "Top/JB/Shop/knives/rambo/knife_hit3.wav",
- "Top/JB/Shop/knives/rambo/knife_hitwall1.wav",
- "Top/JB/Shop/knives/rambo/knife_slash1.wav",
- "Top/JB/Shop/knives/rambo/knife_slash2.wav",
- "Top/JB/Shop/knives/rambo/knife_stab.wav"
- }
- new SoundKnife9[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_deploy1.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit1.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit1.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit3.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hit3.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_hitwall1.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_slash1.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_slash2.wav",
- "Top/JB/Shop/knives/tribal_butterfly_v1/knife_stab.wav"
- }
- new SoundKnife10[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/laser/knife_deploy1.wav",
- "Top/JB/Shop/knives/laser/knife_hit1.wav",
- "Top/JB/Shop/knives/laser/knife_hit2.wav",
- "Top/JB/Shop/knives/laser/knife_hit3.wav",
- "Top/JB/Shop/knives/laser/knife_hit4.wav",
- "Top/JB/Shop/knives/laser/knife_hitwall1.wav",
- "Top/JB/Shop/knives/laser/knife_slash1.wav",
- "Top/JB/Shop/knives/laser/knife_slash2.wav",
- "Top/JB/Shop/knives/laser/knife_stab.wav"
- }
- new SoundKnife11[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/defibrillator_v1/knife_deploy1.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_hit1.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_hit2.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_hit3.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_hit4.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_hitwall1.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_slash1.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_slash2.wav",
- "Top/JB/Shop/knives/defibrillator_v1/knife_stab.wav"
- }
- new SoundKnife12[MAX_KNIFE_SNDS][] = {
- "Top/JB/Shop/knives/dragonsword/dragonsword_draw.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_hit1.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_hit2.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_hit2.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_hit1.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_wall.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_slash1.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_slash2.wav",
- "Top/JB/Shop/knives/dragonsword/dragonsword_stab_hit.wav"
- }
- new OldKnifeSound[MAX_KNIFE_SNDS][] = {
- "weapons/knife_deploy1.wav",
- "weapons/knife_hit1.wav",
- "weapons/knife_hit2.wav",
- "weapons/knife_hit3.wav",
- "weapons/knife_hit4.wav",
- "weapons/knife_hitwall1.wav",
- "weapons/knife_slash1.wav",
- "weapons/knife_slash2.wav",
- "weapons/knife_stab.wav"
- }
- new const g_szHealthStart = 5000;
- new const g_szArmorStart = 100;
- new const g_szHealth = 100;
- new const g_szArmor = 100;
- new const g_szHealthAmount = 25;
- new const g_szArmorAmount = 25;
- new const g_szHealthMax = 6;
- new const g_szArmorMax = 6;
- new const g_szVault[ ] = "ShopFinished123";
- new g_szBeaconSpirte
- new g_szExplosionSprite;
- #if !defined USE_FVAULT
- new g_mVault;
- #endif
- /* Regex */
- new Regex: gSteamPattern;
- new Regex: gIPattern;
- new gRegexReturn;
- /* Booleans */
- new bool: bPowerup[ 33 ];
- new bool: bSpeed[ 33 ];
- new bool: bMessage[ 33 ];
- /* Floats */
- new Float: fIndex[ 33 ][ g_fData ];
- /* Misc */
- new szItem[ 512 ];
- new gIndex[ 33 ][ g_mData ];
- /* Plugin Starts */
- public plugin_init()
- {
- register_plugin( "JailBreak New Shop", "1.0", "Built by Rejack || Edit by @.TheBomB`" );
- /* Forwards */
- register_forward(FM_EmitSound , "EmitSound");
- RegisterHam( Ham_Item_Deploy, "weapon_knife", "FwdItemDeployKnife", 1 );
- RegisterHam( Ham_TakeDamage, "player", "FwdTakeDamage", 0 );
- RegisterHam( Ham_Spawn, "player", "FwdHamSpawn", 1 );
- /* Client Commands */
- register_clcmd( "say", "CmdSay" );
- /* Events */
- register_event( "CurWeapon", "evCurWeapon", "be", "1=1" );
- register_event( "DeathMsg", "evDeathMsg", "a" );
- /* Regex */
- new error[ 2 ];
- gSteamPattern = regex_compile( REGEX_STEAMID_PATTERN, gRegexReturn, error, charsmax( error ) );
- /* Commands */
- register_concmd( "_deposit", "CmdDeposit" );
- register_concmd( "_withdraw", "CmdWithdraw" );
- }
- public EmitSound( id, channel, sample[ ] )
- {
- if(gIndex[ id ][ gKNIFE ] == 5)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife1[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 18)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife2[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 8)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife3[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 10)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife4[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 13)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife5[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 17)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife6[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 11)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife7[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 12)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife7[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 15)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife8[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 14)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife9[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 19)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife10[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 20)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife11[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- if(gIndex[ id ][ gKNIFE ] == 21)
- {
- if( !is_user_alive( id ) || !is_user_connected( id ) )
- {
- return FMRES_IGNORED;
- }
- if( get_user_weapon( id ) == CSW_KNIFE )
- {
- new i;
- for( i = 0; i < sizeof OldKnifeSound; i++ )
- {
- if( equal( sample, OldKnifeSound[ i ] ) )
- {
- emit_sound( id, CHAN_WEAPON, SoundKnife12[ i ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
- return FMRES_SUPERCEDE;
- }
- }
- }
- }
- return FMRES_IGNORED;
- }
- #if !defined USE_FVAULT
- public plugin_cfg()
- g_mVault = nvault_open( g_szVault );
- public plugin_end()
- nvault_close( g_mVault );
- #endif
- public plugin_precache()
- {
- static i;
- for( new i = 0 ; i < sizeof SoundKnife1 ; i ++ )
- precache_sound( SoundKnife1[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife2 ; i ++ )
- precache_sound( SoundKnife2[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife3 ; i ++ )
- precache_sound( SoundKnife3[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife4 ; i ++ )
- precache_sound( SoundKnife4[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife5 ; i ++ )
- precache_sound( SoundKnife5[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife6 ; i ++ )
- precache_sound( SoundKnife6[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife7 ; i ++ )
- precache_sound( SoundKnife7[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife8 ; i ++ )
- precache_sound( SoundKnife8[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife9 ; i ++ )
- precache_sound( SoundKnife9[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife10 ; i ++ )
- precache_sound( SoundKnife10[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife11 ; i ++ )
- precache_sound( SoundKnife11[ i ] )
- for( new i = 0 ; i < sizeof SoundKnife12 ; i ++ )
- precache_sound( SoundKnife12[ i ] )
- precache_sound( g_szBeacon[ 0 ] );
- g_szBeaconSpirte = precache_model( g_szBeacon[ 1 ] );
- g_szExplosionSprite = precache_model( g_szExplosion );
- for ( i = 0; i < sizeof g_szKnivesModels; i++ )
- precache_model( g_szKnivesModels[ i ] );
- for ( i = 0; i < sizeof g_szKnives; i++ )
- {
- if ( g_szKnives[ i ][ g_kPlayerModel ] == 1 )
- precache_model( g_szKnives[ i ][ g_kSzPlayerModel ] );
- }
- precache_sound( "Top/JB/Shop/lol.wav" );
- precache_model( "models/Top/knife_days/v_dance.mdl" );
- }
- public plugin_natives( )
- {
- register_native( "jb_get_user_knife", "_get_knife" );
- register_native( "jb_set_user_knife", "_set_knife" );
- register_native( "jb_get_last_knife", "_get_lastknife" )
- register_native( "get_user_knife_level", "_get_knife" )
- register_native( "get_user_knife_health", "_get_knife_health" )
- register_native( "jb_get_user_cash", "_get_cash" );
- register_native( "jb_set_user_cash", "_set_cash" );
- register_native( "get_user_cash", "_get_cash" );
- register_native( "set_user_cash", "_set_cash" );
- register_native( "set_client_cash", "_get_cash" );
- register_native( "get_client_cash", "_set_cash" );
- register_native( "get_user_bank", "_get_bank" );
- register_native( "set_user_bank", "_set_bank" );
- register_native( "get_user_xp", "_get_xp" );
- register_native( "set_user_xp", "_set_xp" );
- register_native( "get_rank_cash", "_get_rank_cash" );
- }
- /* Natives */
- public _get_knife( plugin, params )
- {
- if ( !is_user_connected( get_param( 1 ) ) )
- {
- log_amx( "[ShopSystem] Index (%i) is currently not connected.", get_param( 1 ) );
- return 0;
- }
- return gIndex[ get_param( 1 ) ][ gKNIFE ];
- }
- public _get_knife_health( plugin, params )
- {
- static index;
- index = get_param( 1 );
- return g_szKnives[ gIndex[ index ][ gKNIFE ] ][ g_kHealth ];
- }
- public _set_knife( plugin, params )
- {
- static index, knife;
- index = get_param( 1 );
- if ( !is_user_connected( index ) )
- {
- log_amx( "[ShopSystem] Index (%i) is currently not connected.", index );
- return 0;
- }
- knife = get_param( 2 );
- gIndex[ index ][ KNIFE ] = knife;
- gIndex[ index ][ gKNIFE ] = knife;
- return gIndex[ index ][ KNIFE ];
- }
- public _get_lastknife( plugin, params )
- {
- static index;
- index = get_param( 1 );
- if ( !is_user_connected( index ) )
- {
- log_amx( "[ShopSystem] Index (%i) is currently not connected.", index );
- return 0;
- }
- return gIndex[ index ][ KNIFE ];
- }
- public _get_cash( plugin, params )
- return get_user_cash( get_param( 1 ) );
- public _set_cash( plugin, params )
- {
- set_user_cash( get_param( 1 ), get_param( 2 ) );
- return get_user_cash( get_param( 1 ) );
- }
- public _get_xp( plugin, params )
- return get_user_xp( get_param( 1 ) );
- public _set_xp( plugin, params )
- {
- set_user_xp( get_param( 1 ), get_param( 2 ) );
- return get_user_xp( get_param( 1 ) );
- }
- public _get_bank( plugin, params )
- return gIndex[ get_param( 1 ) ][ BANK ];
- public _set_bank( plugin, params )
- {
- static index, amount;
- index = get_param( 1 );
- amount = get_param( 2 );
- gIndex[ index ][ BANK ] = amount;
- if ( gIndex[ index ][ BANK ] < 0 )
- gIndex[ index ][ BANK ] = 0;
- return gIndex[ get_param( 1 ) ][ BANK ];
- }
- public _get_rank_cash( plugin, params )
- return ( (gIndex[ get_param( 1 ) ][ CASH ]) + (gIndex[ get_param( 1 ) ][ BANK ]) );
- /* Events */
- public evCurWeapon( client )
- {
- if( is_running_vote() )
- {
- new String[ 220 ];
- formatex( String, charsmax( String ), "models/Top/knife_days/v_dance.mdl" );
- entity_set_string( client, EV_SZ_viewmodel, String );
- }
- if ( !is_user_alive( client ) || !is_user_connected( client ) )
- return 0;
- if ( bSpeed[ client ] )
- fm_set_user_maxspeed( client, fm_get_user_maxspeed( client ) * 2 );
- return 0;
- }
- public evDeathMsg(id)
- {
- if( get_playersnum() < 4 && get_user_team(id) ==1)
- return ColorPrint( 0, "^4*5 players^1 must be online to get^3 cash^1" )
- static iKiller, iVictim, iHeadshot, CsTeams: iTeam[ 2 ], Amount;
- iKiller = read_data( 1 );
- iVictim = read_data( 2 );
- iHeadshot = read_data( 3 );
- iTeam[ 0 ] = cs_get_user_team( iKiller );
- iTeam[ 1 ] = cs_get_user_team( iVictim );
- if ( iTeam[ 0 ] == iTeam[ 1 ] || iTeam[ 0 ] != CS_TEAM_T || iTeam[ 1 ] != CS_TEAM_CT )
- return 0;
- Amount = CASH_KILL;
- if ( iHeadshot )
- {
- Amount = CASH_HS;
- }
- Amount += g_szKnives[ gIndex[ iKiller ][ gKNIFE ] ][ g_kCash ];
- remove_task( iVictim );
- bSpeed[ iVictim ] = false;
- bPowerup[ iVictim ] = false;
- set_user_cash( iKiller, get_user_cash( iKiller ) + CASH_KILL );
- set_user_xp( iKiller, get_user_xp( iKiller ) + XP_KILL );
- ColorPrint( iKiller, "You gained^3 %i^1 cash and^3 %i^1 xp, for killing^4 %s^1.", CASH_KILL, XP_KILL, szName( iVictim ) );
- 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 ) );
- return 0;
- }
- public evRoundStart()
- {
- static Players[ 32 ], iNum, iPlayer;
- get_players( Players, iNum, "ch" );
- for ( new i; i < iNum; i++ )
- {
- iPlayer = Players[ i ];
- remove_task( iPlayer );
- fm_set_user_godmode( iPlayer, 0 );
- bSpeed[ iPlayer ] = bPowerup[ iPlayer ] = false;
- }
- }
- /* Forwards */
- public FwdHamSpawn( const client )
- {
- if ( !is_user_alive( client ) || !is_user_connected( client ) )
- return 1;
- static Float: fMins;
- fMins = (get_gametime()/60) - (fIndex[ client ][ NEXTCASH ]/60);
- if ( CountPlayers() >= 0 )
- {
- new iYears, iMonths, iDays, iHours, iMinutes, iSeconds;
- UnixToTime( 60*5 - g_iPlayTime[ client ], iYears, iMonths, iDays, iHours, iMinutes, iSeconds );
- iYears -= 1970;
- iMonths -= 1;
- iDays -= 1;
- if ( fMins <= NEXT_CASH_TIME )
- 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 );
- }
- bSpeed[ client ] = false;
- bPowerup[ client ] = false;
- fm_set_user_rendering( client );
- static iHealth, iArmor;
- iHealth = g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kHealth ];
- iArmor = g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kArmor ];
- fm_set_user_armor( client, 100 + iArmor );
- fm_set_user_health( client, 100 + iHealth );
- if ( cs_get_user_team( client ) == CS_TEAM_T )
- {
- }
- return 1;
- }
- public FwdItemDeployKnife( ent )
- {
- static client; client = get_pdata_cbase( ent, 41, 4 );
- if ( is_user_alive( client ) )
- set_pev( client, pev_viewmodel2, g_szKnivesModels[ gIndex[ client ][ gKNIFE ] ][ V_MODEL ] );
- }
- public FwdTakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage, iDmgBits )
- {
- if ( !is_user_connected( iAttacker ) || !is_user_connected( iVictim ) || !is_user_alive( iAttacker ) || !is_user_alive( iVictim ) )
- return 1;
- if ( iVictim == iAttacker )
- return 1;
- if ( get_user_weapon( iAttacker ) == CSW_KNIFE && iDmgBits & DMG_NEVERGIB && !(iDmgBits&(1<<24)) )
- {
- static Float: g_fDamage, CsTeams: iTeam[ 2 ], Float: fPunchAngle[ 3 ], i;
- g_fDamage = fDamage + g_szKnives[ gIndex[ iAttacker ][ gKNIFE ] ][ g_mDamage ];
- iTeam[ 0 ] = cs_get_user_team( iVictim );
- iTeam[ 1 ] = cs_get_user_team( iAttacker );
- SetHamParamFloat( 4, g_fDamage );
- if ( get_cvar_num( "mp_friendlyfire" ) == 0 && iTeam[ 0 ] == iTeam[ 1 ] )
- return 1;
- if ( gIndex[ iAttacker ][ gKNIFE ] == 0 )
- return 1;
- for ( i = 0; i < sizeof fPunchAngle; i++ )
- fPunchAngle[ i ] = 6.0 * gIndex[ iAttacker ][ gKNIFE ];
- set_pev( iVictim, pev_punchangle, fPunchAngle );
- SetHamParamFloat( 4, g_fDamage );
- }
- return 1;
- }
- /* Knives Menu */
- public CmdKnivesMenu( const client )
- {
- 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 ] );
- static Menu; Menu = menu_create( szItem, "HandlerKnivesMenu" );
- static iKnife, gKnife, szText[ 32 ];
- iKnife = gIndex[ client ][ KNIFE ];
- gKnife = gIndex[ client ][ gKNIFE ];
- for ( new i; i < sizeof g_szKnives; i++ )
- {
- szText = "";
- if ( g_szKnives[ i ][ g_kPremium ] == 1 )
- szText = "\d-\r [ Premiums Only ]";
- if ( gKnife == i )
- szText = "\d-\r [ Your ]";
- if( i > iKnife )
- formatex( szText, charsmax( szText ), "\d- \d[\wLOCK\d]" );
- if( i < iKnife && i != gKnife)
- formatex( szText, charsmax( szText ), "\d- \d[\wUNLOCK\d]" );
- if ( iKnife + 1 == i )
- formatex( szText, charsmax( szText ), "\d- \d[\wNEXT UNLOCK\d]", g_szKnives[ i ][ g_kPrice ] );
- if ( gKnife )
- formatex( szText, charsmax( szText ), "\d- [\y %i\w Cash \d]", g_szKnives[ i ][ g_kPrice ] );
- 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)" : "" );
- menu_additem( Menu, szItem );
- }
- menu_setprop( Menu, MPROP_EXITNAME, "Back" );
- menu_display( client, Menu );
- return 1;
- }
- public HandlerKnivesMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdMainMenu( client );
- }
- static iItem;
- iItem = Item;
- menu_destroy( Menu );
- CmdKnivesItemsMenu( client, iItem );
- return 1;
- }
- public CmdKnivesItemsMenu( const client, const Item )
- {
- static szPrice[ 28 ], szKey[ 3 ];
- 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 ",
- szPrefix, get_user_cash( client ), g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kName ],
- g_szKnives[ gIndex[ client ][ KNIFE ] ][ g_kName ], g_szKnives[ Item ][ g_kName ] );
- new Menu = menu_create( szItem, "HandlerKnivesItemsMenu" );
- num_to_str( Item, szKey, charsmax( szKey ) );
- formatex( szItem, charsmax( szItem ), "\yLevel Needed:\d %i", g_szKnives[ Item ][ g_kLevelNeeded ] );
- menu_additem( Menu, szItem, szKey );
- menu_additem( Menu, "Use", szKey, 0, menu_makecallback( "CallBackUse_CmdKnivesItems" ) );
- formatex( szPrice, charsmax( szPrice ), "- [\y %i\w Cash \d]", g_szKnives[ Item ][ g_kPrice ] );
- formatex( szItem, charsmax( szItem ), "Purchase Knife\d %s^n", (gIndex[ client ][ KNIFE ]<Item) ? szPrice : "" );
- menu_additem( Menu, szItem, szKey, 0, menu_makecallback( "CallBackPurchase_CmdKnivesItems" ) );
- menu_additem( Menu, "View Knife Stats", szKey );
- menu_setprop( Menu, MPROP_EXITNAME, "Back" );
- menu_display( client, Menu );
- return 1;
- }
- public HandlerKnivesItemsMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdKnivesMenu( client );
- }
- static mData[ 6 ], Trash, Key, iKnife, mKnife, iLevel, NeededLevel;
- menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _,_, Trash );
- Key = str_to_num( mData );
- iKnife = gIndex[ client ][ KNIFE ];
- mKnife = gIndex[ client ][ gKNIFE ];
- iLevel = gIndex[ client ][ gLVL ];
- NeededLevel = g_szKnives[ Key ][ g_kLevelNeeded ];
- if ( Item == 0 )
- return CmdKnivesItemsMenu( client, Key );
- else if ( Item == 1 ) /* USE */
- {
- if ( Key > iKnife )
- {
- ColorPrint( client, "You haven't bought that knife yet." );
- return CmdKnivesItemsMenu( client, Key );
- }
- if ( Key == mKnife )
- {
- ColorPrint( client, "You're already using this knife." );
- return CmdKnivesMenu( client );
- }
- gIndex[ client ][ gKNIFE ] = Key;
- if ( user_has_weapon( client, CSW_KNIFE ) )
- {
- HamStripWeapon( client, "weapon_knife" );
- fm_give_item( client, "weapon_knife" );
- }
- }
- else if ( Item == 2 ) /* Purchase */
- {
- if ( g_szKnives[ Key ][ g_kPremium ] == 1 )
- {
- ColorPrint( client, "You need to be a^3 Premium Member^1 in order to purchase this knife." );
- return CmdKnivesItemsMenu( client, Key );
- }
- if ( iLevel < NeededLevel - 1 )
- {
- ColorPrint( client, "Your level is too low, You need to reach level^4 %i^1.", NeededLevel )
- return CmdKnivesItemsMenu( client, Key );
- }
- if ( iKnife+1 < Key )
- {
- ColorPrint( client, "You can't purchase the^3 %s^1 yet.", g_szKnives[ Key ][ g_kName ] );
- return CmdKnivesMenu( client );
- }
- if ( iKnife >= Key )
- {
- ColorPrint( client, "You already own the^3 %s^1.", g_szKnives[ Key ][ g_kName ] );
- return CmdKnivesMenu( client );
- }
- if ( get_user_cash( client ) < g_szKnives[ Key ][ g_kPrice ] )
- {
- 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 ] );
- return CmdKnivesMenu( client );
- }
- gIndex[ client ][ KNIFE ] = Key;
- gIndex[ client ][ gKNIFE ] = Key;
- set_user_cash( client, get_user_cash( client ) - g_szKnives[ Key ][ g_kPrice ] );
- if ( user_has_weapon( client, CSW_KNIFE ) )
- {
- HamStripWeapon( client, "weapon_knife" );
- fm_give_item( client, "weapon_knife" );
- }
- 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 ] );
- 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 ] );
- }
- else if ( Item == 3 ) /* View Stats */
- {
- static iMenu, cb;
- 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,
- g_szKnives[ mKnife ][ g_kName ], g_szKnives[ iKnife ][ g_kName ], g_szKnives[ Key ][ g_kName ] );
- iMenu = menu_create( szItem, "HandlerSubKnivesStats" );
- cb = menu_makecallback( "MenuItemDisable" );
- formatex( szItem, charsmax( szItem ), "\yHealth Bonus:\d +%i", g_szKnives[ Key ][ g_kHealth ] );
- menu_additem( iMenu, szItem, mData, 0, cb );
- formatex( szItem, charsmax( szItem ), "\yArmor Bonus:\d +%i", g_szKnives[ Key ][ g_kArmor ] );
- menu_additem( iMenu, szItem, mData, 0, cb );
- formatex( szItem, charsmax( szItem ), "\yDamage Bonus:\d +%i", g_szKnives[ Key ][ g_mDamage ] );
- menu_additem( iMenu, szItem, mData, 0, cb );
- formatex( szItem, charsmax( szItem ), "\yCash Bonus:\d +%i", g_szKnives[ Key ][ g_kCash ] );
- menu_additem( iMenu, szItem, mData, 0, cb );
- formatex( szItem, charsmax( szItem ), "\ySlag:\d +%i.0%%", Key * 6 );
- menu_additem( iMenu, szItem, mData, 0, cb );
- formatex( szItem, charsmax( szItem ), "\yPlayer Model: %s", (g_szKnives[ Key ][ g_kPlayerModel ]==1) ? "\rYes" : "\dNo" );
- menu_additem( iMenu, szItem, mData, 0, cb );
- menu_setprop( iMenu, MPROP_EXITNAME, "Back" );
- menu_display( client, iMenu );
- menu_destroy( Menu );
- return 1;
- }
- menu_destroy( Menu );
- CmdKnivesMenu( client );
- return 1;
- }
- public HandlerSubKnivesStats( client, Menu, Item )
- {
- static mData[ 6 ], Trash, Key;
- menu_item_getinfo( Menu, 0, Trash, mData, charsmax( mData ), _,_, Trash );
- Key = str_to_num( mData );
- menu_destroy( Menu )
- return CmdKnivesItemsMenu( client, Key );
- }
- /* Client Side */
- public client_disconnect( client )
- SaveVaultKey( client );
- public client_putinserver( client )
- {
- CheckAuthOnline( client );
- for ( new i; i < g_mData; i++ )
- gIndex[ client ][ i ] = 0;
- LoadVaultKey( client );
- bPowerup[ client ] = false;
- bSpeed[ client ] = false;
- bMessage[ client ] = false;
- fIndex[ client ][ GAMETIME ] = get_gametime();
- fIndex[ client ][ NEXTCASH ] = get_gametime();
- 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 ] );
- }
- public CmdSay( client )
- {
- new szMsg[ 192 ], szArgs[ 3 ][ 32 ];
- read_argv( 1, szMsg, charsmax( szMsg ) );
- parse( szMsg, szArgs[ 0 ], 31, szArgs[ 1 ], 31, szArgs[ 2 ], 31 );
- if ( equali( szMsg, "/shop" ) )
- return CmdMainMenu( client );
- if ( equali( szMsg, "/knife" ) )
- return CmdKnivesMenu( client );
- if ( equali( szMsg, "/bank" ) )
- return CmdBankMenu( client );
- if ( equali( szMsg, "/msg" ) || equali( szMsg, "/messages" ) )
- {
- bMessage[ client ] = !bMessage[ client ];
- ColorPrint( client, "You just^3 %s^1 the gamble messages.", bMessage[ client ] ? "Deactivated" : "Activated" );
- return 1;
- }
- if ( equali( szMsg, "/nc" ) || equali( szMsg, "/nextcash" ) )
- {
- if ( CountPlayers() < 0 )
- return ColorPrint( client, "^3NextCash^1 requires at least^4 5^1 Players." );
- UpdateOnlinePlayers_Time();
- g_iPlayTime[ client ] += get_user_time( client, 1 ) - g_iLastUpdateTime[ client ];
- g_iLastUpdateTime[ client ] = get_user_time( client, 1 );
- new iYears, iMonths, iDays, iHours, iMinutes, iSeconds;
- UnixToTime( 60*5 - g_iPlayTime[ client ], iYears, iMonths, iDays, iHours, iMinutes, iSeconds );
- iYears -= 1970;
- iMonths -= 1;
- iDays -= 1;
- if ( g_iPlayTime[ client ] <= 60*5 )
- {
- 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 ) );
- return 1;
- }
- g_iPlayTime[ client ] = 0;
- set_user_cash( client, get_user_cash( client ) + get_user_nextcash( client ) + get_user_gang_nextcash( client ));
- SaveVaultKey( client );
- 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 ) );
- }
- if ( equali( szArgs[ 0 ], "/level" ) || equali( szArgs[ 0 ], "/lvl" ) || equali( szArgs[ 0 ], "/xp" ) || equali( szArgs[ 0 ], "/exp" ) )
- {
- static iPlayer;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( equali( szMsg, "/level" ) || equali( szMsg, "/lvl" ) || equali( szMsg, "/xp" ) || equali( szMsg, "/exp" ) )
- iPlayer = client;
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- if ( iPlayer == client )
- return ColorPrint( client, "You're on level^4 %i^1 with^3 %i^1 xp!", get_user_level( client ) + 1, get_user_xp( client ) );
- 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 ) );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/next" ) )
- {
- static iPlayer;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( equali( szMsg, "/next" ) )
- iPlayer = client;
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- if ( iPlayer == client )
- 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 );
- 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 );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/cash" ) )
- {
- static iPlayer;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( equali( szMsg, "/cash" ) )
- iPlayer = client;
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- if ( iPlayer == client )
- 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.",
- get_user_cash( client ), gIndex[ client ][ BANK ],get_user_tickets(client), g_szKnives[ gIndex[ client ][ gKNIFE ] ][ g_kName ] );
- 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.",
- szName( iPlayer ), get_user_cash( iPlayer ), gIndex[ iPlayer ][ BANK ],get_user_tickets(client), g_szKnives[ gIndex[ iPlayer ][ gKNIFE ] ][ g_kName ] );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/gamble" ) )
- {
- static Amount, bool: bAllin;
- bAllin = false;
- Amount = str_to_num( szArgs[ 1 ] );
- if ( equali( szArgs[ 1 ], "allin" ) || equali( szArgs[ 1 ], "all" ) || Amount == get_user_cash( client ) )
- {
- Amount = get_user_cash( client );
- bAllin = true;
- }
- else if ( equali( szMsg, "/gamble" ) || !is_str_num( szArgs[ 1 ] ) )
- return ColorPrint( client, "Syntax: /^4gamble^1 <^3amount^1>" );
- if ( Amount > get_user_cash( client ) )
- return ColorPrint( client, "You're missing^3 %i^1 cash to gamble on^4 %i^1 cash.", Amount - get_user_cash( client ), Amount );
- if ( Amount < 300 )
- return ColorPrint( client, "You need to gamble on a minimum of^4 300 Cash^1 at a time." );
- static bool: bGamble;
- static iTotal, bonus, chance;
- static szBonus[ 12 ];
- bGamble = false;
- iTotal = get_user_cash( client );
- set_user_cash( client, iTotal - Amount );
- chance = GAMBLE_CHANCE;
- bonus = 0;
- szBonus = "";
- if ( get_user_flags( client ) & ADMIN_LEVEL_C )
- bonus += GAMBLE_CHANCE_PREMIUM;
- if ( bAllin && get_user_bank( client ) == 0 )
- bonus += GAMBLE_CHANCE_ALLIN;
- if( bonus )
- formatex( szBonus, charsmax( szBonus ), "(+^4%i%%^1)", bonus );
- if ( chance + bonus >= random( 99 ) )
- {
- bGamble = true;
- set_user_cash( client, iTotal + Amount );
- }
- static Players[ 32 ], iNum;
- get_players( Players, iNum, "ch" );
- for ( new i; i < iNum; i++ )
- {
- if ( bMessage[ Players[ i ] ] && Players[ i ] != client )
- continue;
- 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 );
- }
- 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 ) );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/transfer" ) )
- {
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/transfer" ) )
- return ColorPrint( client, "Syntax: /^4transfer^1 <^4player^1> <^4amount^1>" );
- static iPlayer;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- if ( iPlayer == client )
- return ColorPrint( client, "You can't transfer cash to yourself." );
- new Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount > get_user_cash( client ) )
- return ColorPrint( client, "You don't have enough cash." );
- if ( Amount < 300 )
- return ColorPrint( client, "You can't transfer less than^4 300 Cash^1." );
- if ( get_user_flags( client ) & ADMIN_LEVEL_C )
- {
- if ( get_user_cash( client ) + get_user_bank( client ) > 10000000000000 )
- return ColorPrint( client, "aaa" );
- }
- if ( get_user_cash( client ) + get_user_bank( client ) > 70000 )
- return ColorPrint( client, "You can't transfer cash if you have more than^3 70,000^1 cash." );
- if ( get_user_cash( client ) + get_user_bank( client ) > 70000 )
- return ColorPrint( client, "You can't transfer cash if you have more than^3 70,000^1 cash." );
- if ( cs_get_user_team( client ) != CS_TEAM_T )
- return ColorPrint( client, "You can't transfer while being a^3 Counter-Terrorist^1." );
- static Amount2, Tax;
- Tax = TAX;
- if ( get_user_flags( client ) && ADMIN_LEVEL_C || get_user_flags( iPlayer ) && ADMIN_LEVEL_C )
- Tax = 10;
- Amount2 = Amount;
- Amount2 = Amount - (Amount / 100 * Tax);
- set_user_cash( client, get_user_cash( client ) - Amount );
- set_user_cash( iPlayer, get_user_cash( iPlayer ) + Amount2 );
- log_amx( "%s ( %s | %s | %i Cash ) transfer %i cash to %s ( %s | %s | %i ). He received %i cash because of the tax rate.",
- szName( client ), szAuth( client ), szAddress( client ), get_user_cash( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ), Amount2 );
- //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 );
- 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 );
- }
- if ( equali( szArgs[ 0 ], "/give" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/give" ) )
- return ColorPrint( client, "Syntax: /^4give^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- set_user_cash( iPlayer, get_user_cash( iPlayer ) + Amount );
- 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 ) );
- ColorPrint( client, "You gave^3 %i^1 cash to^4 %s^1.", Amount, szName( iPlayer ) );
- ColorPrint( iPlayer, "You were given^3 %i^1 cash by the admin^4 %s^1.", Amount, szName( client ) );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/take" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/take" ) )
- return ColorPrint( client, "Syntax: /^4take^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- set_user_cash( iPlayer, get_user_cash( iPlayer ) - Amount );
- 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 ) );
- ColorPrint( client, "You took^3 %i^1 cash from^4 %s^1.", Amount, szName( iPlayer ) );
- ColorPrint( iPlayer, "You were taken^3 %i^1 cash by the admin^4 %s^1.", Amount, szName( client ) );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/set" ) || equali( szArgs[ 0 ], "/setcash" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/set" ) || equali( szMsg, "/setcash" ) )
- return ColorPrint( client, "Syntax: /^3setcash^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- set_user_cash( iPlayer, get_user_cash( iPlayer ) + Amount );
- 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 );
- ColorPrint( client, "You set^3 %s's^1 cash to^4 %i^1 cash^1.", szName( iPlayer ), Amount );
- ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your cash to^4 %i^1 cash^1.", szName( client ), Amount );
- SaveVaultKey( client );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/setlucky" ) || equali( szArgs[ 0 ], "/settickets" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/setlucky" ) || equali( szMsg, "/settickets" ) )
- return ColorPrint( client, "Syntax: /^3setlucky^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- if ( Amount > 150 )
- return ColorPrint( client, "You can set less^3 150^1 tickets." );
- set_user_tickets( iPlayer, get_user_tickets( iPlayer ) + Amount );
- 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 );
- ColorPrint( client, "You set^3 %s's^1 Tickets to^4 %i^1 tickets^1.", szName( iPlayer ), Amount );
- ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your tickets to^4 %i^1 tickets^1.", szName( client ), Amount );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/tt" ) )
- {
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/tt" ) )
- return ColorPrint( client, "Syntax: /^4tt^1 <^4player^1> <^4amount^1>" );
- static iPlayer;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- if ( iPlayer == client )
- return ColorPrint( client, "You can't transfer tickets to yourself." );
- new Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount > get_user_tickets( client ) )
- return ColorPrint( client, "You don't have enough cash." );
- if ( cs_get_user_team( client ) != CS_TEAM_T )
- return ColorPrint( client, "You can't transfer while being a^3 Counter-Terrorist^1." );
- static Amount2;
- Amount2 = Amount;
- set_user_tickets( client, get_user_tickets( client ) - Amount );
- set_user_tickets( iPlayer, get_user_tickets( iPlayer ) + Amount2 );
- log_amx( "%s ( %s | %s | %i Tickets ) transfer %i tickets to %s ( %s | %s | %i ). He received %i cash because of the tax rate.",
- szName( client ), szAuth( client ), szAddress( client ), get_user_cash( client ), Amount, szName( iPlayer ), szAuth( iPlayer ), szAddress( iPlayer ), get_user_cash( iPlayer ), Amount2 );
- //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 );
- return ColorPrint( 0, "^4%s^1 transfered^3 %s^4 %i^1 tickets.", szName( client ), szName( iPlayer ), Amount );
- }
- if ( equali( szArgs[ 0 ], "/setknife" ) || equali( szArgs[ 0 ], "/sk" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/setknife" ) || equali( szMsg, "/sk" ) )
- return ColorPrint( client, "Syntax: /^4setknife^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < -1 )
- return ColorPrint( client, "You can't use a value lower than^4 -1^1." );
- if ( Amount > charsmax( g_szKnives ) )
- return ColorPrint( client, "You can't use a value higher than^4 %i^1.", charsmax( g_szKnives ) );
- gIndex[ iPlayer ][ KNIFE ] = Amount;
- gIndex[ iPlayer ][ gKNIFE ] = Amount;
- SaveVaultKey( iPlayer );
- if ( user_has_weapon( iPlayer, CSW_KNIFE ) )
- {
- HamStripWeapon( iPlayer, "weapon_knife" );
- fm_give_item( iPlayer, "weapon_knife" );
- }
- 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 );
- 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 );
- 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 );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/setbank" ) || equali( szArgs[ 0 ], "/sb" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/setbank" ) || equali( szMsg, "/sb" ) )
- return ColorPrint( client, "Syntax: /^4setbank^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- set_user_bank( iPlayer, Amount );
- 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 );
- ColorPrint( client, "You set^3 %s's^1 bank cash to^4 %i^1 cash^1.", szName( iPlayer ), Amount );
- ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your bank cash to^4 %i^1 cash^1.", szName( client ), Amount );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/givebank" ) || equali( szArgs[ 0 ], "/gb" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/givebank" ) || equali( szMsg, "/tb" ) )
- return ColorPrint( client, "Syntax: /^4givebank^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- set_user_bank( iPlayer, get_user_bank( iPlayer ) + Amount );
- 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 ) );
- ColorPrint( client, "You gave^3 %i^1 bank cash to^4 %s^1.", Amount, szName( iPlayer ) );
- ColorPrint( iPlayer, "You were given^3 %i^1 bank cash by the admin^4 %s^1.", Amount, szName( client ) );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/takebank" ) || equali( szArgs[ 0 ], "/tb" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/takebank" ) || equali( szMsg, "/tb" ) )
- return ColorPrint( client, "Syntax: /^4takebank^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- set_user_bank( iPlayer, get_user_bank( iPlayer ) - Amount );
- 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 ) );
- ColorPrint( client, "You took^3 %i^1 bank cash from^4 %s^1.", Amount, szName( iPlayer ) );
- ColorPrint( iPlayer, "You were taken^3 %i^1 bank cash by the admin^4 %s^1.", Amount, szName( client ) );
- return 1;
- }
- if ( equali( szArgs[ 0 ], "/setlevel" ) || equali( szArgs[ 0 ], "/sl" ) )
- {
- if ( !( get_user_flags( client ) & ADMIN_RCON ) )
- return 0;
- if ( !is_str_num( szArgs[ 2 ] ) || equali( szMsg, "/give" ) || equali( szMsg, "/sl" ) )
- return ColorPrint( client, "Syntax: /^4setlevel^1 <^4player^1> <^4amount^1>" );
- static iPlayer, Amount;
- iPlayer = cmd_target( client, szArgs[ 1 ], 8 );
- if ( !iPlayer )
- return ColorPrint( client, "^3%s^1 was not found!", szArgs[ 1 ] );
- Amount = str_to_num( szArgs[ 2 ] );
- if ( Amount < 0 )
- return ColorPrint( client, "You can't use a value lower than^4 0^1." );
- if ( Amount > sizeof gXPLevels )
- return ColorPrint( client, "You can't use a value higher than^4 %i^1.", sizeof gXPLevels );
- if ( Amount != 1 )
- {
- set_user_level( iPlayer, Amount - 1 );
- set_user_xp( iPlayer, gXPLevels[ Amount - 1 ] );
- }
- else if ( Amount == 1 )
- {
- set_user_level( iPlayer, 0 );
- set_user_xp( iPlayer, 0 );
- }
- 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 );
- ColorPrint( client, "You set^3 %s's^1 level to^4 %i^1.", szName( iPlayer ), Amount );
- ColorPrint( iPlayer, "ADMIN:^3 %s^1 set your level to^4 %i^1.", szName( client ), Amount );
- return 1;
- }
- return 0;
- }
- /* View Players */
- public UpdateOnlinePlayers_Time()
- {
- for( new i = 0; i < get_maxplayers(); i++ )
- {
- if( is_user_connected( i ) )
- {
- g_iPlayTime[ i ] += get_user_time( i, 1 ) - g_iLastUpdateTime[ i ];
- g_iLastUpdateTime[ i ] = get_user_time( i, 1 );
- }
- }
- }
- public CmdViewPlayers( const client )
- {
- static Menu, Players[ 32 ], iNum, szTempid[ 10 ], i;
- get_players( Players, iNum, "ch" );
- formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w View\w Players", szPrefix );
- Menu = menu_create( szItem, "HandlerViewPlayers" );
- for ( i = 0; i < iNum; i++ )
- {
- num_to_str( Players[ i ], szTempid, charsmax( szTempid ) );
- menu_additem( Menu, szName( Players[ i ] ), szTempid );
- }
- menu_display( client, Menu );
- return 1;
- }
- public HandlerViewPlayers( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdMainMenu( client );
- }
- static mData[ 6 ], iPlayer, Trash, mName[ 32 ];
- menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), mName, charsmax( mName ), Trash );
- iPlayer = str_to_num( mData );
- if ( !iPlayer )
- {
- ColorPrint( client, "^3%s^1 is currently not connected.", mName );
- return CmdViewPlayers( client );
- }
- menu_destroy( Menu );
- return CmdViewThePlayer( client, iPlayer, mData );
- }
- public CmdViewThePlayer( const client, const iPlayer, Data[] )
- {
- static Menu, Cash, Bank, iKnife, Knife;
- formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w View\w Players^n^nYou are viewing\r %s\d:", szPrefix, szName( iPlayer ) );
- Menu = menu_create( szItem, "HandlerViewThePlayer" );
- Cash = get_user_cash( iPlayer );
- formatex( szItem, charsmax( szItem ), "\dPocket Cash:\y %i\w Cash", Cash );
- menu_additem( Menu, szItem, Data );
- Bank = gIndex[ iPlayer ][ BANK ];
- formatex( szItem, charsmax( szItem ), "\dBank Cash:\y %i\w Cash", Bank );
- menu_additem( Menu, szItem, Data );
- iKnife = gIndex[ iPlayer ][ gKNIFE ];
- formatex( szItem, charsmax( szItem ), "\dUsed Knife:\y %s \r(\w%i\r)", g_szKnives[ iKnife ][ g_kName ], iKnife );
- menu_additem( Menu, szItem, Data );
- Knife = gIndex[ iPlayer ][ KNIFE ];
- formatex( szItem, charsmax( szItem ), "\dOwned Knife:\y %s \r(\w%i\r)", g_szKnives[ Knife ][ g_kName ], Knife );
- menu_additem( Menu, szItem, Data );
- 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 ) ] );
- menu_additem( Menu, szItem, Data );
- menu_setprop( Menu, MPROP_EXITNAME, "Back" );
- menu_display( client, Menu );
- return 1;
- }
- public HandlerViewThePlayer( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdViewPlayers( client );
- }
- static Trash, mData[ 6 ], Key;
- menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _,_, Trash );
- Key = str_to_num( mData );
- menu_destroy( Menu );
- return CmdViewThePlayer( client, Key, mData );
- }
- /* Main Shop Menu */
- public CmdMainMenu( const client )
- {
- formatex( szItem, charsmax( szItem ), "\r[%s]\w Shop Menu^nYou have\y %i\w Cash", szPrefix, get_user_cash( client ) );
- new Menu = menu_create( szItem, "HandlerMainMenu" );
- menu_additem( Menu, "Grenades\y Shop" );
- menu_additem( Menu, "Health\y Shop" );
- menu_additem( Menu, "Armor\y Shop" );
- menu_additem( Menu, "Powers\y Shop^n" );
- menu_additem( Menu, "Knives\y Shop" );
- menu_additem( Menu, "View Players" );
- menu_display( client, Menu );
- return 1;
- }
- public HandlerMainMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- static iMenu, Float: price, szPremium[ 64 ];
- price = 1.0
- szPremium = "^n^nNote:\y Premium Members\d get a\r 10%\d discount!";
- if ( get_user_flags( client ) && ADMIN_LEVEL_C )
- {
- price = 0.9;
- szPremium = "^n^nYou're a\r Premium Member\w you get a\y 10%\w discount!";
- }
- switch ( Item )
- {
- case 0:
- {
- 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 );
- iMenu = menu_create( szItem, "HandlerGrenadesMenu" );
- for ( new i; i < sizeof g_szGrenades; i++ )
- {
- 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 ) );
- menu_additem( iMenu, szItem );
- }
- }
- case 1:
- {
- 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 );
- iMenu = menu_create( szItem, "HandlerHealthMenu" );
- for ( new i; i < g_szHealthMax; i++ )
- {
- formatex( szItem, charsmax( szItem ), "\d%i Health\w for\r %i\w Cash", (i+1)*g_szHealthAmount, floatround( ( (i*g_szHealth) + g_szHealthStart) * price ) );
- menu_additem( iMenu, szItem );
- }
- }
- case 2:
- {
- 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 );
- iMenu = menu_create( szItem, "HandlerArmorMenu" );
- for ( new i; i < g_szArmorMax; i++ )
- {
- formatex( szItem, charsmax( szItem ), "\d%i Armor\w for\r %i\w Cash", (i+1)*g_szArmorAmount, floatround( ((i*g_szArmor) + g_szArmorStart) * price ) );
- menu_additem( iMenu, szItem );
- }
- }
- case 3:
- {
- 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 );
- iMenu = menu_create( szItem, "HandlerPowerupsMenu" );
- for ( new i; i < sizeof g_szPowerups; i++ )
- {
- 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 ) );
- menu_additem( iMenu, szItem );
- }
- }
- case 4:
- return CmdKnivesMenu( client );
- case 5:
- return CmdViewPlayers( client );
- }
- menu_setprop( iMenu, MPROP_EXITNAME, "Back" );
- menu_display( client, iMenu );
- menu_destroy( Menu );
- return 1;
- }
- /* Grenades Menu Handler */
- public HandlerGrenadesMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdMainMenu( client );
- }
- if ( !is_user_valid( client ) )
- if ( !is_user_valid( client ) )
- return ColorPrint( client, "%s", get_user_reason( client ) );
- if ( user_has_weapon( client, g_szGrenades[ Item ][ g_mWeapon ] ) )
- {
- ColorPrint( client, "You already have a%s^3 %s%s^1.", (Item==0) ? "n" : "", g_szGrenades[ Item ][ g_mName ], (Item==3) ? "" : " Grenade" );
- return CmdMainMenu( client );
- }
- static Price;
- Price = g_szGrenades[ Item ][ g_mPrice ];
- if ( get_user_flags( client ) && ADMIN_LEVEL_C )
- Price = floatround( Price * 0.9 );
- if ( get_user_cash( client ) < Price )
- {
- 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" );
- return CmdMainMenu( client );
- }
- fm_give_item( client, g_szGrenades[ Item ][ g_mClass ] );
- set_user_cash( client, get_user_cash( client ) - Price );
- ColorPrint( client, "You purchased a%s^3 %s%s^1.", (Item==0) ? "n" : "", g_szGrenades[ Item ][ g_mName ], (Item==3) ? "" : " Grenade" );
- return CmdMainMenu( client );
- }
- /* Health Menu */
- public HandlerHealthMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdMainMenu( client );
- }
- if ( !is_user_valid( client ) )
- return ColorPrint( client, "%s", get_user_reason( client ) );
- static Price, Amount;
- Price = (Item*g_szHealth) + g_szHealthStart;
- if ( get_user_flags( client ) && ADMIN_LEVEL_C )
- Price = floatround( Price * 0.9 );
- Amount = (Item+1) * g_szHealthAmount;
- if ( get_user_cash( client ) < Price )
- {
- ColorPrint( client, "You're missing^3 %i Cash^1 to purchase a^4 %i Health Bonus^1.", Price - get_user_cash( client ), Amount );
- return CmdMainMenu( client );
- }
- fm_set_user_health( client, get_user_health( client ) + Amount );
- set_user_cash( client, get_user_cash( client ) - Price );
- ColorPrint( client, "You purchased a^3 %i Health Bonus^1.", Amount );
- return CmdMainMenu( client );
- }
- /* Armor Menu Handler */
- public HandlerArmorMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdMainMenu( client );
- }
- if ( !is_user_valid( client ) )
- return ColorPrint( client, "%s", get_user_reason( client ) );
- static Price, Amount;
- Price = (Item*g_szArmor) + g_szArmorStart;
- if ( get_user_flags( client ) && ADMIN_LEVEL_C )
- Price = floatround( Price * 0.9 );
- Amount = (Item+1) * g_szArmorAmount;
- if ( get_user_cash( client ) < Price )
- {
- ColorPrint( client, "You're missing^3 %i Cash^1 to purchase a^4 %i Armor Bonus^1.", Price - get_user_cash( client ), Amount );
- return CmdMainMenu( client );
- }
- fm_set_user_armor( client, get_user_armor( client ) + Amount );
- set_user_cash( client, get_user_cash( client ) - Price );
- ColorPrint( client, "You purchased a^3 %i Armor Bonus^1.", Amount );
- return CmdMainMenu( client );
- }
- /* Powerups Menu Handler */
- public HandlerPowerupsMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return CmdMainMenu( client );
- }
- if ( !is_user_valid( client ) )
- return ColorPrint( client, "%s", get_user_reason( client ) );
- if ( bPowerup[ client ] )
- {
- ColorPrint( client, "You can only be using^4 1 Powerup^1 at a time." );
- return CmdMainMenu( client );
- }
- static Price;
- Price = g_szPowerups[ Item ][ g_mPrice ];
- if ( get_user_flags( client ) && ADMIN_LEVEL_C )
- Price = floatround( Price * 0.9 );
- if ( get_user_cash( client ) < Price )
- {
- 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 ] );
- return CmdMainMenu( client );
- }
- switch ( Item )
- {
- case 0:
- fm_set_user_godmode( client, 1 );
- case 1:
- fm_set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0 );
- case 2:
- cs_set_user_model( client, "urban" );
- case 3:
- fm_set_user_gravity( client, 0.5 );
- case 4:
- {
- fIndex[ client ][ GAMETIME ] = get_gametime();
- CmdSuicideBomber( client );
- }
- case 5:
- {
- fm_set_user_maxspeed( client, fm_get_user_maxspeed( client ) * 2 );
- bSpeed[ client ] = true;
- }
- }
- if ( Item != 4 )
- set_task( float( g_szPowerups[ Item ][ g_mTime ] ), g_szPowerups[ Item ][ g_mClass ], client );
- set_user_cash( client, get_user_cash( client ) - Price );
- ColorPrint( client, "You purchased a^3 %s Powerup^4 %i^1 seconds.", g_szPowerups[ Item ][ g_mName ], g_szPowerups[ Item ][ g_mTime ] );
- bPowerup[ client ] = true;
- return CmdMainMenu( client );
- }
- /* Tasks for Powerups */
- public taskRemoveGodmode( const client )
- {
- if ( !bPowerup[ client ] )
- return 1;
- fm_set_user_godmode( client, 0 );
- bPowerup[ client ] = false;
- remove_task( client );
- return ColorPrint( client, "Your^3 Godmode Powerup^1 has been^4 removed^1." );
- }
- public taskRemoveStealth( const client )
- {
- if ( !bPowerup[ client ] )
- return 1;
- fm_set_user_rendering( client );
- bPowerup[ client ] = false;
- remove_task( client );
- return ColorPrint( client, "Your^3 Stealth Powerup^1 has been^4 removed^1." );
- }
- public taskRemoveCamouflage( const client )
- {
- if ( !bPowerup[ client ] )
- return 1;
- cs_reset_user_model( client );
- bPowerup[ client ] = false;
- remove_task( client );
- return ColorPrint( client, "Your^3 Camouflage Powerup^1 has been^4 removed^1." );
- }
- public taskRemoveGravity( const client )
- {
- if ( !bPowerup[ client ] )
- return 1;
- fm_set_user_gravity( client, 1.0 );
- bPowerup[ client ] = false;
- remove_task( client );
- return ColorPrint( client, "Your^3 Godmode Powerup^1 has been^4 removed^1." );
- }
- public taskRemoveSpeed( const client )
- {
- if ( !bPowerup[ client ] )
- return 1;
- fm_set_user_maxspeed( client, 240.0 );
- bSpeed[ client ] = false;
- bPowerup[ client ] = false;
- remove_task( client );
- return ColorPrint( client, "Your^3 Speed Powerup^1 has been^4 removed^1." );
- }
- /* Suicide Bomber */
- public CmdSuicideBomber( const client )
- {
- if ( !is_user_valid( client ) )
- return 1;
- static iOrigin[ 3 ];
- get_user_origin( client, iOrigin );
- if ( fIndex[ client ][ GAMETIME ] < get_gametime() - g_szPowerups[ 4 ][ g_mTime ] )
- {
- message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin, 0 );
- write_byte( TE_EXPLOSION ); // TE ID
- write_coord( iOrigin[ 0 ] ); // X
- write_coord( iOrigin[ 1 ] ); // Y
- write_coord( iOrigin[ 2 ] - 20 ); // Z
- write_short( g_szExplosionSprite ); // Sprite
- write_byte( 40 ); // Scale in 0.1
- write_byte( 10 ) // Framerate
- write_byte( 0 ); // Flags
- message_end();
- user_kill( client );
- static Players[ 32 ], iNum, iPlayer, fOrigin[ 3 ];
- get_players( Players, iNum, "ach" );
- for ( new i; i < iNum; i++ )
- {
- iPlayer = Players[ i ];
- get_user_origin( iPlayer, fOrigin );
- if ( get_distance( iOrigin, fOrigin ) <= 300 )
- {
- make_deathmsg( client, iPlayer, 1, "weapon_hegrenade" );
- user_silentkill( iPlayer );
- if ( cs_get_user_team( iPlayer ) == CS_TEAM_CT )
- set_user_cash( client, get_user_cash( client ) + CASH_KILL );
- }
- }
- bPowerup[ client ] = false;
- remove_task( client );
- return 1;
- }
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_BEAMCYLINDER ); // TE ID
- write_coord( iOrigin[ 0 ] ); // X
- write_coord( iOrigin[ 1 ] ); // Y
- write_coord( iOrigin[ 2 ] - 20 ); // Z
- write_coord( iOrigin[ 0 ] ); // X AXIS
- write_coord( iOrigin[ 1 ] ); // Y AXIS
- write_coord( iOrigin[ 2 ] + 300 ); // Z AXIS
- write_short( g_szBeaconSpirte ); // Sprite
- write_byte( 0 ); // Startframe
- write_byte( 1 ); // Framerate
- write_byte( 9 ); // Life
- write_byte( 50 ); // Width
- write_byte( 1 ); // Noise
- write_byte( 250 ); // Red
- write_byte( 0 ); // Green
- write_byte( 0 ); // Blue
- write_byte( 200 ); // Brightness
- write_byte( 0 ); // Speed
- message_end();
- emit_sound( client, CHAN_ITEM, g_szBeacon[ 0 ], 1.0, ATTN_NONE, 0, PITCH_NORM );
- set_task( 0.6, "CmdSuicideBomber", client );
- return 1;
- }
- /* Callbacks */
- public CallBackUse_CmdKnivesItems( client, Menu, Item )
- {
- static mData[ 6 ], Trash, Key;
- menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _, _, Trash );
- Key = str_to_num( mData );
- if ( gIndex[ client ][ gKNIFE ] == Key )
- return ITEM_DISABLED;
- if ( gIndex[ client ][ KNIFE ] < Key )
- return ITEM_DISABLED;
- return ITEM_ENABLED;
- }
- public CallBackPurchase_CmdKnivesItems( client, Menu, Item )
- {
- static mData[ 6 ], Trash, Key;
- menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _, _, Trash );
- Key = str_to_num( mData );
- if ( gIndex[ client ][ KNIFE ] + 1 != Key )
- return ITEM_DISABLED;
- if ( get_user_cash( client ) < g_szKnives[ Key ][ g_kPrice ] )
- return ITEM_DISABLED;
- if ( get_user_level( client ) < g_szKnives[ Key ][ g_kLevelNeeded ] -1 )
- return ITEM_DISABLED;
- return ITEM_ENABLED;
- }
- public MenuItemDisable( client, Menu, Item )
- return ITEM_DISABLED;
- /* Bank */
- public CmdBankMenu( client )
- {
- static cash, bank, Menu;
- cash = get_user_cash( client );
- bank = get_user_bank( client );
- formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w Bank System Menu", szPrefix );
- Menu = menu_create( szItem, "SubBankMenu" );
- formatex( szItem, charsmax( szItem ), "%sDeposit\y Cash", (get_user_cash( client )<=0) ? "\d" : "" );
- menu_additem( Menu, szItem );
- formatex( szItem, charsmax( szItem ), "%sWithdraw\y Cash^n", (get_user_bank( client )<=0) ? "\d" : "" );
- menu_additem( Menu, szItem );
- menu_addtext( Menu, "\wAccount\y Bank\w Statement:" );
- 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 );
- menu_addtext( Menu, szItem );
- menu_display( client, Menu );
- return 1;
- }
- public SubBankMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- switch ( Item )
- {
- case 0:
- {
- if ( get_user_cash( client ) <= 0 )
- return CmdBankMenu( client );
- client_cmd( client, "messagemode _deposit" );
- }
- case 1:
- {
- if ( get_user_bank( client ) <= 0 )
- return CmdBankMenu( client );
- client_cmd( client, "messagemode _withdraw" );
- }
- }
- menu_destroy( Menu );
- return 1;
- }
- public CmdDeposit( client )
- {
- static szArgs[ 128 ], Amount;
- read_args( szArgs, charsmax( szArgs ) );
- remove_quotes( szArgs );
- Amount = str_to_num( szArgs );
- if ( !is_str_num( szArgs ) )
- {
- client_cmd( client, "messagemode _deposit" );
- return ColorPrint( client, "Please use valid numbers." );
- }
- if ( Amount > get_user_cash( client ) )
- {
- client_cmd( client, "messagemode _deposit" );
- return ColorPrint( client, "You don't have this amount of cash." );
- }
- if ( Amount < 300 )
- return ColorPrint( client, "You need to deposit a^3 minimum^1 of^4 300^1 cash." );
- set_user_bank( client, get_user_bank( client ) + Amount );
- set_user_cash( client, get_user_cash( client ) - Amount );
- ColorPrint( client, "You made a^3 deposit^1 of^4 %i^1 cash to the bank.", Amount );
- return CmdBankMenu( client );
- }
- public CmdWithdraw( client )
- {
- static szArgs[ 128 ], Amount;
- read_args( szArgs, charsmax( szArgs ) );
- remove_quotes( szArgs );
- Amount = str_to_num( szArgs );
- if ( !is_str_num( szArgs ) )
- {
- client_cmd( client, "messagemode _withdraw" );
- return ColorPrint( client, "Please use valid numbers." );
- }
- if ( Amount > get_user_bank( client ) )
- {
- client_cmd( client, "messagemode _withdraw" );
- return ColorPrint( client, "You don't have this amount of cash in the bank." );
- }
- if ( Amount < 300 )
- return ColorPrint( client, "You need to withdraw a^3 minimum^1 of^4 300^1 cash." );
- static Tax, Amount2;
- Tax = BANK_TAX;
- if ( get_user_flags( client ) && ADMIN_LEVEL_C )
- Tax = BANK_TAX_PREMIUM;
- Amount2 = Amount - (Amount / 100 * Tax);
- set_user_bank( client, get_user_bank( client ) - Amount );
- set_user_cash( client, get_user_cash( client ) + Amount2 );
- 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 );
- return CmdBankMenu( client );
- }
- /* FVault */
- #if defined USE_FVAULT
- stock SaveVaultKey( const index )
- {
- new szKey[ 64 ], szData[ 256 ];
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
- if ( IsValidAuthid( szAuth( index ) ) )
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
- formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
- gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
- fvault_set_data( g_szVault, szKey, szData );
- }
- stock LoadVaultKey( const index )
- {
- new szKey[ 64 ], szData[ 256 ];
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
- if ( IsValidAuthid( szAuth( index ) ) )
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
- formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
- gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
- if ( fvault_get_data( g_szVault, szKey, szData, charsmax( szData ) ) == 1 )
- {
- replace_all( szData, charsmax( szData ), "#", " " );
- static iData[ 6 ][ 32 ];
- parse( szData, iData[ 0 ], 31, iData[ 1 ], 31, iData[ 2 ], 31, iData[ 3 ], 31, iData[ 4 ], 31, iData[ 5 ], 31 );
- gIndex[ index ][ CASH ] = str_to_num( iData[ 0 ] );
- gIndex[ index ][ BANK ] = str_to_num( iData[ 1 ] );
- gIndex[ index ][ KNIFE ] = str_to_num( iData[ 2 ] );
- gIndex[ index ][ gKNIFE ] = str_to_num( iData[ 3 ] );
- gIndex[ index ][ gXP ] = str_to_num( iData[ 4 ] );
- gIndex[ index ][ gLVL ] = str_to_num( iData[ 5 ] );
- }
- else
- {
- gIndex[ index ][ CASH ] = 0;
- gIndex[ index ][ BANK ] = 0;
- gIndex[ index ][ KNIFE ] = 0;
- gIndex[ index ][ gKNIFE ] = 0;
- gIndex[ index ][ gXP ] = 0;
- gIndex[ index ][ gLVL ] = 0;
- }
- }
- #else
- /* NVault */
- stock SaveVaultKey( const index )
- {
- new szKey[ 64 ], szData[ 256 ];
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
- if ( IsValidAuthid( szAuth( index ) ) )
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
- formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
- gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
- nvault_set( g_mVault, szKey, szData );
- }
- stock LoadVaultKey( const index )
- {
- new szKey[ 64 ], szData[ 256 ];
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAddress( index ) );
- if ( IsValidAuthid( szAuth( index ) ) )
- formatex( szKey, charsmax( szKey ), "%s-Shop", szAuth( index ) );
- formatex( szData, charsmax( szData ), "%i#%i#%i#%i#%i#%i",
- gIndex[ index ][ CASH ], gIndex[ index ][ BANK ], gIndex[ index ][ KNIFE ], gIndex[ index ][ gKNIFE ], gIndex[ index ][ gXP ], gIndex[ index ][ gLVL ] );
- nvault_get( g_mVault, szKey, szData, charsmax( szData ) );
- replace_all( szData, charsmax( szData ), "#", " " );
- static iData[ 6 ][ 32 ];
- parse( szData, iData[ 0 ], 31, iData[ 1 ], 31, iData[ 2 ], 31, iData[ 3 ], 31, iData[ 4 ], 31, iData[ 5 ], 31 );
- gIndex[ index ][ CASH ] = str_to_num( iData[ 0 ] );
- gIndex[ index ][ BANK ] = str_to_num( iData[ 1 ] );
- gIndex[ index ][ KNIFE ] = str_to_num( iData[ 2 ] );
- gIndex[ index ][ gKNIFE ] = str_to_num( iData[ 3 ] );
- gIndex[ index ][ gXP ] = str_to_num( iData[ 4 ] );
- gIndex[ index ][ gLVL ] = str_to_num( iData[ 5 ] );
- }
- #endif
- /* Stocks */
- stock ColorPrint( const index, const string[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "%s^1 ", szChatPrefix );
- vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
- if ( index )
- Players[ 0 ] = index;
- else
- get_players( Players, PNum, "ch" );
- for ( new i; i < PNum; i++ )
- {
- if( is_user_connected( Players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
- write_byte( Players[ i ] );
- write_string( szMsg );
- message_end( );
- }
- }
- return 1;
- }
- stock get_user_xp( const index )
- return gIndex[ index ][ gXP ];
- stock set_user_xp( const index, XP )
- {
- if ( !is_user_connected( index ) )
- return -1;
- if ( XP < 0 )
- XP = 0;
- gIndex[ index ][ gXP ] = XP;
- CheckLevel( index );
- SaveVaultKey( index );
- return 1;
- }
- stock get_user_level( const index )
- return gIndex[ index ][ gLVL ];
- stock set_user_level( const index, LVL )
- {
- if ( !is_user_connected( index ) )
- return -1;
- if ( LVL < 0 )
- LVL = 0;
- gIndex[ index ][ gLVL ] = LVL;
- SaveVaultKey( index );
- return 1;
- }
- stock CheckLevel( const index )
- {
- if ( get_user_level( index ) +1 >= sizeof gXPLevels )
- return 1;
- while ( get_user_xp( index ) >= gXPLevels[ get_user_level( index ) ] )
- {
- set_user_level( index, get_user_level( index ) + 1 );
- ColorPrint( index, "Congratulation! You are now at level^4 %i^1!", get_user_level( index ) + 1 );
- ColorPrint( 0, "^3%s^1 is now on level^4 %i^1!,^3 Congratulation!", szName( index ), get_user_level( index ) + 1 );
- break;
- }
- return 1;
- }
- stock get_user_cash( const index )
- return gIndex[ index ][ CASH ];
- stock set_user_cash( const index, Cash )
- {
- if ( !is_user_connected( index ) )
- return 1;
- if ( Cash < 0 )
- Cash = 0;
- gIndex[ index ][ CASH ] = Cash;
- cs_set_user_money( index, Cash );
- SaveVaultKey( index );
- return 1;
- }
- stock get_user_bank( const index )
- return gIndex[ index ][ BANK ];
- stock set_user_bank( const index, Cash )
- {
- if ( !is_user_connected( index ) )
- return 1;
- if ( Cash < 0 )
- Cash = 0;
- gIndex[ index ][ BANK ] = Cash;
- SaveVaultKey( index );
- return 1;
- }
- stock szName( const index )
- {
- static g_szName[ 32 ];
- get_user_name( index, g_szName, charsmax( g_szName ) );
- return g_szName;
- }
- stock szAuth( const index )
- {
- static g_szAuthID[ 35 ];
- get_user_authid( index, g_szAuthID, charsmax( g_szAuthID ) );
- return g_szAuthID;
- }
- stock szAddress( const index )
- {
- static g_szAddress[ 32 ];
- get_user_ip( index, g_szAddress, charsmax( g_szAddress ), 1 );
- return g_szAddress;
- }
- stock bool: IsValidAuthid( const szIndexAuth[] )
- return regex_match_c( szIndexAuth, gSteamPattern, gRegexReturn) > 0;
- stock bool: IsValidIP( const szIndexIP[] )
- return regex_match_c( szIndexIP, gIPattern, gRegexReturn ) > 0;
- stock bool: is_user_valid( const index )
- {
- if ( !is_user_alive( index ) )
- return false;
- if ( cs_get_user_team( index ) != CS_TEAM_T )
- return false;
- if ( get_ruuning_day() != -1 )
- return false;
- if ( is_lr_start() )
- return false;
- return true;
- }
- stock get_user_reason( const index )
- {
- static szReason[ 128 ];
- if ( !is_user_alive( index ) )
- formatex( szReason, charsmax( szReason ), "You need to be^3 Alive^1." );
- else if ( cs_get_user_team( index ) != CS_TEAM_T )
- formatex( szReason, charsmax( szReason ), "You need to be a^3 Prisoner^1." );
- else if ( get_ruuning_day( ) != -1 )
- formatex( szReason, charsmax( szReason ), "You can't use the shop in^3 Days^1." );
- else if ( is_lr_start( ) )
- formatex( szReason, charsmax( szReason ), "You can't use the shop in a^3 Last-Request^1." );
- return szReason
- }
- stock HamStripWeapon( const client, const szWeapon[] )
- {
- if ( !equal( szWeapon, "weapon_", 7 ) )
- return 0;
- new WeaponID = get_weaponid( szWeapon );
- if ( !WeaponID )
- return 0;
- new ent;
- while ( ( ent = engfunc( EngFunc_FindEntityByString, ent, "classname", szWeapon ) ) && pev( ent, pev_owner ) != client ) {}
- if ( !ent )
- return 0;
- if ( get_user_weapon( client ) == WeaponID )
- ExecuteHamB( Ham_Weapon_RetireWeapon, ent );
- if ( !ExecuteHamB( Ham_RemovePlayerItem, client, ent ) )
- return 0;
- ExecuteHamB( Ham_Item_Kill, ent );
- set_pev( client, pev_weaponanim, pev( client, pev_weapons ) & ~(1<<WeaponID) );
- return 1;
- }
- stock CountPlayers()
- {
- static Players[ 32 ], iNum;
- get_players( Players, iNum, "ch" );
- return iNum;
- }
- stock CheckAuthOnline( const index )
- {
- static Players[ 32 ], iNum, i, iPlayer;
- get_players( Players, iNum, "ch" );
- for ( i = 0; i < iNum; i++ )
- {
- iPlayer = Players[ i ];
- if ( equali( szAuth( index ), szAuth( iPlayer ) ) || equali( szAddress( index ), szAddress( iPlayer ) ) )
- {
- dc( index );
- break;
- }
- }
- }
- stock dc( const index )
- {
- message_begin( MSG_ONE,SVC_DISCONNECT, { 0, 0, 0 }, index );
- write_string( "There is already a player with the same SteamID or IP Address as yours! Please contect an Admin!" );
- message_end();
- }
- stock get_user_nextcash( const index )
- {
- static Amount;
- Amount = CASH_NEXT;
- Amount += get_user_gang_nextcash( index );
- if ( get_user_flags( index ) && ADMIN_LEVEL_C )
- Amount += 500;
- return Amount;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement