Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < cstrike >
- #include < fakemeta_util >
- #include < engine >
- #define TASKID_CONTEST 15646
- #define ice_model "models/Top/JB/LR/dd_iceblock.mdl"
- new const szPrefix[ ] = "Top";
- /*
- native get_user_cash( const index );
- native set_user_cash( const index, cash );
- */
- new szAnswer[ 128 ];
- new bool: bActive;
- new bool: bAllow;
- new g_iCount;
- new g_mItem;
- new szContests[ ][ ] =
- {
- "First Write",
- "Translate",
- "Missing Letter",
- "Math Contast",
- "Type Race"
- };
- new g_szEngTrans[ ][ ] =
- {
- "quick", "river", "phone", "keyboard", "mouse",
- "glasses", "window", "bottle", "plate", "screen",
- "paper", "newspaper", "fork", "knife", "toilet",
- "news", "keys", "open", "close", "bed",
- "pillow", "blanket", "wall", "closet", "dresser",
- "pen", "pencil", "money", "gold", "disc",
- "banana", "pear", "pineapple", "orange", "headphones",
- "microphone", "plum", "batteries", "clock",
- "time", "car", "neck", "head", "hand",
- "leg", "eyes", "fingers", "hat", "shirt",
- "pants", "book", "conversation", "shoes", "nerds",
- "purple", "red", "pink", "blue",
- "azure", "green", "yellow", "bible", "beard",
- "poker", "page", "pirates", "love", "happy"
- };
- new g_szHebTrans[ ][ ] =
- {
- "׳¨׳™׳”׳", "׳¨׳”׳ ", "׳׳•׳₪׳׳˜", "׳×׳“׳׳§׳", "׳¨׳‘׳›׳¢",
- "׳׳™׳™׳₪׳§׳©׳", "׳׳•׳׳—", "׳§׳•׳‘׳§׳‘", "׳×׳—׳׳¦", "׳׳¡׳",
- "׳¨׳™׳™׳ ", "׳׳•׳×׳™׳¢", "׳’׳׳–׳", "׳׳™׳›׳¡", "׳”׳׳¡׳",
- "׳×׳•׳©׳“׳—", "׳×׳•׳—׳×׳₪׳", "׳—׳•׳×׳₪׳", "׳¨׳•׳’׳¡׳", "׳”׳˜׳™׳",
- "׳×׳™׳¨׳›", "׳”׳›׳™׳׳©", "׳¨׳™׳§", "׳׳•׳¨׳", "׳׳™׳“׳’׳‘ ׳׳•׳¨׳",
- "׳˜׳¢", "׳׳•׳¨׳₪׳¢", "׳£׳¡׳›", "׳‘׳”׳–", "׳§׳¡׳™׳“",
- "׳”׳ ׳ ׳‘", "׳¡׳’׳", "׳¡׳ ׳ ׳", "׳–׳•׳₪׳×", "׳×׳•׳™׳ ׳–׳•׳",
- "׳׳•׳₪׳•׳¨׳§׳™׳","׳£׳™׳–׳©", "׳×׳•׳™׳¨׳˜׳‘", "׳׳•׳¢׳©",
- "׳׳׳–", "׳×׳™׳ ׳•׳›׳", "׳¦׳•׳•׳׳¨׳¨׳׳•׳•׳¦", "׳©׳׳¨", "׳“׳™",
- "׳׳’׳¨", "׳׳™׳™׳ ׳™׳¢", "׳×׳•׳¢׳‘׳¦׳", "׳¢׳‘׳•׳›", "׳”׳¦׳׳•׳—",
- "׳׳™׳™׳¡׳ ׳›׳", "׳¨׳₪׳¡", "׳”׳—׳™׳©", "׳׳™׳™׳׳¢׳ ", "׳׳™׳ ׳•׳ ׳—",
- "׳׳•׳’׳¡", "׳׳•׳“׳", "׳“׳•׳¨׳•", "׳׳•׳—׳›",
- "׳×׳׳›׳×", "׳§׳•׳¨׳™", "׳‘׳•׳”׳¦", "׳׳ ׳×", "׳¨׳•׳₪׳™׳¦",
- "׳¨׳§׳•׳₪", "׳“׳•׳׳¢", "׳׳™׳˜׳׳¨׳™׳₪", "׳”׳‘׳”׳", "׳—׳׳©"
- }
- new g_szFirstChars[ ][ ] =
- {
- "9", "1", "2", "7", "3", "0", "4", "6", "5", "0",
- "8", "7", "3", "2", "0", "7", "8", "9", "0", "6",
- "7", "6", "4", "7", "5", "6",
- "5", "7", "5", "9", "8", "2", "1", "3", "5", "9",
- "6", "8", "0", "3", "4", "6", "5", "9", "7", "8",
- "1", "9", "8", "5", "3", "8",
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
- };
- public plugin_init()
- {
- register_plugin( "Games: Last Request", "1.0", "Built by Rejack || Edit by @.TheBomB`" );
- register_event( "DeathMsg", "evDeathMsg", "a" );
- register_clcmd( "say", "CmdSay" );
- register_logevent( "evRoundStart", 2, "1=Round_Start" );
- bActive = false;
- bAllow = false;
- }
- public plugin_precache()
- precache_model( ice_model );
- public plugin_natives()
- {
- register_library( "Games_LR" );
- register_native( "StartContest", "native_StartGame" );
- }
- public CmdFREEZE( client )
- {
- fm_set_user_freeze( client, 1 );
- ice_entity( client );
- }
- new bool: IsPlaying[ 33 ];
- new g_mPlayer[ 2 ];
- public native_StartGame( plugin, params )
- {
- static Prisoner, Guard, Game;
- Prisoner = get_param( 1 );
- Guard = get_param( 2 );
- Game = get_param( 3 );
- static Players[ 32 ], iNum;
- get_players( Players, iNum, "ch" );
- for ( new i; i < iNum; i++ )
- IsPlaying[ Players[ i ] ] = false;
- IsPlaying[ Prisoner ] = true;
- IsPlaying[ Guard ] = true;
- g_mPlayer[ 0 ] = Prisoner;
- g_mPlayer[ 1 ] = Guard;
- ActionStartContest( Game );
- }
- /* Events */
- public evRoundStart()
- {
- bActive = false;
- bAllow = false;
- remove_task( TASKID_CONTEST );
- new ent;
- while( ( ent = fm_find_ent_by_class( ent, "FrostBoy" ) ) != 0 )
- fm_remove_entity( ent );
- }
- public evDeathMsg()
- {
- static iVictim, iAttacker;
- iAttacker = read_data( 1 );
- iVictim = read_data( 2 );
- if ( IsPlaying[ iVictim ] && IsPlaying[ iAttacker ] )
- {
- bActive = false;
- bAllow = false;
- remove_task( TASKID_CONTEST );
- new ent;
- while( ( ent = fm_find_ent_by_class( ent, "FrostBoy" ) ) != 0 )
- fm_remove_entity( ent );
- }
- }
- /* Client Side */
- public CmdSay( client )
- {
- if ( !bAllow || !bActive || !is_user_connected( client ) || !is_user_alive( client ) || !IsPlaying[ client ] )
- return 0;
- new szMsg[ 512 ];
- read_args( szMsg, charsmax( szMsg ) );
- remove_quotes( szMsg );
- if ( g_mItem == 4 )
- {
- static szArgs[ 2 ][ 8 ][ 32 ], i;
- parse( szMsg, szArgs[ 0 ][ 0 ], 31, szArgs[ 0 ][ 1 ], 31, szArgs[ 0 ][ 2 ], 31, szArgs[ 0 ][ 3 ], 31, szArgs[ 0 ][ 4 ], 31, szArgs[ 0 ][ 5 ], 31, szArgs[ 0 ][ 6 ], 31, szArgs[ 0 ][ 7 ], 31 );
- parse( szAnswer, szArgs[ 1 ][ 0 ], 31, szArgs[ 1 ][ 1 ], 31, szArgs[ 1 ][ 2 ], 31, szArgs[ 1 ][ 3 ], 31, szArgs[ 1 ][ 4 ], 31, szArgs[ 1 ][ 5 ], 31, szArgs[ 1 ][ 6 ], 31, szArgs[ 1 ][ 7 ], 31 );
- for ( i = 0; i < 8; i++ )
- {
- if ( !( equali( szArgs[ 0 ][ i ], szArgs[ 1 ][ i ] ) ) )
- break;
- if ( i == 7 )
- get_user_winner( client );
- }
- return 0;
- }
- if ( g_mItem == 0 && equal( szMsg, szAnswer ) || g_mItem != 0 && equali( szMsg, szAnswer ) )
- get_user_winner( client );
- return 0;
- }
- /* Start Contest */
- public ActionStartContest( Action )
- {
- bActive = true;
- bAllow = false;
- g_iCount = 5;
- g_mItem = Action;
- taskStartContest();
- }
- /* Tasks */
- public taskStartContest()
- {
- if ( g_iCount > 0 )
- {
- static Vox[ 32 ];
- num_to_word( g_iCount, Vox, charsmax( Vox ) );
- client_cmd( 0, "spk ^"vox/%s second%s^"", Vox, (g_iCount > 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 Contest will start in %i second%s!", szContests[ g_mItem ], g_iCount--, (g_iCount>1) ? "s" : "" );
- ColorPrint( 0, "%s Contest will start in %i second%s!", szContests[ g_mItem ], g_iCount--, (g_iCount>1) ? "s" : "" );
- set_task( 1.0, "taskStartContest", TASKID_CONTEST );
- }
- else
- {
- remove_task( TASKID_CONTEST );
- static i;
- static Num;
- static szHudMsg[ 256 ]
- static szPrintMsg[ 256 ];
- switch ( g_mItem )
- {
- case 0: // FW
- {
- Num = random_num( 2, 6 );
- formatex( szAnswer, charsmax( szAnswer ), g_szFirstChars[ random( sizeof g_szFirstChars ) ] );
- for ( i = 1; i <= Num; i++ )
- add( szAnswer, charsmax( szAnswer ), g_szFirstChars[ random( sizeof g_szFirstChars ) ] );
- formatex( szHudMsg, charsmax( szHudMsg ), "The first one to write the chars & digits wins!^n[ %s ]", szAnswer );
- formatex( szPrintMsg, charsmax( szPrintMsg ), "The first one to write the^3 chars^1 &^3 digits^1 wins:^4 %s^1.", szAnswer );
- }
- case 1: // TS
- {
- Num = random( sizeof g_szEngTrans );
- formatex( szAnswer, charsmax( szAnswer ), g_szEngTrans[ Num ] );
- formatex( szHudMsg, charsmax( szHudMsg ), "The first one to translate the word wins!^n[ %s ]", g_szHebTrans[ Num ] );
- formatex( szPrintMsg, charsmax( szPrintMsg ), "The first one to^3 translate^1 the word wins:^4 %s.", g_szHebTrans[ Num ] );
- }
- case 2: // ML
- {
- static szMissingL[ 128 ], szMissingLHeb[ 128 ];
- Num = random( sizeof g_szEngTrans );
- make_missing_letter( szMissingL, charsmax( szMissingL ), g_szEngTrans[ Num ] );
- make_missing_letter( szMissingLHeb, charsmax( szMissingLHeb ), g_szHebTrans[ Num ] );
- formatex( szAnswer, charsmax( szAnswer ), g_szEngTrans[ Num ] );
- formatex( szHudMsg, charsmax( szHudMsg ), "The first one to complete the word wins!^n%s [ %s ]", szMissingL, szMissingLHeb );
- formatex( szPrintMsg, charsmax( szPrintMsg ), "The first one to^3 complete^1 the word wins:^4 %s ^1[^3 %s ^1].", szMissingL, szMissingLHeb );
- }
- case 3: // MATH
- {
- static gRandomNumber[ 2 ];
- Num = random( 3 );
- switch ( Num )
- {
- case 0: // x
- {
- gRandomNumber[ 0 ] = random( 10 );
- gRandomNumber[ 1 ] = random( 10 );
- formatex( szAnswer, charsmax( szAnswer ), "%i", gRandomNumber[ 0 ] * gRandomNumber[ 1 ] );
- formatex( szHudMsg, charsmax( szHudMsg ), "The first one to solve the equation wins!^n%i * %i = ?", gRandomNumber[ 0 ], gRandomNumber[ 1 ] );
- formatex( szPrintMsg, charsmax( szPrintMsg ), "The first one to^3 solve^1 the^3 equation^1 wins:^4 %i^3 *^4 %i^1 =^3 ?^1.", gRandomNumber[ 0 ], gRandomNumber[ 1 ] );
- }
- case 1: // +
- {
- gRandomNumber[ 0 ] = random( 400 );
- gRandomNumber[ 1 ] = random( 400 );
- formatex( szAnswer, charsmax( szAnswer ), "%i", gRandomNumber[ 0 ] + gRandomNumber[ 1 ] );
- formatex( szHudMsg, charsmax( szHudMsg ), "The first one to solve the equation wins!^n%i + %i = ?", gRandomNumber[ 0 ], gRandomNumber[ 1 ] );
- formatex( szPrintMsg, charsmax( szPrintMsg ), "The first one to^3 solve^1 the^3 equation^1 wins:^4 %i^3 +^4 %i^1 =^3 ?^1.", gRandomNumber[ 0 ], gRandomNumber[ 1 ] );
- }
- case 2: // -
- {
- gRandomNumber[ 0 ] = random_num( 200, 400 );
- gRandomNumber[ 1 ] = random_num( 0, 200 );
- formatex( szAnswer, charsmax( szAnswer ), "%i", gRandomNumber[ 0 ] - gRandomNumber[ 1 ] );
- formatex( szHudMsg, charsmax( szHudMsg ), "The first one to solve the equation wins!^n%i - %i = ?", gRandomNumber[ 0 ], gRandomNumber[ 1 ] );
- formatex( szPrintMsg, charsmax( szPrintMsg ), "The first one to^3 solve^1 the^3 equation^1 wins:^4 %i^3 -^4 %i^1 =^3 ?^1.", gRandomNumber[ 0 ], gRandomNumber[ 1 ] );
- }
- }
- }
- case 4: // TR
- {
- static szAddMsg[ 32 ];
- formatex( szAnswer, charsmax( szAnswer ), g_szEngTrans[ random( sizeof g_szEngTrans ) ] );
- for ( i = 1; i < 8; i++ )
- {
- formatex( szAddMsg, charsmax( szAddMsg ), " %s", g_szEngTrans[ random( sizeof g_szEngTrans ) ] );
- add( szAnswer, charsmax( szAnswer ), szAddMsg );
- }
- formatex( szHudMsg, charsmax( szHudMsg ), "Type the sentence as fast as you can!^n%s", szAnswer );
- }
- }
- set_hudmessage( 255, 0, 0, -1.0, 0.35, 1, 6.0, 20.0, 0.1, 0.1, -1 );
- show_hudmessage( 0, szHudMsg );
- if ( g_mItem != 4 )
- ColorPrint( 0, szPrintMsg );
- bAllow = true;
- }
- }
- /* Stocks */
- stock ColorPrint( const index, const string[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "^4[%s]^1 ", szPrefix );
- 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 szName( const index )
- {
- static g_szName[ 32 ];
- get_user_name( index, g_szName, charsmax( g_szName ) );
- return g_szName;
- }
- stock make_missing_letter( output[], len, word[] )
- {
- static g_mItems[ 5 ][ 128 ], ran;
- formatex( g_mItems[ 0 ], 127, word ); // get the word "Apples"
- ran = random_num( 1, ( strlen( g_mItems[ 0 ] ) - 1 ) ); // get "p"
- formatex( g_mItems[ 1 ], 127, "%s", g_mItems[ 0 ][ ran + 1 ] ); // save "les"
- ReverseString( g_mItems[ 0 ], g_mItems[ 2 ] ); // Reverse "Apples" to "selppA"
- formatex( g_mItems[ 3 ], 127, g_mItems[ 2 ][ strlen( g_mItems[ 0 ] ) - ran ] ); // 6-2=4 to save "pA"
- ReverseString( g_mItems[ 3 ], g_mItems[ 4 ] ); // Reverse "pA" to "Ap"
- formatex( output, len, "%s_%s", g_mItems[ 4 ], g_mItems[ 1 ] );
- }
- stock ReverseString( String[], toString[] )
- {
- new i, j;
- for( i = strlen( String ) - 1, j = 0; i >= 0; i--, j++ )
- toString[ j ] = String[ i ];
- toString[ j ] = '^0';
- return toString;
- }
- stock get_other_player( const index )
- {
- if ( g_mPlayer[ 0 ] == index )
- return g_mPlayer[ 1 ];
- else if ( g_mPlayer[ 1 ] == index )
- return g_mPlayer[ 0 ];
- return -1;
- }
- stock get_user_winner( const index )
- {
- remove_task( TASKID_CONTEST );
- bActive = false;
- bAllow = false;
- IsPlaying[ index ] = false;
- static client;
- client = get_other_player( index );
- ColorPrint( 0, "^3%s^1 has won the^3 last-request^1 against^4 %s^1!", szName( index ), szName( client ) );
- fm_set_user_freeze( client, 1 );
- fm_give_item( index, "weapon_deagle" );
- cs_set_user_bpammo( index, CSW_DEAGLE, 35 );
- ice_entity( client );
- }
- stock fm_set_user_freeze( const index, freeze = 0 )
- {
- set_pev( index, pev_flags, ( freeze == 0 ) ? pev( index, pev_flags ) & ~FL_FROZEN : pev( index , pev_flags ) | FL_FROZEN );
- }
- stock ice_entity( const index )
- {
- static ent;
- static Float:iOrigin[ 3 ]
- if ( !is_user_alive( index ) )
- return;
- pev( index, pev_origin, iOrigin );
- if ( pev( index, pev_flags ) & FL_DUCKING )
- iOrigin[ 2 ] -= 15.0;
- else
- iOrigin[ 2 ] -= 35.0;
- ent = create_entity( "info_target" );
- set_pev( ent, pev_classname, "FrostBoy" );
- entity_set_model( ent, ice_model );
- dllfunc( DLLFunc_Spawn, ent );
- set_pev( ent, pev_solid, SOLID_BBOX );
- set_pev( ent, pev_movetype, MOVETYPE_FLY );
- entity_set_origin( ent, iOrigin );
- entity_set_size( ent, Float:{ -3.0, -3.0, -3.0 }, Float:{ 3.0, 3.0, 3.0 } );
- set_pev( ent, pev_iuser3, index );
- set_pev( ent, pev_team, 6969 );
- set_rendering( ent, kRenderFxNone, 255, 255, 255, kRenderTransAdd, 255 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement