Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < dhudmessage >
- #include < hamsandwich >
- #include < fakemeta >
- #include < engine >
- #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
- #pragma semicolon 1
- native cs_set_user_model( id, const model[ ] );
- native cs_reset_user_model( id );
- forward ForwardHitGrenade( client );
- const gMaxWinSounds = 16;
- const gMaxInfectSounds = 3;
- new const g_WinnerSound[ gMaxWinSounds ][ ] =
- {
- "HitandRun/intwin_01.mp3",
- "HitandRun/intwin_02.mp3",
- "HitandRun/intwin_03.mp3",
- "HitandRun/intwin_04.mp3",
- "HitandRun/intwin_05.mp3",
- "HitandRun/intwin_06.mp3",
- "HitandRun/intwin_07.mp3",
- "HitandRun/intwin_08.mp3",
- "HitandRun/intwin_09.mp3",
- "HitandRun/intwin_10.mp3",
- "HitandRun/intwin_11.mp3",
- "HitandRun/intwin_12.mp3",
- "HitandRun/intwin_13.mp3",
- "HitandRun/intwin_14.mp3",
- "HitandRun/intwin_15.mp3",
- "HitandRun/intwin_16.mp3"
- };
- new const gInfectSounds[ gMaxInfectSounds ][ ] =
- {
- "HitandRun/hit_sound_1.wav",
- "HitandRun/hit_sound_2.wav",
- "HitandRun/hit_sound_3.wav"
- };
- new const g_Events[ ][ ] =
- {
- "\rScout NoZoom Round [ x2 Cash + XP]",
- "\yAwp Round [x2 Cash + XP]",
- "Gravity Round [x2 Cash + XP]",
- "\dSpeed Round [x2 Cash + XP]",
- "Knife Round [x2 Cash + XP]"
- };
- new const g_Event[ ][ ] =
- {
- "nozoom",
- "awpround",
- "gravityround",
- "speedround",
- "knife"
- };
- new const gBuyCommands[ ][ ] =
- {
- "jointeam", "usp", "glock",
- "deagle", "p228", "elites", "fn57", "m3",
- "xm1014", "mp5", "tmp", "p90", "mac10",
- "ump45", "ak47", "galil", "famas", "sg552",
- "m4a1", "aug", "scout", "awp", "g3sg1", "sg550",
- "m249", "vest", "vesthelm", "flash",
- "hegren", "sgren", "defuser", "nvgs", "shield",
- "primammo", "secammo", "km45", "9x19mm",
- "nighthawk", "228compact", "12gauge",
- "autoshotgun", "smg", "mp", "c90", "cv47",
- "defender", "clarion", "krieg552",
- "bullpup", "magnum", "d3au1", "krieg550",
- "buyammo1", "buyammo2", "buy"
- };
- enum _:Teams
- {
- FM_TEAM_UNASSIGNED,
- FM_TEAM_T,
- FM_TEAM_CT,
- FM_TEAM_SPECTATOR
- };
- new WinnerBeam;
- new g_LastHit;
- new g_szLastHit;
- new event;
- new gSyncHud[ 4 ];
- new ForwardWonGame;
- new ForwardReturn;
- new ForwardBack;
- new g_szRoundEvent;
- new gMaxPlayers;
- new g_szKind[ 5 ];
- new HamHook:NoZoom;
- new bool:GameStarted;
- new bool:g_szTwoInfect;
- new bool:gStartingGame;
- new bool:WinnerEffect;
- new bool:AntiRetry;
- new bool:gFalling[ 33 ];
- new bool:knifer;
- new bool:eventt;
- new Float:g_HnrDieTimer;
- public plugin_init()
- {
- register_plugin( "Advanced HitAndRun", "1.0", "noamb7" );
- for( new i = 0; i < sizeof gBuyCommands; i++ )
- {
- register_clcmd( gBuyCommands[ i ], "ClcmdBlock" );
- }
- register_clcmd( "say /start", "StartGame" );
- RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", true );
- RegisterHam( Ham_TakeDamage, "player", "FwdHamTakeDamage", true );
- RegisterHam( Ham_Killed, "player", "FwdHamPlayerKilled", true );
- register_event( "HLTV", "NewRound", "a", "1=0", "2=0" );
- register_logevent( "RoundEnd", 2, "1=Round_End" );
- register_event( "ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199" );
- register_event( "CurWeapon", "Event_CurWeapon", "be","1=1" );
- register_forward( FM_PlayerPreThink, "FwdClientPreThink" );
- register_forward( FM_PlayerPostThink, "FwdClientPostThink" );
- gSyncHud[ 0 ] = CreateHudSyncObj( );
- gSyncHud[ 1 ] = CreateHudSyncObj( );
- gSyncHud[ 2 ] = CreateHudSyncObj( );
- gSyncHud[ 3 ] = CreateHudSyncObj( );
- NoZoom = RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_scout", "OnSecondaryAttack" );
- ForwardWonGame = CreateMultiForward( "ForwardWonTheGame", ET_IGNORE, FP_CELL );
- event = CreateMultiForward( "ForwardEvent", ET_IGNORE, FP_CELL );
- gMaxPlayers = get_maxplayers( );
- }
- public plugin_precache()
- {
- for( new i = 0; i < gMaxWinSounds; i++ )
- {
- precache_sound( g_WinnerSound[ i ] );
- }
- for( new i = 0; i < gMaxInfectSounds; i++ )
- {
- precache_sound( gInfectSounds[ i ] );
- }
- precache_model( "models/player/Adv-Sick/Adv-Sick.mdl" );
- precache_model( "models/HitandRun/v_He.mdl" );
- precache_model( "models/HitandRun/p_He.mdl" );
- precache_model( "models/HitandRun/v_Flash.mdl" );
- precache_model( "models/HitandRun/p_Flash.mdl" );
- WinnerBeam = precache_model( "sprites/zbeam2.spr" );
- }
- public plugin_cfg()
- {
- set_cvar_num( "mp_roundtime", 9 );
- set_cvar_num( "mp_freezetime", 0 );
- set_cvar_num( "mp_limitteams", 0 );
- set_cvar_num( "mp_autoteambalance", 0 );
- set_cvar_num( "fn_enabled", 1 );
- set_cvar_string( "humans_join_team", "T" );
- }
- public ClcmdBlock( iPlayer )
- {
- return PLUGIN_HANDLED;
- }
- public OnSecondaryAttack( const iEntity )
- {
- return HAM_SUPERCEDE;
- }
- public knife( )
- {
- knifer = true;
- Check();
- }
- public NewRound()
- {
- for( new i; i < sizeof g_szKind; i++ )
- {
- g_szKind[ i ] = 0;
- }
- set_lights( "m" );
- DisableHamForward( NoZoom );
- g_HnrDieTimer = 20.0;
- g_szRoundEvent++;
- knifer = false;
- eventt = false;
- ColorChat( 0, "there will be event in: %i", 9 - g_szRoundEvent );
- WinnerEffect = false;
- set_hudmessage( 255, 0, 0, -1.0, 0.3, 2, 6.0, 6.0 );
- ShowSyncHudMsg( 0, gSyncHud[ 0 ], "Spawn Protection is Enabled For 5 Seconds!" );
- set_dhudmessage( 255, 0, 0, -1.0, 0.71, 2, 0.0, 4.0 );
- show_dhudmessage( 0, "The Game is About To Begin!" );
- set_hudmessage( 255, 0, 0, -1.0, 0.75, 2, 4.0, 6.0 );
- ShowSyncHudMsg( 0, gSyncHud[ 1 ], "HitandRun" );
- set_task( 0.1, "StopEffect" );
- g_szRoundEvent == 9 ? set_task( 1.0, "dddVote" ) : set_task( 7.6, "Check" );
- }
- public dddVote( )
- {
- g_szRoundEvent = 0;
- new menu = menu_create( "event, choose event KIND", "handlerdddd" );
- new st[ 3 ];
- for( new k; k < sizeof g_Events; k++ )
- {
- num_to_str( k, st, 2 );
- menu_additem( menu, g_Events[ k ], st );
- }
- new players[ 32 ], szNum;
- get_players( players, szNum, "ach" );
- for( new i; i < szNum; i++ )
- {
- menu_display( players[ i ], menu );
- }
- set_task( 10.0, "checkvotesd" );
- }
- public checkvotesd( )
- {
- new Winner = 0;
- for( new i = 0; i < sizeof g_Events; i++ )
- {
- if( g_szKind[ Winner ] < g_szKind[ i ] )
- Winner = i;
- }
- ColorChat( 0, "The Event %s won, it will start NOW", g_Events[ Winner ] );
- set_dhudmessage( 255, 0, 0, -1.0, 0.18, 0, 6.0, 5.0 );
- show_dhudmessage( 0, "%s Will Start!!!!", g_Events[ Winner ] );
- eventt = true;
- ExecuteForward( event, ForwardBack, 0 );
- set_task( 4.0, g_Event[ Winner ] );
- }
- public handlerdddd( client, menu, item )
- {
- if( item == MENU_EXIT )
- {
- return;
- }
- new szName[ 32 ];
- get_user_name( client, szName, 32 );
- ColorChat( 0, "%s has voted for: %s", szName, g_Events[ item ] );
- g_szKind[ item ]++;
- return;
- }
- public nozoom( )
- {
- EnableHamForward( NoZoom );
- Check();
- }
- public awpround( )
- {
- if( GetAliveContesters() >= 2 )
- {
- GetRandomPlayer();
- if( GetAliveContesters( ) > 10 )
- GetOtherPlayer( );
- GameStarted = true;
- set_task( 0.1, "GameCountDown" );
- set_task( 14.0, "TickTock" );
- set_task( 0.2, "start" );
- GetPlayers();
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- fm_give_item( i, "weapon_awp" );
- }
- }
- }
- public speedround( )
- {
- if( GetAliveContesters() >= 2 )
- {
- GetRandomPlayer();
- if( GetAliveContesters( ) > 10 )
- GetOtherPlayer( );
- GameStarted = true;
- set_task( 0.1, "GameCountDown" );
- set_task( 14.0, "TickTock" );
- set_task( 0.2, "start" );
- }
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- if( is_user_alive( i ) )
- {
- set_pev( i, pev_maxspeed, 400.0 );
- fm_give_item( i, "weapon_scout" );
- }
- }
- ColorChat( 0, "Started!! Good Luck" );
- }
- public gravityround( )
- {
- if( GetAliveContesters() >= 2 )
- {
- GetRandomPlayer();
- if( GetAliveContesters( ) > 10 )
- GetOtherPlayer( );
- GameStarted = true;
- set_task( 0.1, "GameCountDown" );
- set_task( 14.0, "TickTock" );
- set_task( 0.2, "start" );
- }
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- if( is_user_alive( i ) )
- {
- set_pev( i, pev_gravity, 500.0 / 800.0 );
- fm_give_item( i, "weapon_scout" );
- }
- }
- ColorChat( 0, "Started!! Good Luck" );
- }
- public client_disconnect( client )
- {
- remove_task( client );
- if( g_LastHit == client )
- {
- if( GetAliveContesters() >= 2 && g_HnrDieTimer != 0 )
- {
- GetRandomPlayer();
- }
- }
- }
- public client_putinserver( client )
- {
- client_cmd( client, "cl_minmodels 1" );
- if( !gStartingGame && !GameStarted )
- set_task( 3.0, "CheckStart", client );
- }
- public CheckStart( client )
- {
- if( is_user_alive( client ) && !gStartingGame && !GameStarted )
- {
- gStartingGame = true;
- set_cvar_num( "sv_restart", 3 );
- }
- }
- public ForwardHitGrenade( client )
- {
- if( g_LastHit != client )
- {
- g_LastHit = client;
- MakeInfected();
- }
- }
- public RoundEnd()
- {
- knifer = false;
- event = false;
- set_task( 1.0, "Stop" );
- }
- public StartGame( client )
- {
- if( is_user_alive( client ) && !GameStarted && get_user_flags( client ) & ADMIN_BAN )
- {
- set_cvar_num( "sv_restart", 3 );
- }
- }
- public FwdHamPlayerSpawn( client )
- {
- if( !is_user_alive( client ) || !is_user_connected( client ) )
- return HAM_IGNORED;
- fm_strip_user_weapons( client );
- fm_give_item( client, "weapon_knife" );
- //fm_set_user_rendering( client );
- set_pev( client, pev_gravity, 1.0 );
- if( AntiRetry )
- {
- user_silentkill( client );
- }
- return HAM_IGNORED;
- }
- public Check()
- {
- if( GetAliveContesters() >= 2 )
- {
- GetRandomPlayer();
- if( GetAliveContesters( ) > 10 )
- GetOtherPlayer( );
- GameStarted = true;
- set_task( 0.1, "GameCountDown" );
- set_task( 14.0, "TickTock" );
- set_task( 0.2, "start" );
- GetPlayers();
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- PrepareClient( i );
- }
- }
- else
- {
- ColorChat( 0, "^4Minimum ^1Players Needed To ^3Start ^1A Game Are:^4 2" );
- GameStarted = false;
- }
- gStartingGame = false;
- }
- GetOtherPlayer( )
- {
- new players[ 32 ], szNum, szName[ 32 ];
- get_players( players, szNum, "ache", "TERRORIST" );
- if( szNum )
- g_szLastHit = players[ random( szNum ) ];
- get_user_name( g_szLastHit, szName, charsmax( szName ) );
- set_hudmessage( 255, 0, 0, -1.0, 0.8, 1, 0.0, 6.0 );
- ShowSyncHudMsg( 0, gSyncHud[ 3 ], "^"%s^" Was Randomly Picked...", szName );
- }
- public start()
- {
- AntiRetry = true;
- }
- public FwdHamPlayerKilled( victim )
- {
- static iOrigin[ 3 ];
- get_user_origin( victim, iOrigin );
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_BEAMCYLINDER );
- write_coord( iOrigin[ 0 ] );
- write_coord( iOrigin[ 1 ] );
- write_coord( iOrigin[ 2 ] - 20 );
- write_coord( iOrigin[ 0 ] );
- write_coord( iOrigin[ 1 ] );
- write_coord( iOrigin[ 2 ] + 200 );
- write_short( WinnerBeam );
- write_byte( 0 );
- write_byte( 1 );
- write_byte( 6 );
- write_byte( 1000 );
- write_byte( 1 );
- write_byte( random( 250 ) );
- write_byte( random( 250 ) );
- write_byte( random( 250 ) );
- write_byte( 200 );
- write_byte( 0 );
- message_end( );
- GetPlayers();
- }
- public StopEffect()
- {
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- if( !is_user_connected( i ) || !is_user_alive( i ) )
- continue;
- remove_task( i );
- fm_set_user_rendering( i );
- cs_reset_user_model( i );
- }
- }
- public FlashedEvent( client )
- {
- message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ) ,{ 0, 0, 0 }, client );
- write_short( read_data( 1 ) );
- write_short( read_data( 2 ) );
- write_short( read_data( 3 ) );
- write_byte( random( 250 ) );
- write_byte( random( 250 ) );
- write_byte( random( 250 ) );
- write_byte( read_data( 7 ) );
- message_end();
- return PLUGIN_HANDLED;
- }
- public Event_CurWeapon( client )
- {
- if( !is_user_alive( client ) || !is_user_connected( client ) )
- return PLUGIN_HANDLED;
- if( knifer )
- {
- if( get_user_weapon( client ) != CSW_KNIFE )
- {
- fm_strip_user_weapons( client );
- fm_give_item( client, "weapon_knife" );
- }
- }
- switch( get_user_weapon( client ) )
- {
- case CSW_HEGRENADE:
- {
- set_pev( client, pev_viewmodel2, "models/HitandRun/v_He.mdl" );
- set_pev( client, pev_weaponmodel2, "models/HitandRun/p_He.mdl" );
- }
- case CSW_FLASHBANG:
- {
- set_pev( client, pev_viewmodel2, "models/HitandRun/v_Flash.mdl" );
- set_pev( client, pev_weaponmodel2, "models/HitandRun/p_Flash.mdl" );
- }
- }
- return PLUGIN_HANDLED;
- }
- public FwdClientPostThink( client )
- {
- if( is_user_alive( client ) && is_user_connected( client ) )
- {
- if( gFalling[ client ] )
- {
- set_pev( client, pev_watertype, -3 );
- }
- }
- }
- public FwdClientPreThink( client )
- {
- if( is_user_alive( client ) && is_user_connected( client ) )
- {
- if( pev( client, pev_flFallVelocity ) >= 350.0 )
- {
- gFalling[ client ] = true;
- }
- else
- {
- gFalling[ client ] = false;
- }
- set_pev( client, pev_fuser2 , 0.0 );
- }
- }
- public GameCountDown( )
- {
- if( GameStarted )
- {
- if( g_HnrDieTimer <= 0.0 )
- {
- Kill_user( g_LastHit );
- if( GetAliveContesters() >= 2 )
- {
- remove_task( );
- g_HnrDieTimer = 20.0;
- set_task( 14.0, "TickTock" );
- set_task( 2.5, "GetRandomPlayer" );
- if( GetAliveContesters( ) > 10 )
- set_task( 2.5, "GetOtherPlayer" );
- set_task( 2.5, "GameCountDown" );
- return PLUGIN_HANDLED;
- }
- else
- {
- if( !WinnerEffect )
- {
- CheckGameResult();
- }
- }
- }
- else
- {
- static szName[ 32 ];
- get_user_name( g_LastHit, szName, 32 );
- set_dhudmessage( 255, 0, 0, -1.0, 0.71, 1, 0.0, 0.12, 0.0, 0.0 );
- show_dhudmessage( 0, "Time Left: %.1f Seconds!^n^"%s^" Was Last Hit", g_HnrDieTimer, szName );
- g_HnrDieTimer -= 0.1;
- }
- set_task( 0.1, "GameCountDown" );
- }
- return PLUGIN_HANDLED;
- }
- public TickTock()
- {
- }
- GetPlayers()
- {
- new Alives;
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- if( !is_user_alive( i ) || !is_user_connected( i ) )
- continue;
- Alives++;
- }
- ColorChat( 0, "Online:^4 %i ^3| ^1Alive:^4 %i ^3| ^1Dead:^4 %i",
- get_playersnum( 1 ),
- Alives,
- get_playersnum( 1 ) - Alives
- );
- }
- Kill_user( index )
- {
- if( g_szTwoInfect )
- {
- user_kill( g_szLastHit );
- g_szTwoInfect = false;
- }
- if( is_user_alive( index ) )
- {
- client_cmd( 0, "spk ^"ambience/thunder_clap.wav^"" );
- user_silentkill( index );
- }
- }
- CheckGameResult()
- {
- new Winner;
- if( GetAliveContesters() == 1 && !WinnerEffect )
- {
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- if( !is_user_alive( i ) || !is_user_connected( i ) ||
- fm_get_user_team( i ) != FM_TEAM_T )
- continue;
- Winner = i;
- }
- set_lights( "b" );
- WinnerEffect = true;
- static WinnerName[ 32 ];
- get_user_name( Winner, WinnerName, 32 );
- client_cmd( 0, "mp3 play sound/%s", g_WinnerSound[ random( gMaxWinSounds ) ] );
- set_task( 0.15, "ShowWinner", Winner );
- //set_task( 3.0, "SplashEffect", Winner, _, _, "b" );
- set_task( 13.0, "StartG" );
- set_task( 17.0, "Stop" );
- ColorChat( 0, "Congratulations ^4%s, ^1Won %i ^"^4Cash^1^",^1 %i ^4Exp ^1For Winning %i ^4Players!",
- WinnerName,
- get_playersnum( 1 ) * eventt ? 400 : 200,
- eventt ? get_playersnum( 1 ) * 2 : get_playersnum( 1 ),
- get_playersnum( 1 ) - 1
- );
- ExecuteForward( ForwardWonGame, ForwardReturn, Winner );
- //DHUD_display(id, dhud, Float:fInterval = 0.1, channel = 4, const szMessage[], any:...);
- //DHUD_display( 0, DynamicWin, _, 1, "Congratulations, %s Won The Game!!", WinnerName );
- set_dhudmessage( 255, 0, 0, -1.0, 0.2, 0, 6.0, 12.0 );
- show_dhudmessage( 0, "%s Is The Winner!", WinnerName );
- }
- return PLUGIN_HANDLED;
- }
- public StartG( )
- {
- set_hudmessage( 255, 0, 0, -1.0, 0.3, 1, 6.0, 6.0 );
- ShowSyncHudMsg( 0, gSyncHud[ 1 ], "The Game Will Start in 4 Seconds" );
- }
- public Stop()
- {
- AntiRetry = false;
- GameStarted = false;
- gStartingGame = true;
- g_szTwoInfect = false;
- set_cvar_num( "sv_restart", 1 );
- }
- public SplashEffect( client )
- {
- if( is_user_alive( client ) )
- {
- static iOrigin[ 3 ];
- get_user_origin( client, iOrigin );
- message_begin( MSG_ALL, SVC_TEMPENTITY );
- write_byte( TE_LAVASPLASH );
- write_coord( iOrigin[ 0 ] );
- write_coord( iOrigin[ 1 ] );
- write_coord( iOrigin[ 2 ] - 26 );
- message_end( );
- }
- }
- public FwdHamTakeDamage( victim, inflictor, attacker, damage, damagebits )
- {
- if( !is_user_alive( victim ) || !is_user_alive( attacker ) || !GameStarted )
- return HAM_IGNORED;
- if( g_LastHit != victim && victim != attacker && attacker == g_LastHit )
- {
- g_LastHit = victim;
- MakeInfected( );
- }
- return HAM_IGNORED;
- }
- public GetRandomPlayer()
- {
- new players[ 32 ], pnum;
- get_players( players, pnum, "ae", "TERRORIST" );
- if( !pnum )
- return PLUGIN_HANDLED;
- g_LastHit = players[ random( pnum ) ];
- static szName[ 33 ];
- get_user_name( g_LastHit, szName, 32 );
- ShakeScreen( g_LastHit );
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- if ( !is_user_connected( i ) || !is_user_alive( i ) )
- continue;
- cs_reset_user_model( i );
- //fm_set_user_rendering( i );
- }
- ColorChat( 0, "^"^4%s^1^" Was ^3Randomly ^1Choosen...", szName );
- cs_set_user_model( g_LastHit, "Adv-Sick" );
- //fm_set_user_rendering( g_LastHit, kRenderFxGlowShell, random( 255 ), random( 255 ), random( 255 ), kRenderTransAlpha, 200 );
- client_cmd( g_LastHit, "spk ^"sound/%s^"", gInfectSounds[ random( gMaxInfectSounds ) ] );
- MakeSickness( g_LastHit );
- return PLUGIN_CONTINUE;
- }
- MakeInfected()
- {
- ShakeScreen( g_LastHit );
- static szName[ 33 ];
- get_user_name( g_LastHit, szName, 32 );
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- //set_hudmessage( 255, 0, 0, -1.0, 0.75, 1, 0.0, 6.0 );
- //ShowSyncHudMsg( i, g_szTwoInfect ? gSyncHud[ random( 3 ) ] : gSyncHud[ 2 ], "^"%s^" Was Last Hit...", szName );
- if ( !is_user_alive( i ) || !is_user_connected( i ) )
- continue;
- //fm_set_user_rendering( i );
- cs_reset_user_model( i );
- }
- cs_set_user_model( g_LastHit, "Adv-Sick" );
- //fm_set_user_rendering( g_LastHit, kRenderFxGlowShell, random( 255 ), random( 255 ), random( 255 ), kRenderTransAlpha, 120 );
- client_cmd( g_LastHit, "spk ^"sound/%s^"", gInfectSounds[ random( gMaxInfectSounds ) ] );
- MakeSickness( g_LastHit );
- }
- MakeSickness( index )
- {
- static Origin[ 3 ];
- get_user_origin( index, Origin );
- message_begin( MSG_PVS, SVC_TEMPENTITY, Origin );
- write_byte( TE_IMPLOSION );
- write_coord( Origin[ 0 ] );
- write_coord( Origin[ 1 ] );
- write_coord( Origin[ 2 ] );
- write_byte( 128 );
- write_byte( 20 );
- write_byte( 3 );
- message_end();
- }
- public ShowWinner( client )
- {
- new RGB[ 3 ];
- RGB[ 0 ] = random( 250 );
- RGB[ 1 ] = random( 250 );
- RGB[ 2 ] = random( 250 );
- static Origin[ 3 ];
- get_user_origin( client, Origin );
- message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
- write_byte( TE_BEAMTORUS );
- write_coord( Origin[ 0 ] );
- write_coord( Origin[ 1 ] );
- write_coord( Origin[ 2 ] );
- write_coord( Origin[ 0 ] );
- write_coord( Origin[ 1 ] );
- write_coord( Origin[ 2 ] + 400 );
- write_short( WinnerBeam );
- write_byte( 0 );
- write_byte( 1 );
- write_byte( 7 );
- write_byte( 80 );
- write_byte( 1 );
- write_byte( RGB[ 0 ] );
- write_byte( RGB[ 1 ] );
- write_byte( RGB[ 2 ] );
- write_byte( 200 );
- write_byte( 0 );
- message_end( );
- set_task( 0.21 ,"ShowWinner", client );
- }
- PrepareClient( index )
- {
- if( !is_user_alive( index ) || !is_user_connected( index ) )
- return PLUGIN_HANDLED;
- fm_strip_user_weapons( index );
- fm_give_item( index, "weapon_knife" );
- fm_give_item( index, "weapon_scout" );
- fm_give_item( index, "weapon_hegrenade" );
- fm_give_item( index, "weapon_flashbang" );
- fm_give_item( index, "weapon_flashbang" );
- fm_give_item( index, "weapon_smokegrenade" );
- return PLUGIN_HANDLED;
- }
- GetAliveContesters()
- {
- new Contesters;
- for( new i, j = gMaxPlayers; i <= j; i++ )
- {
- if( !is_user_alive( i ) || fm_get_user_team( i ) != FM_TEAM_T )
- continue;
- Contesters++;
- }
- return Contesters;
- }
- stock fm_get_user_team( client )
- {
- return get_pdata_int( client, 114 );
- }
- stock fm_set_user_team( client, team )
- {
- set_pdata_int( client, 114, team );
- static const TeamInfo[ Teams ][ ] =
- {
- "UNASSIGNED",
- "TERRORIST",
- "CT",
- "SPECTATOR"
- };
- message_begin( MSG_ALL, get_user_msgid( "TeamInfo" ) ) ;
- write_byte( client );
- write_string( TeamInfo[ team ] );
- message_end( );
- }
- stock fm_strip_user_weapons( client )
- {
- new ent = fm_create_entity( "player_weaponstrip" );
- if ( !pev_valid( ent ) )
- return 0;
- dllfunc( DLLFunc_Spawn, ent );
- dllfunc( DLLFunc_Use, ent, client );
- engfunc( EngFunc_RemoveEntity, ent );
- return 1;
- }
- stock fm_give_item( client, const item[ ] )
- {
- if ( !equal( item, "weapon_", 7 ) && !equal( item, "ammo_", 5 )
- && !equal( item, "item_", 5 ) && !equal( item, "tf_weapon_", 10 ) )
- return 0;
- new ent = fm_create_entity( item );
- if ( !pev_valid( ent ) )
- return 0;
- new Float:origin[3];
- pev( client, pev_origin, origin );
- set_pev( ent, pev_origin, origin );
- set_pev( ent, pev_spawnflags, pev( ent, pev_spawnflags ) | SF_NORESPAWN );
- dllfunc( DLLFunc_Spawn, ent );
- new save = pev( ent, pev_solid );
- dllfunc( DLLFunc_Touch, ent, client );
- if ( pev( ent, pev_solid ) != save )
- return ent;
- engfunc( EngFunc_RemoveEntity, ent );
- return -1;
- }
- stock fm_set_user_rendering( index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16 )
- {
- new Float:RenderColor[ 3 ];
- RenderColor[ 0 ] = float( r );
- RenderColor[ 1 ] = float( g );
- RenderColor[ 2 ] = float( b );
- set_pev( index, pev_renderfx, fx );
- set_pev( index, pev_rendercolor, RenderColor );
- set_pev( index, pev_rendermode, render );
- set_pev( index, pev_renderamt, float( amount ) );
- return 1;
- }
- ShakeScreen( index )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenShake" ), _, index );
- write_short( 10 << 12 );
- write_short( 5 << 12 );
- write_short( 10 << 12 );
- message_end( );
- }
- stock cs_set_user_bpammo( client, weaponid, amnt )
- {
- static offset;
- switch( weaponid )
- {
- case CSW_AWP: offset = 377;
- case CSW_SCOUT,CSW_AK47: offset = 378;
- case CSW_FAMAS,CSW_M4A1,CSW_AUG: offset = 380;
- case CSW_DEAGLE: offset = 384;
- case CSW_FLASHBANG: offset = 387;
- case CSW_HEGRENADE: offset = 388;
- case CSW_SMOKEGRENADE: offset = 389;
- default: return 0;
- }
- set_pdata_int( client, offset, amnt, 5 );
- return 1;
- }
- stock ColorChat( const client, const string[ ], { Float, Sql, Resul, _ } :... )
- {
- new msg[ 191 ], players[ 32 ], count = 1;
- static len; len = formatex( msg, charsmax(msg), "^4| HitandRun | Agent:^1 " );
- vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
- if( client ) players[ 0 ] = client;
- else get_players( players,count, "ch" );
- for( new i = 0; i < count; i++ )
- {
- if( is_user_connected( players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ),_, players[ i ] );
- write_byte( players[ i ] );
- write_string( msg );
- message_end( );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement