Rejack

Jailbreak: Games API

Jan 8th, 2017 (edited)
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 15.05 KB | None | 0 0
  1. /* Includes */
  2.  
  3. #include < amxmodx >
  4. #include < jbGamesAPI >
  5.  
  6. /* Defines */
  7.  
  8. #define TASKID_COUNTDOWN    12375       // Do not touch
  9. #define TASKID_TIMEOVER     15676       // Do not touch
  10.  
  11. #define START_TIMER     5       // Countdown timer before starting a contest
  12.  
  13. #define DEFAULT_LOWEST      1       // The lowest number possible on 'Closest Number'
  14. #define CLOSEST_NUMBER_MAX_MAX  150     // The maximum number for 'Closest Number'
  15. #define CLOSEST_NUMBER_MIN_MAX  20      // The minimum number for the maximum number for 'Closest Number'
  16.  
  17. #define FIRSTWRITE_MIN_LETTERS  1       // Minimum amount of numbers on 'Firstwrites'
  18. #define FIRSTWRITE_MAX_LETTERS  6       // Maximum amount numbers on 'Firstwrites'
  19.  
  20. #define TYPERACE_WORDS      8       // Amount of the (If changed need to be changed in line 210 as well)
  21.  
  22. /* Enums */
  23.  
  24. enum _: GAMES_VARS
  25. {
  26.     GAME,
  27.     WIN,
  28.     END,
  29.     TIMER,
  30.     CN_NUMBERS,
  31.     CN_WINNER
  32. };
  33.  
  34. enum _: WORDS_DATA
  35. {
  36.     g_mEnglish[ 30 ],
  37.     g_mHebrew[ 30 ]
  38. };
  39.  
  40. /* Arrays */
  41.  
  42. new Array: g_aWords;
  43.  
  44. /* Variables */
  45.  
  46. new g_iVars[ GAMES_VARS ];
  47. new g_iWords[ WORDS_DATA ];
  48.  
  49. new g_mNumber[ 33 ];
  50. new szSolution[ 128 ];
  51.  
  52. /* Forwards */
  53.  
  54. new g_iForwardClientWin;
  55. new g_iForwardGameEnd;
  56. new g_iForwardReturn;
  57.  
  58. /* Booleans */
  59.  
  60. new bool: bAllow;
  61.  
  62. /* Plugin Start */
  63.  
  64. public plugin_init()
  65. {
  66.     register_plugin( "Jailbreak: Games API", "1.0", "Rejack" );
  67.    
  68.     register_clcmd( "say", "cmdSay" );
  69.    
  70.     g_iForwardClientWin = CreateMultiForward( "fwGamesWinner", ET_IGNORE, FP_CELL );
  71.     g_iForwardGameEnd   = CreateMultiForward( "fwGamesEnd", ET_IGNORE, FP_CELL );
  72.    
  73.     /* Fail safes */
  74.    
  75.     if ( LoadWordsFromFile() == -1 )
  76.         set_fail_state( "ERROR: FILE NOT FOUND!" );
  77.    
  78.     if ( ArraySize( g_aWords ) < TYPERACE_WORDS )
  79.         set_fail_state( "ERROR: NOT ENOUGH WORDS!" );
  80.    
  81.     if ( g_iForwardClientWin < 0 )
  82.         set_fail_state( "ERROR: FORWARD NOT CREATED! <fwGamesWinner>" );
  83. }
  84.  
  85. public plugin_end()
  86. {
  87.     DestroyForward( g_iForwardClientWin );
  88.     DestroyForward( g_iForwardGameEnd );
  89. }
  90.  
  91. public plugin_natives()
  92. {
  93.     register_native( "start_game",      "_start_game" );
  94.     register_native( "end_game",        "_end_game" );
  95.    
  96.     register_native( "get_game_type",   "_get_game_type" );
  97.     register_native( "get_game_purpose",    "_get_game_purpose" );
  98.     register_native( "get_end_reason",  "_get_end_reason" );
  99.    
  100.     register_native( "is_game_active",  "_is_game_active" );
  101.     register_native( "is_game_allowed", "_is_game_allowed" );
  102. }
  103.  
  104. /* Natives */
  105.  
  106. public _start_game( plugin, params )
  107. {
  108.     if ( is_game_active() )
  109.         return 0;   // Failure - already started
  110.        
  111.     g_iVars[ GAME ]     = get_param( 1 );
  112.     g_iVars[ WIN ]      = get_param( 2 );
  113.    
  114.     // Reset games
  115.    
  116.     g_iVars[ TIMER ]    = START_TIMER;
  117.    
  118.     bAllow          = false;
  119.    
  120.     szSolution      = "unknown solution";
  121.    
  122.     if ( get_game_type() == GAME_CLOSEST_NUMBER )
  123.     {
  124.         g_iVars[ CN_NUMBERS ]   = 0;
  125.        
  126.         static i, iNum, Players[ 32 ];
  127.        
  128.         get_players( Players, iNum, "ch" );
  129.        
  130.         for ( i = 0; i < iNum; i++ )
  131.             g_mNumber[ Players[ i ] ]   = -1;
  132.        
  133.         g_iVars[ CN_WINNER ]    = random_num( CLOSEST_NUMBER_MIN_MAX, CLOSEST_NUMBER_MAX_MAX );
  134.     }
  135.    
  136.     else
  137.         set_task( 15.0, "taskTimeover", TASKID_TIMEOVER );
  138.    
  139.     TaskCountdown();
  140.    
  141.     return 1;   // Success
  142. }
  143.  
  144. public _end_game( plugin, params )
  145. {
  146.     if ( task_exists( TASKID_COUNTDOWN ) )
  147.         remove_task( TASKID_COUNTDOWN );
  148.    
  149.     if ( task_exists( TASKID_TIMEOVER ) )
  150.         remove_task( TASKID_TIMEOVER );
  151.    
  152.     g_iVars[ END ]      = get_param( 1 );
  153.    
  154.     bAllow          = false;
  155.    
  156.     g_iVars[ GAME ]     = 0;
  157.     g_iVars[ WIN ]      = 0;
  158.     g_iVars[ TIMER ]    = 0;
  159.    
  160.     szSolution      = "unknown solution";
  161.    
  162.     if ( !ExecuteForward( g_iForwardGameEnd, g_iForwardReturn, get_end_reason() ) )
  163.         set_fail_state( "ERROR: FORWARD NOT EXECUTED! <fwGamesEnd>:" );
  164. }
  165.  
  166. public _get_game_type( plugin, params )
  167. {
  168.     return g_iVars[ GAME ];
  169. }
  170.  
  171. public _get_game_purpose( plugin, params )
  172. {
  173.     return g_iVars[ WIN ];
  174. }
  175.  
  176. public _get_end_reason( plugin, params )
  177. {
  178.     return g_iVars[ END ];
  179. }
  180.  
  181. public bool: _is_game_active( plugin, params )
  182. {
  183.     return ( get_game_type() == 0 ) ? false : true;
  184. }
  185.  
  186. public bool: _is_game_allowed( plugin, params )
  187. {
  188.     return bAllow;
  189. }
  190.  
  191. /* Client side */
  192.  
  193. public client_putinserver( client )
  194. {
  195.     g_mNumber[ client ] = -1;
  196. }
  197.  
  198. public client_disconnect( client )
  199. {
  200.     if ( get_game_type() == GAME_CLOSEST_NUMBER && g_mNumber[ client ] != -1 )
  201.         g_iVars[ CN_NUMBERS ]--;
  202. }
  203.  
  204. public cmdSay( const client )
  205. {
  206.     if ( !is_user_connected( client ) )
  207.         return 1;
  208.    
  209.     if ( !is_game_active() )
  210.         return 0;
  211.    
  212.     if ( get_game_purpose() == GAME_PLAYERS )
  213.     {
  214.         if ( get_user_team( client ) != 1 )
  215.             return 0;
  216.     }
  217.    
  218.     if ( get_game_purpose() == GAME_LR )
  219.     {
  220.     }
  221.    
  222.     if ( get_game_purpose() == GAME_CT || get_game_purpose() == GAME_EVENT )
  223.     {
  224.         if ( get_user_team( client ) != 1 || !is_user_alive( client ) )
  225.             return 0;
  226.        
  227.     }
  228.    
  229.     new szMsg[ 192 ]
  230.    
  231.     read_argv( 1, szMsg, charsmax( szMsg ) );
  232.    
  233.     if ( get_game_type() == GAME_CLOSEST_NUMBER )
  234.     {
  235.         if ( !is_str_num( szMsg ) )
  236.             return 0;
  237.        
  238.         if ( g_mNumber[ client ] != -1 )
  239.             return 0;
  240.        
  241.         static gNumber;
  242.        
  243.         gNumber = str_to_num( szMsg );
  244.        
  245.         if ( gNumber < 1 )
  246.             return ColorPrint( client, "You need to pick a number higher than^4 1^1." );
  247.        
  248.         if ( gNumber > g_iVars[ CN_WINNER ] )
  249.             return ColorPrint( client, "You need to pick a number lower than^4 %i^1.", g_iVars[ CN_WINNER ] );
  250.        
  251.         static Players[ 32 ]
  252.         static index, i, iNum;
  253.        
  254.         get_players( Players, iNum, "ch" );
  255.        
  256.         for ( i = 0; i < iNum; i++ )
  257.         {
  258.             index   = Players[ i ];
  259.            
  260.             if ( gNumber == g_mNumber[ index ] )
  261.             {
  262.                 ColorPrint( client, "Someone has already picked that number." );
  263.                
  264.                 return 1;
  265.             }
  266.         }
  267.        
  268.         g_mNumber[ client ] = gNumber;
  269.        
  270.         g_iVars[ CN_NUMBERS ]++;
  271.        
  272.         return ColorPrint( 0, "^3%s^1 has picked the number^4 #%i^1.", szName( client ), gNumber );
  273.     }
  274.    
  275.     if ( !is_game_allowed() )
  276.         return 0;
  277.    
  278.     if ( get_game_type() == GAME_TYPE_RACE )
  279.     {
  280.         new szArgs[ 2 ][ TYPERACE_WORDS ][ 32 ];
  281.         static i;
  282.        
  283.         parse( szMsg,
  284.         szArgs[ 0 ][ 0 ], 31, szArgs[ 0 ][ 1 ], 31, szArgs[ 0 ][ 2 ], 31, szArgs[ 0 ][ 3 ], 31,
  285.         szArgs[ 0 ][ 4 ], 31, szArgs[ 0 ][ 5 ], 31, szArgs[ 0 ][ 6 ], 31, szArgs[ 0 ][ 7 ], 31 );
  286.        
  287.         parse( szSolution,
  288.         szArgs[ 1 ][ 0 ], 31, szArgs[ 1 ][ 1 ], 31, szArgs[ 1 ][ 2 ], 31, szArgs[ 1 ][ 3 ], 31,
  289.         szArgs[ 1 ][ 4 ], 31, szArgs[ 1 ][ 5 ], 31, szArgs[ 1 ][ 6 ], 31, szArgs[ 1 ][ 7 ], 31 );
  290.        
  291.         for ( i = 0; i < TYPERACE_WORDS; i++ )
  292.         {
  293.             if ( equali( szArgs[ 0 ][ i ], szArgs[ 1 ][ i ] ) )
  294.                 continue;
  295.            
  296.             else
  297.                 return 0;
  298.         }
  299.        
  300.         if ( !ExecuteForward( g_iForwardClientWin, g_iForwardReturn, client ) )
  301.             set_fail_state( "ERROR: FORWARD NOT EXECUTED! <fwGamesWinner>" );
  302.        
  303.         end_game( END_WIN );
  304.     }
  305.    
  306.     if ( equali( szMsg, szSolution ) )
  307.     {
  308.         if ( !ExecuteForward( g_iForwardClientWin, g_iForwardReturn, client ) )
  309.             set_fail_state( "ERROR: FORWARD NOT EXECUTED! <fwGamesWinner>" );
  310.        
  311.         end_game( END_WIN );
  312.        
  313.     }
  314.    
  315.     return 0;
  316. }
  317.  
  318. /* Tasks */
  319.  
  320. public TaskCountdown()
  321. {
  322.     static iTimer;
  323.     static szMsg[ 512 ];
  324.     szMsg   = "";
  325.    
  326.     iTimer  = g_iVars[ TIMER ];
  327.    
  328.     if ( iTimer <= 0 )
  329.     {
  330.         static i, szBuffer[ 32 ];
  331.        
  332.         switch ( get_game_type() )
  333.         {
  334.             case GAME_FIRSTWRITES:
  335.             {
  336.                 szSolution  = "";
  337.                
  338.                 for ( i = 0; i < random_num( FIRSTWRITE_MIN_LETTERS, FIRSTWRITE_MAX_LETTERS ); i++ )
  339.                 {
  340.                     num_to_str( random( 10 ), szBuffer, charsmax( szBuffer ) );
  341.                    
  342.                     add( szSolution, charsmax( szSolution ), szBuffer );
  343.                 }
  344.                
  345.                 formatex( szMsg, charsmax( szMsg ), "Winning combination is^n- %s -", szSolution );
  346.             }
  347.            
  348.             case GAME_TRANSLATE:
  349.             {
  350.                 ArrayGetArray( g_aWords, random( ArraySize( g_aWords ) ), g_iWords );
  351.                
  352.                 formatex( szSolution, charsmax( szSolution ), g_iWords[ g_mEnglish ] );
  353.                
  354.                 formatex( szMsg, charsmax( szMsg ), "Translate the word into English^n- %s -", g_iWords[ g_mHebrew ] );
  355.             }
  356.            
  357.             case GAME_MISSING_LETTER:
  358.             {
  359.                 ArrayGetArray( g_aWords, random( ArraySize( g_aWords ) ), g_iWords );
  360.                
  361.                 formatex( szSolution, charsmax( szSolution ), g_iWords[ g_mEnglish ] );
  362.                
  363.                 formatex( szBuffer, charsmax( szBuffer ), get_missing_letter( szSolution ) );
  364.                
  365.                 formatex( szMsg, charsmax( szMsg ), "Complete the missing letter^n- %s -", szBuffer );
  366.             }
  367.            
  368.             case GAME_CLOSEST_NUMBER:
  369.             {
  370.                 if ( g_iVars[ CN_NUMBERS ] < 1 )
  371.                 {
  372.                     end_game( END_DEFAULT );
  373.                    
  374.                     return ColorPrint( 0, "No one has participated in the^4 Closest number^1 contest." );
  375.                 }
  376.                
  377.                 static iNum, index;
  378.                
  379.                 g_iVars[ CN_WINNER ]    = random_num( DEFAULT_LOWEST, g_iVars[ CN_WINNER ] );
  380.                
  381.                 iNum    = g_iVars[ CN_WINNER ];
  382.                
  383.                 index   = findClosest( iNum );
  384.            
  385.                 if ( !ExecuteForward( g_iForwardClientWin, g_iForwardReturn, index ) )
  386.                     log_amx( "Error: Couldn't execute forward 'fwGamesWinner'." );
  387.                
  388.                 formatex( szMsg, charsmax( szMsg ), "%s won the Closest number contest with the number #%i^nThe closest number to #%i.", szName( index ), g_mNumber[ index ], iNum );
  389.                
  390.                 ColorPrint( 0, "^3%s^1 won the^4 Closest number^1 contest with the number^4 #%i^1, The closest number to^3 #%i^1.", szName( index ), g_mNumber[ index ], iNum );
  391.                
  392.                 end_game( END_WIN );
  393.             }
  394.            
  395.             case GAME_TYPE_RACE:
  396.             {
  397.                 szSolution  = "";
  398.                
  399.                 static iNum[ TYPERACE_WORDS ], z;
  400.                
  401.                 for ( i = 0; i < TYPERACE_WORDS; i++ )
  402.                 {
  403.                     TryAgain:
  404.                    
  405.                     iNum[ i ]   = random( ArraySize( g_aWords ) );
  406.                    
  407.                     for ( z = 0; z < i; z++ )           // Word repeating itself in a race.
  408.                     {
  409.                         if ( iNum[ i ] == iNum[ z ] )
  410.                             goto TryAgain;
  411.                     }
  412.                    
  413.                     ArrayGetArray( g_aWords, iNum[ i ], g_iWords );
  414.                    
  415.                     formatex( szBuffer, charsmax( szBuffer ), "%s%s", g_iWords[ g_mEnglish ], ( i == TYPERACE_WORDS - 1 ) ? "" : " " );
  416.                    
  417.                     add( szSolution, charsmax( szSolution ), szBuffer );
  418.                 }
  419.                
  420.                 formatex( szMsg, charsmax( szMsg ), "Fastest person to type the sentence wins^n%s", szSolution );
  421.             }
  422.            
  423.             case GAME_CONFUSED_WORDS:
  424.             {
  425.                 ArrayGetArray( g_aWords, random( ArraySize( g_aWords ) ), g_iWords );
  426.                
  427.                 formatex( szSolution, charsmax( szSolution ), g_iWords[ g_mEnglish ] );
  428.                
  429.                 formatex( szBuffer, charsmax( szBuffer ), g_iWords[ g_mEnglish ] );
  430.                
  431.                 str_shuffle( szBuffer );
  432.                
  433.                 formatex( szMsg, charsmax( szMsg ), "Figure out the scrambled word^n- %s -", szBuffer );
  434.             }
  435.            
  436.             case GAME_MATH:
  437.             {
  438.                 static iNum[ 3 ];
  439.                
  440.                 iNum[ 0 ]   = random( 250 );
  441.                 iNum[ 1 ]   = random( 250 );
  442.                 iNum[ 2 ]   = random( 2 );
  443.                
  444.                 if ( iNum[ 2 ] == 0 )
  445.                 {
  446.                     num_to_str( iNum[ 0 ] + iNum[ 1 ], szSolution, charsmax( szSolution ) );
  447.                    
  448.                     formatex( szMsg, charsmax( szMsg ), "Solve the equation^n%i + %i = ?", iNum[ 0 ], iNum[ 1 ] );
  449.                 }
  450.                
  451.                 else
  452.                 {
  453.                     num_to_str( iNum[ 0 ] - iNum[ 1 ], szSolution, charsmax( szSolution ) );
  454.                    
  455.                     formatex( szMsg, charsmax( szMsg ), "Solve the equation^n%i - %i = ?", iNum[ 0 ], iNum[ 1 ] );
  456.                 }
  457.             }
  458.         }
  459.        
  460.         bAllow  = true;
  461.        
  462.         set_hudmessage( 0, 255, 255, -1.0, 0.35, 0, 0.0, 12.0, 0.1, 0.1, 3 );
  463.         show_hudmessage( 0, szMsg );
  464.        
  465.         return 1;
  466.     }
  467.    
  468.     // Build customize message
  469.    
  470.     static szGameType[ 32 ], szTimer[ 16 ], szWinner[ 64 ];
  471.    
  472.     switch ( g_iVars[ WIN ] )
  473.     {
  474.         case GAME_LR:
  475.             szWinner    = "Winner wins the last request.";
  476.            
  477.         case GAME_CT:
  478.             szWinner    = "Winner win the contest.";
  479.        
  480.         case GAME_PLAYERS:
  481.             szWinner    = "Winner moves to the guards team.";
  482.     }
  483.    
  484.     add( szMsg, charsmax( szMsg ), "Jailbreak Games^n" );
  485.     add( szMsg, charsmax( szMsg ), "-----------------------^n" );
  486.    
  487.     formatex( szGameType, charsmax( szGameType ), "%s contest^n", szEvents[ get_game_type() ] );
  488.     add( szMsg, charsmax( szMsg ), szGameType );
  489.    
  490.     if ( get_game_type() == GAME_CLOSEST_NUMBER )
  491.     {
  492.         static szBuffer[ 64 ];
  493.        
  494.         formatex( szBuffer, charsmax( szBuffer ), "Guess a number between %i-%i^n", DEFAULT_LOWEST, g_iVars[ CN_WINNER ] );
  495.         add( szMsg, charsmax( szMsg ), szBuffer );
  496.     }
  497.    
  498.     formatex( szTimer, charsmax( szTimer ), "%i second%s^n", iTimer, ( iTimer < 2 ) ? "" : "s" );
  499.     add( szMsg, charsmax( szMsg ), szTimer );
  500.    
  501.     add( szMsg, charsmax( szMsg ), "-----------------------^n" );
  502.     add( szMsg, charsmax( szMsg ), szWinner );
  503.    
  504.     set_hudmessage( 0, 255, 255, -1.0, 0.15, 0, 0.0, 1.0, 0.1, 0.1, 3 );
  505.     show_hudmessage( 0, szMsg );
  506.    
  507.     g_iVars[ TIMER ]--;
  508.    
  509.     static Vox[ 32 ];
  510.    
  511.     num_to_word( iTimer, Vox, charsmax( Vox ) );
  512.    
  513.     client_cmd( 0, "spk ^"vox/%s^"", Vox );
  514.    
  515.     set_task( 1.0, "TaskCountdown", TASKID_COUNTDOWN );
  516.    
  517.     return 1;
  518. }
  519.  
  520. public taskTimeover( )
  521. {
  522.     ColorPrint( 0, "^3%s^1 contest has stopeed because no one has answered.", szEvents[ get_game_type() ] );
  523.    
  524.     end_game( END_DEFAULT );
  525.    
  526. }
  527.  
  528. /* Stocks */
  529.  
  530. stock LoadWordsFromFile( )
  531. {
  532.     static szFile[ 64 ];
  533.    
  534.     get_configsdir( szFile, charsmax( szFile ) );
  535.    
  536.     format( szFile, charsmax( szFile ), "%s/jbGames.cfg", szFile );
  537.    
  538.     if ( !file_exists( szFile ) )
  539.     {
  540.         log_amx( "Jailbreak Games - File '%s' was not found!", szFile );
  541.        
  542.         return -1;
  543.     }
  544.    
  545.     g_aWords = ArrayCreate( WORDS_DATA );
  546.    
  547.     static iFile;
  548.     static szBuffer[ 64 ];
  549.    
  550.     iFile = fopen( szFile, "rt" );
  551.    
  552.     while ( !feof( iFile ) )
  553.     {
  554.         fgets( iFile, szBuffer, charsmax( szBuffer ) );
  555.        
  556.         trim( szBuffer );
  557.        
  558.         if ( szBuffer[ 0 ] == ';' || equali( szBuffer, "//", 2 ) || strlen( szBuffer ) < 3 )
  559.             continue;
  560.        
  561.         parse( szBuffer, g_iWords[ g_mEnglish ], charsmax( g_iWords[ g_mEnglish ] ), g_iWords[ g_mHebrew ], charsmax( g_iWords[ g_mHebrew ] ) );
  562.        
  563.         remove_quotes( g_iWords[ g_mEnglish ] );
  564.        
  565.         remove_quotes( g_iWords[ g_mHebrew ] );
  566.        
  567.         ArrayPushArray( g_aWords, g_iWords );
  568.     }
  569.    
  570.     return 1;
  571. }
  572.  
  573. stock findClosest( num )
  574. {
  575.     static Players[ 32 ];
  576.     static index, i, lowest, iNum;
  577.     static iAttempt;
  578.    
  579.     iAttempt    = 0;
  580.    
  581.     TryAgain:
  582.    
  583.     lowest      = DEFAULT_LOWEST;
  584.    
  585.     get_players( Players, iNum, "ch" );
  586.    
  587.     for ( i = 0; i < iNum; i++ )
  588.     {
  589.         index   = Players[ i ];
  590.        
  591.         if ( abs( num - ( g_mNumber[ index ] ) ) < abs( num - lowest ) )
  592.         {
  593.             lowest  = g_mNumber[ index ];
  594.         }
  595.     }
  596.    
  597.     if ( iAttempt == 5 )
  598.     {
  599.         ColorPrint( 0, "^3ERROR^1: Closest number failed. Please alert server management." );
  600.        
  601.         end_game( END_DEFAULT );
  602.     }
  603.    
  604.     if ( !is_user_connected( index ) )
  605.     {
  606.         iAttempt++;
  607.        
  608.         goto TryAgain;
  609.     }
  610.    
  611.     return index;
  612. }
  613.  
  614. stock get_missing_letter( const String[] )
  615. {
  616.     static szBuffer[ 2 ][ 32 ], szReturn[ 32 ];
  617.     static iNum, Max;
  618.    
  619.     formatex( szBuffer[ 0 ], charsmax( szBuffer[] ), String );
  620.     formatex( szBuffer[ 1 ], charsmax( szBuffer[] ), String );
  621.    
  622.     Max = strlen( String );
  623.     iNum    = random( Max );
  624.    
  625.     replace( szBuffer[ 0 ], charsmax( szBuffer[] ), szBuffer[ 0 ][ iNum ], "_" );
  626.    
  627.     formatex( szReturn, charsmax( szReturn ), "%s%s", szBuffer[ 0 ], szBuffer[ 1 ][ iNum + 1 ] );
  628.    
  629.     return szReturn;
  630. }
  631.  
  632. stock str_shuffle( String[] )
  633. {
  634.     static iLen;
  635.    
  636.     iLen    = strlen( String );
  637.    
  638.     SortCustom1D( String, iLen, "_str_shuffle" );
  639.    
  640.     return iLen;
  641. }
  642.  
  643. public _str_shuffle( item1, item2, array[] )
  644. {
  645.     return ( ( random( 2 ) * 2 ) - 1 );
  646. }
  647.  
  648. stock access( const index, const flag )
  649. {
  650.     return ( get_user_flags( index ) & flag );
  651. }
  652.  
  653. stock get_configsdir( name[ ], len )
  654. {
  655.     return get_localinfo( "amxx_configsdir", name, len );
  656. }
Advertisement
Add Comment
Please, Sign In to add comment