Rejack

Jailbreak: Games API - Include

Jan 8th, 2017 (edited)
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.80 KB | None | 0 0
  1. // Need to add lr players participation
  2. // Need to add glow to winner based on purpose
  3.  
  4. new const szPrefix[ ]   = "AMXX";
  5.  
  6. enum _: GAMES_DATA
  7. {
  8.     GAME_FIRSTWRITES    = 1,
  9.     GAME_TRANSLATE,
  10.     GAME_MISSING_LETTER,
  11.     GAME_CLOSEST_NUMBER,
  12.     GAME_TYPE_RACE,
  13.     GAME_CONFUSED_WORDS,
  14.     GAME_MATH
  15. };
  16.  
  17. enum _: GAMES_PURPOSE
  18. {
  19.     GAME_LR,        // On last request
  20.     GAME_CT,        // Initiated by CTs
  21.     GAME_PLAYERS,       // To become a guard
  22.     GAME_EVENT      // Events by owners (add cash bonus)
  23. };
  24.  
  25. enum _: GAME_END
  26. {
  27.     END_DEFAULT,        // Ended because no one answered
  28.     END_STOP,       // Stopped
  29.     END_WIN         // Someone won the contest
  30. };
  31.  
  32. new szEvents[ GAMES_DATA ][ 32 ]    =
  33. {
  34.     "N/A",
  35.     "Firstwrites",
  36.     "Translate",
  37.     "Missing letter",
  38.     "Closest number",
  39.     "Type race",
  40.     "Confused words",
  41.     "Mathematics"
  42. };
  43.  
  44. native  start_game( Game = GAME_FIRSTWRITES, WinType = GAME_CT );
  45. native  end_game( Reason = END_DEFAULT );
  46.  
  47. native  get_game_type();
  48. native  get_game_purpose();
  49. native  get_end_reason();
  50.  
  51. native  bool: is_game_active();
  52. native  bool: is_game_allowed();
  53.  
  54. stock ColorPrint( const index, const string[], any:... )
  55. {
  56.     new szMsg[ 512 ], Players[ 32 ], PNum = 1;
  57.    
  58.     static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "^4[%s]^1 ", szPrefix );
  59.    
  60.     vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
  61.    
  62.     if ( index )
  63.         Players[ 0 ] = index;
  64.    
  65.     else
  66.         get_players( Players, PNum, "ch" );
  67.    
  68.     for ( new i; i < PNum; i++ )
  69.     {
  70.         if( is_user_connected( Players[ i ] ) )
  71.         {
  72.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
  73.            
  74.             write_byte( Players[ i ] );
  75.            
  76.             write_string( szMsg );
  77.            
  78.             message_end( );
  79.         }
  80.     }
  81.    
  82.     return 1;
  83. }
  84.  
  85. stock szName( const index )
  86. {
  87.     static g_szName[ 32 ];
  88.    
  89.     get_user_name( index, g_szName, charsmax( g_szName ) );
  90.    
  91.     return g_szName;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment