Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Includes */
- #include < amxmodx >
- #include < fakemeta_util >
- #include < fun >
- #include < cstrike >
- #include < hamsandwich >
- #include < dhudmessage >
- /* Defines */
- #define TASKID_COUNTDOWN 1561
- #define TASKID_MSG 1562
- #define TASKID_BEACON 1563
- #define MAX_SOUNDS 9
- new Rambo[ ] = "Top/JB/rambo1.mp3";
- new s4s[ ] = "Top/JB/shot4shot.mp3";
- native StartContest( const index, const player, contest );
- native start_dodgeball( const index, const player );
- native GetUserBalls( const index );
- /* Enums */
- enum _:enWeaponsData
- {
- wName[ 32 ],
- wClass[ 32 ],
- wIndex
- };
- enum _:enComboData
- {
- cmbName[ 32 ],
- cmdIndex
- };
- /* Arrays */
- new Info[ 5 ][ ] =
- {
- "JailBreak Last Request",
- "1.0",
- "Built by Rejack || Edit by @.TheBomB`",
- "Top JailBreak", // Prefix
- "Top Jailbreak" // Chat Prefix
- };
- new szTypes[ ][ ] =
- {
- "Shot 4 Shot",
- "Custom War",
- "Special Duels",
- "Chat Duels",
- "Rambo"
- };
- new LR_SPEARGUN = 2;
- new szWarOptions[ ][ ] =
- {
- "Normal",
- "HP",
- "HS",
- "Gravity"
- };
- new szMusic[ MAX_SOUNDS ][ ] =
- {
- "Top/JB/LR/winsound1.mp3",
- "Top/JB/LR/winsound2.mp3",
- "Top/JB/LR/winsound3.mp3",
- "Top/JB/LR/winsound4.mp3",
- "Top/JB/LR/winsound5.mp3",
- "Top/JB/LR/winsound6.mp3",
- "Top/JB/LR/winsound7.mp3",
- "Top/JB/LR/winsound8.mp3",
- "Top/JB/LR/winsound9.mp3"
- }
- new szS4S[ ][ enWeaponsData ] =
- {
- { "Deagle", "weapon_deagle", CSW_DEAGLE },
- { "Awp", "weapon_awp", CSW_AWP },
- { "Scout", "weapon_scout", CSW_SCOUT },
- { "USP", "weapon_usp", CSW_USP },
- { "Glock 18", "weapon_glock18", CSW_GLOCK18 }
- };
- new szWar[ ][ enWeaponsData ] =
- {
- { "M4A1", "weapon_m4a1", CSW_M4A1 },
- { "AK47", "weapon_ak47", CSW_AK47 },
- { "M249", "weapon_m249", CSW_M249 },
- { "MP5", "weapon_mp5navy", CSW_MP5NAVY },
- { "M3", "weapon_m3", CSW_M3 },
- { "Glock", "weapon_glock18", CSW_GLOCK18 },
- { "USP", "weapon_usp", CSW_USP },
- { "Deagle", "weapon_deagle", CSW_DEAGLE },
- { "Famas", "weapon_famas", CSW_FAMAS },
- { "Galil", "weapon_galil", CSW_GALIL },
- { "Knife", "weapon_knife", CSW_KNIFE },
- { "Awp", "weapon_awp", CSW_AWP },
- { "Grenade", "weapon_hegrenade", CSW_HEGRENADE },
- { "Smoke", "weapon_smokegrenade", CSW_SMOKEGRENADE },
- { "Xm 1014", "weapon_xm1014", CSW_XM1014 },
- { "Scout", "weapon_scout", CSW_SCOUT },
- { "UMP 45", "weapon_ump45", CSW_UMP45}
- };
- new szFun[ ][ ] =
- {
- "Shark",
- "Drop Bomb",
- "Drop Deagle",
- "Shot The Bomb",
- "Survival",
- "Invisible",
- "Spray",
- "Hide'N'Seek",
- "Strip Weapon",
- "Combo",
- "Drop Bomb [\rNo Pool\w]",
- "Dodgeball",
- "Deagle Power",
- "Power Grenade",
- "Spear Gun",
- "Tactical Knifes",
- "Pumpkin",
- "Cannon"
- };
- new const szContests[ ][ ] =
- {
- "First Write",
- "Translate",
- "Missing Letter",
- "Mathematics",
- "Type Race"
- };
- new g_szCombo[ ] = { IN_ATTACK, IN_ATTACK2, IN_BACK, IN_FORWARD, IN_MOVELEFT, IN_MOVERIGHT, IN_JUMP, IN_DUCK, IN_RELOAD, IN_USE, IN_SCORE };
- new szCombo[ ][ ] = { "Attack", "Attack2", "Back", "Forward", "Left", "Right", "Jump", "Duck", "Reload", "Use", "Score" };
- new const szGuns[][] =
- {
- "events/awp.sc",
- "events/g3sg1.sc",
- "events/ak47.sc",
- "events/scout.sc",
- "events/m249.sc",
- "events/m4a1.sc",
- "events/sg552.sc",
- "events/aug.sc",
- "events/sg550.sc",
- "events/m3.sc",
- "events/xm1014.sc",
- "events/usp.sc",
- "events/mac10.sc",
- "events/ump45.sc",
- "events/fiveseven.sc",
- "events/p90.sc",
- "events/deagle.sc",
- "events/p228.sc",
- "events/glock18.sc",
- "events/mp5n.sc",
- "events/tmp.sc",
- "events/elite_left.sc",
- "events/elite_right.sc",
- "events/galil.sc",
- "events/famas.sc"
- };
- new TheStriped, TheStriper;
- native is_after_lr()
- native is_player_premium( index );
- native give_speargun( index );
- native remove_speargun( index );
- native give_tactical( index );
- native remove_tactical( index );
- native give_pumpkin__( index );
- native remove_pumpkin__( index );
- native get_cannon( index );
- native remove_cannon( index );
- new szItem[ 128 ];
- new bool: bActive, bool: bShot, bool: bPlayer[ 33 ], bool: bTurn[ 33 ], bool: bMsg[ 33 ], bool: bCombo, bool: bPressed, bool: bPowerDeagle;
- new g_iMaxPlayers, g_iTimer, g_iCount, iType, iWar, iDuel, g_iCombo[ 11 ], iCombo[ 33 ], beaconSprite, g_iBit, g_iForward, g_max_clients;
- new Float: fCombo[ 33 ];
- new bool:TakeBox;
- new LR_PREMIUM = 5;
- public plugin_init()
- {
- register_plugin( Info[ 0 ], Info[ 1 ], Info[ 2 ] );
- register_saycmd( "lr", "CmdMenu" );
- register_saycmd( "infomsg", "CmdInfoMsg" );
- register_event( "DeathMsg", "evDeathMsg", "a" );
- register_logevent( "evRoundStart", 2, "1=Round_Start" );
- register_forward( FM_PlaybackEvent, "FwdPlaybackEvent" );
- register_forward( FM_PlayerPreThink, "FwdPreThink" );
- register_forward( FM_SetModel, "FwdSetModel" );
- register_forward( FM_Voice_SetClientListening, "FwdVoiceSetClientListening" );
- unregister_forward( FM_PrecacheEvent, g_iForward, 1 );
- RegisterHam( Ham_TakeDamage, "player", "FwdTakeDamage", 0 );
- g_iMaxPlayers = get_maxplayers();
- g_max_clients = global_get( glb_maxClients );
- }
- public FwdUseButton()
- {
- if ( !bActive )
- return 1;
- return 4;
- }
- public plugin_precache()
- {
- beaconSprite = precache_model( "sprites/white.spr" );
- precache_sound( Rambo );
- precache_sound( s4s );
- g_iForward = register_forward( FM_PrecacheEvent, "FwdPrecacheEvent", 1 );
- for ( new i; i < MAX_SOUNDS; i++ )
- precache_sound( szMusic[ i ] );
- }
- public plugin_natives()
- {
- register_library( "LastRequest" );
- register_native( "is_user_lr", "native_is_user_lr" );
- register_native( "is_lr_start", "native_is_lr_satrt" );
- register_native( "is_lr_active", "native_is_lr_satrt" );
- register_native( "stop_lr", "native_stop_lr" );
- register_native( "is_lr_dodgeball", "native_is_lr_dodgeball" );
- register_native( "get_user_bmsg", "_get_user_bmsg" );
- register_native( "is_after_lr", "_is_after_lr" );
- }
- public bool: native_is_lr_satrt()
- return bActive;
- public _is_after_lr(plugin,params)
- return TakeBox;
- public native_stop_lr()
- StopRequest( ( get_param( 1 ) == 0 ) ? false : true );
- public bool: native_is_user_lr( plugin, params )
- return bPlayer[ get_param( 1 ) ];
- public _get_user_bmsg( plugin, params )
- {
- return bMsg[ get_param( 1 ) ];
- }
- public bool: native_is_lr_dodgeball( plugin, params )
- return (iType==2&&iDuel==11) ? true : false;
- /* Others */
- public CmdInfoMsg( client )
- {
- bMsg[ client ] = !bMsg[ client ];
- ColorPrint( client, "You^4 %s^3 Info Message^1!", bMsg[ client ] ? "Disabled" : "Enabled" );
- return 1;
- }
- public client_putinserver( client )
- {
- bPlayer[ client ] = false;
- bTurn[ client ] = false;
- }
- public client_disconnect( client )
- {
- if ( bPlayer[ client ] && bActive && iType != 3 )
- {
- StopRequest();
- ColorPrint( 0, "The^3 Last Request^1 was stopped because^4 %s^1 left the game.", szName( client ) );
- }
- }
- /* Menu */
- public CmdMenu( client )
- {
- if ( !is_user_valid( client ) )
- return ColorPrint( client, GetReason( client ) );
- formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w Last Request", Info[ 3 ] );
- new Menu = menu_create( szItem, "SubMenu" );
- for ( new i; i < sizeof szTypes - 1; i++ )
- AddItem( Menu, "%s %s", szTypes[ i ], (i==3) ? "^n":"" );
- menu_additem( Menu, "\yRambo" );
- menu_addblank( Menu, 0 );
- menu_display( client, Menu );
- return 1;
- }
- public SubMenu( client, Menu, Item )
- {
- if ( !is_user_valid( client ) )
- return ColorPrint( client, GetReason( client ) );
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- new iMenu;
- if ( Item != 1 )
- {
- formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w %s Duels", Info[ 3 ], szTypes[ Item ] );
- iMenu = menu_create( szItem, "SubDuels" );
- }
- iType = Item;
- switch ( Item )
- {
- case 0:
- {
- for ( new i; i < sizeof szS4S; i++ )
- menu_additem( iMenu, szS4S[ i ] );
- }
- case 1:
- {
- CmdWar( client );
- return 1;
- }
- case 2:
- {
- for ( new i; i < sizeof szFun; i++ )
- menu_additem( iMenu, szFun[ i ] );
- }
- case 3:
- {
- for ( new i; i < sizeof szContests; i++ )
- menu_additem( iMenu, szContests[ i ] );
- }
- case 4: // Rambo
- {
- StopRequest();
- iType = 4;
- bPlayer[ client ] = true;
- bActive = true;
- fm_strip_user_weapons( client );
- fm_give_item( client, "weapon_m249" );
- cs_set_user_bpammo( client, CSW_M249, 9999 );
- fm_set_user_health( client, TeamCount( "CT" ) * 500 );
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_alive( i ) || !is_user_connected( i ) || cs_get_user_team( i ) != CS_TEAM_CT )
- continue;
- fm_strip_user_weapons( i );
- fm_give_item( i, "weapon_m4a1" );
- fm_give_item( i, "weapon_deagle" );
- fm_give_item( i, "weapon_knife" );
- cs_set_user_bpammo( i, CSW_M4A1, 120 );
- cs_set_user_bpammo( i, CSW_DEAGLE, 70 );
- fm_set_user_health( i, 100 );
- }
- CmdMsg();
- ColorPrint( 0, "^3%s^1 started^4 Rambo^1!", szName( client ) );
- client_cmd( 0, "; mp3 play ^"sound/%s", Rambo );
- fn_Cells()
- return 1;
- }
- }
- menu_display( client, iMenu );
- menu_destroy( Menu );
- return 1;
- }
- public CmdWar( client )
- {
- if ( !is_user_valid( client ) )
- return ColorPrint( client, GetReason( client ) );
- formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w War Duels", Info[ 3 ] );
- new Menu = menu_create( szItem, "SubWar" );
- AddItem( Menu, "Game Mode:\r %s", szWarOptions[ iWar ] );
- for ( new i; i < sizeof szWar; i++ )
- {
- if ( iWar == 2 && i == charsmax( szWar ) )
- break;
- menu_additem( Menu, szWar[ i ] )
- }
- menu_display( client, Menu );
- return 1;
- }
- public SubWar( client, Menu, Item )
- {
- if ( !is_user_valid( client ) )
- return ColorPrint( client, GetReason( client ) );
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- if ( Item == 0 )
- {
- if ( iWar == 3 )
- iWar = -1;
- iWar++;
- CmdWar( client );
- return 1;
- }
- iDuel = Item - 1;
- menu_destroy( Menu );
- CmdPlayers( client );
- return 1;
- }
- public SubDuels( client, Menu, Item )
- {
- if ( !is_user_valid( client ) )
- return ColorPrint( client, GetReason( client ) );
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- iDuel = Item;
- menu_destroy( Menu );
- CmdPlayers( client );
- return 1;
- }
- public CmdPlayers( client )
- {
- if ( !is_user_valid( client ) )
- return ColorPrint( client, GetReason( client ) );
- formatex( szItem, charsmax( szItem ), "\r[\w%s\r]\w Select a Player\d:^n^nDuel:\y %s", Info[ 3 ], GetDuel() );
- new Menu = menu_create( szItem, "SubPlayers" );
- new Players[ 32 ], iNum, szTempid[ 10 ], iPlayer;
- get_players( Players, iNum, "aceh", "CT" );
- for ( new i; i < iNum; i++ )
- {
- iPlayer = Players[ i ];
- num_to_str( iPlayer, szTempid, charsmax( szTempid ) );
- menu_additem( Menu, szName( iPlayer ), szTempid );
- }
- menu_display( client, Menu );
- return 1;
- }
- public SubPlayers( client, Menu, Item )
- {
- if ( !is_user_valid( client ) )
- return ColorPrint( client, GetReason( client ) );
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- new Trash, mData[ 6 ];
- menu_item_getinfo( Menu, Item, Trash, mData, charsmax( mData ), _,_, Trash );
- new iPlayer = str_to_num( mData );
- if ( cs_get_user_team( iPlayer ) != CS_TEAM_CT || !is_user_alive( iPlayer ) || !is_user_connected( iPlayer ) )
- return ColorPrint( client, "This player is no longer valid." );
- StopRequest( true );
- bPlayer[ client ] = true;
- bPlayer[ iPlayer ] = true;
- StartGames( client, iPlayer );
- return 1;
- }
- /* Forwards */
- public FwdTakeDamage( victim, inf, attacker, Float:damage, damagebits )
- {
- if ( !is_user_connected( victim ) || !is_user_alive( victim ) || !is_user_connected( attacker ) || !is_user_alive( attacker ) )
- return 1;
- if ( attacker == victim || !bPowerDeagle || !bPlayer[ attacker ] || !bPlayer[ victim ] )
- return 1;
- static g_mWeapon;
- g_mWeapon = get_user_weapon( attacker );
- if ( g_mWeapon == CSW_DEAGLE || g_mWeapon == CSW_HEGRENADE )
- {
- new Float:iOrigin[ 3 ], Float:Vec[ 3 ];
- get_velocity( victim, iOrigin, 1500.0, Vec );
- Vec[ 2 ] = 300.0;
- set_pev( victim, pev_velocity, Vec );
- }
- return 1;
- }
- public FwdPreThink( client )
- {
- if ( !bPressed && TeamCount( "TERRORIST" ) == 1 && TeamCount( "CT" ) > 0 )
- {
- bPressed = true;
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_connected( i ) || !is_user_alive( i ) || cs_get_user_team( i ) != CS_TEAM_T )
- continue;
- client_cmd( i, "say /lr" );
- break;
- }
- return 1;
- }
- if ( !bActive || !bPlayer[ client ] || !bCombo || !is_user_alive( client ) || !is_user_connected( client ) )
- return 1;
- new button = fm_get_user_button( client );
- new oldbutton = fm_get_user_oldbutton( client );
- new pressed = button & ~oldbutton;
- if ( pressed & g_szCombo[ g_iCombo[ iCombo[ client ] ] ] )
- {
- iCombo[ client ]++;
- ColorPrint( client, "You pressed the^4 right^1 key! ^3[^4 Combo Status:^1 %i/10 ^3]", iCombo[ client ] );
- fCombo[ client ] = get_gametime();
- if ( iCombo[ client ] == 10 )
- {
- bCombo = false;
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_alive( i ) || !is_user_connected( i ) || !bPlayer[ i ] )
- continue;
- if ( cs_get_user_team( client ) == CS_TEAM_CT && cs_get_user_team( i ) == CS_TEAM_T
- || cs_get_user_team( client ) == CS_TEAM_T && cs_get_user_team( i ) == CS_TEAM_CT )
- set_pev( i, pev_flags, pev( i, pev_flags) | FL_FROZEN );
- }
- fm_give_item( client, "weapon_m4a1" );
- cs_set_user_bpammo( client, CSW_M4A1, 120 );
- return 1;
- }
- return 1;
- }
- if ( fCombo[ client ] + 1 < get_gametime() )
- {
- fCombo[ client ] = get_gametime();
- iCombo[ client ] = 0;
- return 1;
- }
- if ( pressed )
- {
- iCombo[ client ] = 0;
- ColorPrint( client, "Wrong key! you^4 failed^1!^3 try again^1!" );
- }
- return 1;
- }
- public FwdPrecacheEvent( type, const name[] )
- {
- for ( new i = 0; i < sizeof szGuns; ++i )
- {
- if ( equal( szGuns[ i ], name ) )
- {
- g_iBit |= (1<<get_orig_retval());
- return 2;
- }
- }
- return 1;
- }
- public FwdPlaybackEvent( iFlags, client, iEvent )
- {
- if ( !( g_iBit & (1<<iEvent) ) || !(1<=client<=g_max_clients) )
- return 2;
- if ( bActive && bPlayer[ client ] && bShot )
- {
- if ( !bTurn[ client ] )
- return 4;
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_alive( i ) || !is_user_connected( i ) || !bPlayer[ i ] || bTurn[ i ] )
- continue;
- if ( i == client )
- continue;
- bTurn[ i ] = true;
- cs_set_weapon_ammo( fm_find_ent_by_owner( 1, szS4S[ iDuel ][ wClass ], i ), 1 );
- }
- bTurn[ client ] = false;
- cs_set_weapon_ammo( fm_find_ent_by_owner( 1, szS4S[ iDuel ][ wClass ], client ), 0 );
- }
- return 2;
- }
- public FwdSetModel( ent )
- {
- if ( !bActive )
- return 1;
- if ( !pev_valid( ent ) )
- return 1;
- if ( iDuel == 1 || iDuel == 2 || iDuel == 3 || iDuel == 10 )
- {
- static client; client = pev( ent,pev_owner );
- if ( !( 1 <= client <= g_max_clients ) )
- return 1;
- switch( get_user_team( client ) )
- {
- case 1: fm_set_rendering( ent, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 1 );
- case 2: fm_set_rendering( ent, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 1 );
- }
- }
- return 1;
- }
- public FwdVoiceSetClientListening( Rec, Sender, bool:bListen )
- {
- if ( !is_user_connected( Sender ) || !is_user_connected( Rec ) || get_user_flags( Sender ) & ADMIN_BAN
- || cs_get_user_team( Sender ) == CS_TEAM_CT && is_user_alive( Sender )
- || cs_get_user_team( Sender ) == CS_TEAM_T && is_user_alive( Sender ) && TeamCount( "TERRORIST" ) == 1 )
- return 1;
- engfunc( EngFunc_SetClientListening, Rec, Sender, 0 );
- return 4;
- }
- /* Beacon */
- public CmdBeacon( const client )
- {
- if ( !bActive || !bPlayer[ client ] )
- return 1;
- static CsTeams: iTeam;
- iTeam = cs_get_user_team( client );
- static iOrigin[ 3 ];
- get_user_origin( client, iOrigin );
- 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]+200); // z axis
- write_short( beaconSprite ); // sprite
- write_byte(0); // startframe
- write_byte(1); // framerate
- write_byte(5); // life
- write_byte(5); // width
- write_byte(1); // noise
- write_byte( (iTeam==CS_TEAM_CT) ? 0 : 255 ); // red
- write_byte( 0 ); // green
- write_byte( (iTeam==CS_TEAM_CT) ? 255 : 0 ); // blue
- write_byte(255); // brightness
- write_byte(0); // speed
- message_end();
- set_task( 1.5, "CmdBeacon", client );
- return 1;
- }
- /* Events */
- public evCountdown()
- {
- if ( g_iTimer <= 0 )
- {
- if ( iDuel == 9 )
- {
- bCombo = true;
- ComboMsg();
- return 1;
- }
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_connected( i ) || !is_user_alive( i ) || !bPlayer[ i ] || cs_get_user_team( i ) != CS_TEAM_T )
- continue;
- set_pev( i, pev_flags, pev( i, pev_flags ) & ~FL_FROZEN );
- }
- g_iCount = 10;
- evCount();
- return 1;
- }
- new Vox[ 32 ];num_to_word( g_iTimer, Vox, charsmax( Vox ) );
- client_cmd( 0, "spk ^"vox/%s^"", Vox, (g_iTimer > 1) ? "s" : "" );
- set_hudmessage( 255, 0, 0, -1.0, 0.35, 1, 6.0, 1.0, 0.1, 0.1, -1 );
- show_hudmessage( 0, "%s will start in %i Seconds!", GetDuel(), g_iTimer );
- g_iTimer--;
- set_task( 1.0, "evCountdown", TASKID_COUNTDOWN );
- return 1;
- }
- public evCount()
- {
- if ( g_iCount <= 0 )
- {
- if ( iType == 2 )
- {
- {
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_connected( i ) || !is_user_alive( i ) || !bPlayer[ i ] )
- continue;
- if ( iDuel == 7 )
- {
- if ( cs_get_user_team( i ) == CS_TEAM_CT )
- fm_set_user_godmode( i, 0 );
- if ( cs_get_user_team( i ) == CS_TEAM_T )
- {
- fm_give_item( i, "weapon_m4a1" );
- cs_set_user_bpammo( i, CSW_M4A1, 999 );
- }
- }
- if ( iDuel == 8 )
- {
- if ( cs_get_user_team( i ) == CS_TEAM_CT )
- {
- fm_give_item( i, "weapon_m4a1" );
- cs_set_user_bpammo( i, CSW_M4A1, 999 );
- }
- }
- }
- }
- }
- return 1;
- }
- //set_hudmessage( 0, 130, 255, -1.0, -1.0, 1, 6.0, 1.0, 0.1, 0.1, -1 );
- //show_hudmessage( 0, "%i", g_iCount );
- set_hudmessage
- g_iCount--;
- set_task( 1.0, "evCount", TASKID_COUNTDOWN );
- return 1;
- }
- public evRoundStart()
- {
- StopRequest();
- }
- public evDeathMsg()
- {
- if ( !bActive )
- return 0;
- new attacker = read_data( 1 );
- new victim = read_data( 2 );
- if ( !is_user_connected( attacker ) || !is_user_connected( victim ) || !bPlayer[ attacker ] || !bPlayer[ victim ] )
- return 0;
- if ( attacker != victim )
- {
- client_cmd( 0, "; mp3 play ^"sound/%s", szMusic[ random( MAX_SOUNDS ) ] );
- client_cmd(attacker,"dsdance")
- ColorPrint( 0, "^3%s^1 won the^4 %s^1 against^3 %s^1!", szName( attacker ), GetDuel(), szName( victim ) );
- TakeBox = true
- set_task(10.0, "DontTake")
- }
- if( iType == LR_PREMIUM && iDuel == LR_SPEARGUN )
- remove_speargun( attacker );
- bPlayer[ attacker ] = bPlayer[ victim ] = false;
- StopRequest();
- return 0;
- }
- public DontTake()
- {
- TakeBox = false
- }
- stock StopRequest( bool: bReset = false )
- {
- bActive = false;
- bShot = false;
- bCombo = false;
- bPressed = false;
- bPowerDeagle = false;
- if ( !bReset )
- iDuel = iType = iWar = 0;
- remove_task( TASKID_COUNTDOWN );
- remove_task( 19234 )
- remove_task( TASKID_MSG );
- remove_task( TASKID_BEACON );
- set_user_hitzones( 0, 0, 255 );
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_connected( i ) || !is_user_alive( i ) )
- continue;
- bPlayer[ i ] = false;
- bTurn[ i ] = false;
- fm_set_user_gravity( i, 1.0 );
- fm_set_user_noclip( i, 0 );
- fm_set_user_rendering( i );
- fm_set_user_godmode( i, 0 );
- }
- }
- /* Messages */
- public CmdMsg()
- {
- if ( !bActive )
- return 1;
- new Players[ 32 ], iNum, szMsg[ 512 ], szText[ 128 ];
- get_players( Players, iNum );
- formatex( szMsg, charsmax( szMsg ), "^nTop Jailbreak | Last Request^n^nDuel: %s", GetDuel() );
- AddLines( szMsg, charsmax( szMsg ) );
- for ( new i; i < iNum; i++ )
- {
- new iPlayer = Players[ i ];
- if ( bPlayer[ iPlayer ] )
- {
- formatex( szText, charsmax( szText ), "%s: %s | %i Health^n", (cs_get_user_team( iPlayer )==CS_TEAM_CT) ? "Guard" : "Prisoner", szName( iPlayer ), get_user_health( iPlayer ), GetUserBalls( iPlayer ) );
- if ( iType == 2 && iDuel == 11 ) /* Dodgeball */
- formatex( szText, charsmax( szText ), "^%s: %s | %i Health | Balls Threw: %i^n", (cs_get_user_team( iPlayer )==CS_TEAM_CT) ? "Guard" : "Prisoner", szName( iPlayer ), get_user_health( iPlayer ), GetUserBalls( iPlayer ) );
- add( szMsg, charsmax( szMsg ), szText );
- }
- }
- add( szMsg, charsmax( szMsg ), "^n^nTo disable this message type /infomsg ." );
- ShowMsg( szMsg );
- set_task( 0.3, "CmdMsg", TASKID_MSG );
- return 1;
- }
- public ComboMsg()
- {
- if ( !bCombo || !bActive )
- return 1;
- new Players[ 32 ], iNum, iPlayer, szMsg[ 512 ], szText[ 192 ];
- get_players( Players, iNum );
- set_hudmessage( 0, 130, 255, 0.08, 0.12, 1, 0.1, 0.3, 0.1, 0.1 );
- formatex( szMsg, charsmax( szMsg ), "%s Last Request^n%s^n", Info[ 3 ], GetDuel() );
- AddLines( szMsg, charsmax( szMsg ) );
- AddPlayers( szMsg, charsmax( szMsg ), szText, charsmax( szText ) );
- add( szMsg, charsmax( szMsg ), "^n^nTo disable this message type /infomsg ." );
- for ( new i; i < iNum; i++ )
- {
- iPlayer = Players[ i ];
- if ( bMsg[ iPlayer ] )
- continue;
- set_hudmessage( 0, 130, 255, -1.0, 0.23, 1, 0.1, 0.3, 0.1, 0.1 );
- show_hudmessage( iPlayer, "^n%s%s%s^n%s%s%s^n%s%s%s^n%s%s%s^n%s%s%s^n%s%s%s^n%s%s%s^n%s%s%s^n%s%s%s^n%s%s%s^n",
- (iCombo[ iPlayer ]==0) ? ">>" : "", szCombo[ g_iCombo[ 0 ] ], (iCombo[ iPlayer ]==0) ? "<<" : "",
- (iCombo[ iPlayer ]==1) ? ">>" : "", szCombo[ g_iCombo[ 1 ] ], (iCombo[ iPlayer ]==1) ? "<<" : "",
- (iCombo[ iPlayer ]==2) ? ">>" : "", szCombo[ g_iCombo[ 2 ] ], (iCombo[ iPlayer ]==2) ? "<<" : "",
- (iCombo[ iPlayer ]==3) ? ">>" : "", szCombo[ g_iCombo[ 3 ] ], (iCombo[ iPlayer ]==3) ? "<<" : "",
- (iCombo[ iPlayer ]==4) ? ">>" : "", szCombo[ g_iCombo[ 4 ] ], (iCombo[ iPlayer ]==4) ? "<<" : "",
- (iCombo[ iPlayer ]==5) ? ">>" : "", szCombo[ g_iCombo[ 5 ] ], (iCombo[ iPlayer ]==5) ? "<<" : "",
- (iCombo[ iPlayer ]==6) ? ">>" : "", szCombo[ g_iCombo[ 6 ] ], (iCombo[ iPlayer ]==6) ? "<<" : "",
- (iCombo[ iPlayer ]==7) ? ">>" : "", szCombo[ g_iCombo[ 7 ] ], (iCombo[ iPlayer ]==7) ? "<<" : "",
- (iCombo[ iPlayer ]==8) ? ">>" : "", szCombo[ g_iCombo[ 8 ] ], (iCombo[ iPlayer ]==8) ? "<<" : "",
- (iCombo[ iPlayer ]==9) ? ">>" : "", szCombo[ g_iCombo[ 9 ] ], (iCombo[ iPlayer ]==9) ? "<<" : "" );
- add( szMsg, charsmax( szMsg ), szText );
- }
- set_task( 0.2, "ComboMsg", TASKID_MSG );
- return 1;
- }
- stock ShowMsg( szMsg[] )
- {
- new Players[ 32 ], iNum, iPlayer;
- get_players( Players, iNum, "ch" );
- set_hudmessage( 0, 130, 255, 0.04, 0.19, 0, 6.0, 0.2, 0.1, 0.1, -1 );
- for ( new i; i < iNum; i++ )
- {
- iPlayer = Players[ i ];
- if ( bMsg[ iPlayer ] )
- continue;
- show_hudmessage( iPlayer, szMsg );
- }
- }
- /* Stocks */
- stock StartGames( const client, const iPlayer )
- {
- new Item = iDuel;
- bActive = true;
- fm_strip_user_weapons( client );
- fm_strip_user_weapons( iPlayer );
- SetHealth( client, iPlayer, 100 );
- g_iTimer = 5;
- CmdBeacon( client );
- CmdBeacon( iPlayer );
- switch ( iType )
- {
- case 0: // Shot 4 Shot
- {
- client_cmd( 0, "; mp3 play ^"sound/%s", s4s );
- bShot = true;
- bTurn[ client ] = true;
- bTurn[ iPlayer ] = false;
- fm_give_item( client, szS4S[ Item ][ wClass ] );
- fm_give_item( iPlayer, szS4S[ Item ][ wClass ] );
- cs_set_weapon_ammo( fm_find_ent_by_owner( 1, szS4S[ Item ][ wClass ], client ), 1 );
- cs_set_weapon_ammo( fm_find_ent_by_owner( 1, szS4S[ Item ][ wClass ], iPlayer ), 0 );
- }
- case 1: // War
- {
- switch ( iWar )
- {
- case 1: SetHealth( client, iPlayer, 1500 );
- case 2:
- {
- set_user_hitzones( 0, 0, 2 );
- SetHealth( client, iPlayer, 1000 );
- }
- case 3: fm_set_user_gravity( client, 0.5 ), fm_set_user_gravity( iPlayer, 0.5 ), SetHealth( client, iPlayer, 750 );
- }
- if ( szWar[ Item ][ wIndex ] == CSW_KNIFE )
- {
- fm_give_item( client, "weapon_knife" );
- fm_give_item( iPlayer, "weapon_knife" );
- }
- else GiveWeapons( client, iPlayer, szWar[ Item ][ wClass ], szWar[ Item ][ wIndex ] );
- }
- case 2: // Fun
- {
- switch ( Item )
- {
- case 0: // Kill the Noclip Man
- {
- fm_give_item( client, "weapon_deagle" );
- cs_set_user_bpammo( client, CSW_DEAGLE, 999 );
- fm_give_item( iPlayer, "weapon_knife" );
- fm_set_user_noclip( iPlayer, 1 );
- }
- case 1, 10: // Bomb Toss && Spray the Bomb Contest
- {
- GiveWeapons( client, iPlayer, "weapon_c4", CSW_C4 );
- fm_give_item( client, "weapon_knife" );
- fm_give_item( iPlayer, "weapon_knife" );
- }
- case 2: // Gun Toss
- {
- fm_give_item( client, "weapon_deagle" );
- fm_give_item( iPlayer, "weapon_deagle" );
- cs_set_weapon_ammo( fm_find_ent_by_owner( 1, "weapon_deagle", client ), 0 );
- cs_set_weapon_ammo( fm_find_ent_by_owner( 1, "weapon_deagle", iPlayer ), 0 );
- fm_give_item( client, "weapon_knife" );
- fm_give_item( iPlayer, "weapon_knife" );
- }
- case 3: // Away the Bomb
- {
- GiveWeapons( client, iPlayer, "weapon_deagle", CSW_DEAGLE );
- GiveWeapons( client, iPlayer, "weapon_c4", CSW_C4 );
- }
- case 4: // Survival Duel
- {
- SetHealth( client, iPlayer, 100, 5000 );
- fm_give_item( client, "weapon_m4a1" );
- cs_set_user_bpammo( client, CSW_M4A1, 999 );
- fm_give_item( iPlayer, "weapon_knife" );
- }
- case 5: // Invisible Duel
- {
- fm_set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 16 );
- fm_set_user_rendering( iPlayer, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 16 );
- GiveWeapons( client, iPlayer, "weapon_m4a1", CSW_M4A1 );
- SetHealth( client, iPlayer, 500 );
- remove_task( TASKID_BEACON );
- }
- case 6: // Spray Contest
- {
- fm_give_item( client, "weapon_knife" );
- fm_give_item( iPlayer, "weapon_knife" );
- }
- case 7: // Hide'N'Seek Duel
- {
- fm_set_user_rendering( client, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 16 );
- fm_give_item( iPlayer, "weapon_knife" );
- fm_set_user_godmode( iPlayer, 1 );
- g_iCount = 60;
- evCount();
- }
- case 8: // Strip Duel
- {
- fm_strip_user_weapons( client );
- fm_strip_user_weapons( iPlayer );
- evCountdown();
- TheStriper = cs_get_user_team( client ) == CS_TEAM_T ? client : iPlayer;
- TheStriped = cs_get_user_team( client ) != CS_TEAM_T ? client : iPlayer;
- if( cs_get_user_team( client ) == CS_TEAM_T )
- {
- fm_give_item( client, "weapon_m4a1" );
- cs_set_user_bpammo( client, CSW_M4A1, 9999 );
- fm_set_user_health( iPlayer, 1000 );
- }
- else
- {
- fm_give_item( iPlayer, "weapon_m4a1" );
- cs_set_user_bpammo( iPlayer, CSW_M4A1, 9999 );
- fm_set_user_health( iPlayer, 1000 );
- }
- g_iCount = 10;
- set_task( 1.0, "StripCountdown", 19234, _,_, "b" );
- fm_set_user_health( client, 1000 );
- fm_set_user_health( iPlayer, 1000 );
- }
- case 9: // Combo Contest
- {
- for ( new i; i < 10; i++ )
- g_iCombo[ i ] = random( sizeof g_szCombo );
- iCombo[ client ] = 0;
- iCombo[ iPlayer ] = 0;
- g_iTimer = 5;
- evCountdown();
- return 1;
- }
- case 11: // Dodgeball
- start_dodgeball( client, iPlayer );
- case 12: // Deagle Power
- {
- bPowerDeagle = true;
- fm_give_item( client, "weapon_deagle" );
- fm_give_item( iPlayer, "weapon_deagle" );
- cs_set_user_bpammo( client, CSW_DEAGLE, 9999 );
- cs_set_user_bpammo( iPlayer, CSW_DEAGLE, 9999 );
- fm_set_user_health( client, 750 );
- fm_set_user_health( iPlayer, 750 );
- }
- case 13: // Grenade Power
- {
- bPowerDeagle = true;
- fm_give_item( client, "weapon_hegrenade" );
- fm_give_item( iPlayer, "weapon_hegrenade" );
- cs_set_user_bpammo( client, CSW_HEGRENADE, 9999 );
- cs_set_user_bpammo( iPlayer, CSW_HEGRENADE, 9999 );
- fm_set_user_health( client, 750 );
- fm_set_user_health( iPlayer, 750 );
- }
- case 14: // SpearGun
- {
- fm_set_user_health( client, 1500 );
- fm_set_user_health( iPlayer, 1500 );
- g_iTimer = 5;
- evCountdown();
- give_speargun( client );
- give_speargun( iPlayer );
- }
- case 15:
- {
- fm_set_user_health( client, 1500 );
- fm_set_user_health( iPlayer, 1500 );
- g_iTimer = 5;
- evCountdown();
- give_tactical( client );
- give_tactical( iPlayer );
- }
- case 16:
- {
- fm_set_user_health( client, 1500 );
- fm_set_user_health( iPlayer, 1500 );
- g_iTimer = 5;
- evCountdown();
- give_pumpkin__( client );
- give_pumpkin__( iPlayer );
- }
- case 17:
- {
- fm_set_user_health( client, 1500 );
- fm_set_user_health( iPlayer, 1500 );
- g_iTimer = 5;
- evCountdown();
- get_cannon( client );
- get_cannon( iPlayer );
- }
- }
- }
- case 3:
- {
- StartContest( client, iPlayer, iDuel );
- return 1;
- }
- }
- fn_Cells()
- CmdMsg();
- return 1;
- }
- public fn_Cells()
- {
- static iEnt;
- iEnt = -1;
- while( ( iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", "func_door" ) ) != 0 )
- dllfunc( DLLFunc_Use, iEnt, 0 );
- }
- public StripCountdown()
- {
- if( g_iCount <= 0 )
- {
- new OldStriper, OldStriped;
- OldStriper = TheStriper;
- OldStriped = TheStriped;
- TheStriped = OldStriper;
- TheStriper = OldStriped;
- for ( new i; i < get_maxplayers(); i++ )
- {
- new iPlayer = i;
- if ( bPlayer[ iPlayer ] )
- {
- fm_strip_user_weapons( iPlayer );
- if( i == TheStriper )
- {
- fm_give_item( iPlayer, "weapon_m4a1" );
- cs_set_user_bpammo( iPlayer, CSW_M4A1, 9999 );
- fm_set_user_health( iPlayer, 1000 );
- }
- }
- }
- g_iCount = 10;
- }
- else
- {
- set_dhudmessage( 255, 0, 0, -1.0, 0.35, 1, 6.0, -1.0 )
- for ( new i = 0; i < get_maxplayers(); i++ )
- {
- if( !is_user_alive( i ) )
- continue;
- if( TheStriped == i && user_has_weapon( i, CSW_M4A1 ) )
- fm_strip_user_weapons( i );
- new iPlayer = i;
- if( TheStriper == i )
- show_dhudmessage( i, "You have %i Second%s^nleft to try kill %s.", g_iCount, g_iCount == 1 ? "" : "s", szName( TheStriped ) );
- else if( TheStriped == i )
- show_dhudmessage( i, "You have %i Second%s^nleft to try staying alive from %s.", g_iCount, g_iCount == 1 ? "" : "s", szName( TheStriper ) );
- }
- }
- }
- stock SetHealth( const client, const iPlayer, iHealth = 100, pHealth = 0 )
- {
- fm_set_user_health( client, iHealth );
- fm_set_user_health( iPlayer, (pHealth!=0) ? pHealth : iHealth );
- }
- stock GiveWeapons( const client, const iPlayer, szClass[], g_iIndex, bool: bSpecial = false )
- {
- fm_give_item( client, szClass );
- fm_give_item( iPlayer, szClass );
- if ( bSpecial )
- return 1;
- if ( g_iIndex != CSW_KNIFE || g_iIndex != CSW_C4 )
- cs_set_user_bpammo( client, g_iIndex, 999 ), cs_set_user_bpammo( iPlayer, g_iIndex, 999 );
- return 1;
- }
- stock GetDuel()
- {
- new szBuffer[ 128 ];
- switch ( iType )
- {
- case 0: formatex( szBuffer, charsmax( szBuffer ), "%s | Shot4Shot", szS4S[ iDuel ] );
- case 1: formatex( szBuffer, charsmax( szBuffer ), "%s | %s Duel", szWar[ iDuel ], szWarOptions[ iWar ] );
- case 2: formatex( szBuffer, charsmax( szBuffer ), szFun[ iDuel ] );
- case 3: formatex( szBuffer, charsmax( szBuffer ), "%s Contest", szContests[ iDuel ] );
- case 4: formatex( szBuffer, charsmax( szBuffer ), "Rambo" );
- }
- return szBuffer;
- }
- stock ColorPrint( const client, const string[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "^1[^4 %s^1 ] ", Info[ 4 ] );
- vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
- if ( client )
- Players[ 0 ] = client;
- 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 szName( const index )
- {
- new ClientName[ 32 ];
- get_user_name( index, ClientName, charsmax( ClientName ) );
- return ClientName;
- }
- stock register_saycmd( szCommand[], szFunction[] )
- {
- new szSayType[ ][ ] = { "say", "say_team" }, szSigns[ ][ ] = { "!", "/" }, szSign[ 64 ];
- for ( new i; i < sizeof szSayType; i++ )
- {
- for ( new j; j < sizeof szSigns; j++ )
- {
- formatex( szSign, charsmax( szSign ), "%s %s%s", szSayType[ i ], szSigns[ j ], szCommand );
- register_clcmd( szSign, szFunction );
- }
- }
- }
- stock TeamCount( szTeam[] )
- {
- new Players[ 32 ], iNum;
- get_players( Players, iNum, "aceh", szTeam );
- return iNum;
- }
- stock GetReason( const index )
- {
- new szReason[ 128 ];
- if ( !is_user_alive( index ) )
- szReason = "^1You need to be^4 Alive^1.";
- if ( cs_get_user_team( index ) != CS_TEAM_T )
- szReason = "^1You need to be a^4 Terrorist^1.";
- if ( TeamCount( "TERRORIST" ) > 1 )
- szReason = "^1There are too many^3 Alive Terrorists^1.";
- if ( TeamCount( "CT" ) <= 0 )
- szReason = "^1There are too many^3 Alive Counter-Terrorists^1.";
- if ( bActive )
- szReason = "^1A Last-Request has already been started.";
- return szReason;
- }
- 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 ( TeamCount( "TERRORIST" ) > 1 )
- return false;
- if ( TeamCount( "CT" ) <= 0 )
- return false;
- if ( bActive )
- return false;
- return true;
- }
- stock AddItem( Menu, string[], any:... )
- {
- new szMsg[ 128 ];static iLen;
- vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
- formatex( szItem, charsmax( szItem ), szMsg );
- menu_additem( Menu, szItem );
- }
- stock AddLines( Output[], Len )
- {
- add( Output, Len, "^n----------------------------------^n" );
- }
- stock AddPlayers( Output[], Len, Src[], srcLen )
- {
- for ( new i = 1; i < g_iMaxPlayers; i++ )
- {
- if ( !is_user_connected( i ) || !is_user_alive( i ) || !bPlayer[ i ] )
- continue;
- formatex( Src, srcLen, "^n %s:^n %s : %i HP", (cs_get_user_team( i )==CS_TEAM_CT)? "CT's" :"T's", szName( i ), get_user_health( i ) );
- add( Output, Len, Src );
- }
- }
- stock get_velocity( ent, Float:fOrigin[ 3 ], Float:fSpeed, Float:fVelocity[ 3 ] )
- {
- new Float:fEntOrigin[3];
- pev( ent, pev_origin, fEntOrigin );
- new Float:fDistance[3];
- fDistance[0] = fEntOrigin[0] - fOrigin[0];
- fDistance[1] = fEntOrigin[1] - fOrigin[1];
- fDistance[2] = fEntOrigin[2] - fOrigin[2];
- new Float:fTime = ( vector_distance( fEntOrigin,fOrigin ) / fSpeed );
- fVelocity[0] = fDistance[0] / fTime;
- fVelocity[1] = fDistance[1] / fTime;
- fVelocity[2] = fDistance[2] / fTime;
- return (fVelocity[0] && fVelocity[1] && fVelocity[2]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement