Advertisement
Guest User

Untitled

a guest
Dec 13th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.45 KB | None | 0 0
  1. /* BANCHECK */
  2.     {
  3.         pBanInfo[ playerid ][ bYear ] = -1;
  4.  
  5.         INI_ParseFile( "banlist.ini", "BannedPlayers", .bExtra = true, .extra = playerid, .bPassTag = true ); //load file
  6.  
  7.         if( pBanInfo[ playerid ][ bYear ] == -1 )
  8.             goto BANCHECK_DONE;
  9.  
  10.         new
  11.             year,
  12.             month,
  13.             day,
  14.             hour,
  15.             minute,
  16.             second,
  17.             banString[ 128 ];
  18.  
  19.         getdate( year, month, day );
  20.         gettime( hour, minute, second );
  21.  
  22.         if( year == pBanInfo[ playerid ][ bYear ] )
  23.         {
  24.             if( month == pBanInfo[ playerid ][ bMonth ] )
  25.             {
  26.                 if( day == pBanInfo[ playerid ][ bDay ] )
  27.                 {
  28.                     if( hour == pBanInfo[ playerid ][ bHour ] )
  29.                     {
  30.                         if( minute >= pBanInfo[ playerid ][ bMinute ] )
  31.                             goto NOTBANNED;
  32.                         else
  33.                             goto BANNED;
  34.                     }
  35.                     else if( hour > pBanInfo[ playerid ][ bHour ] )
  36.                         goto NOTBANNED;
  37.                     else
  38.                         goto BANNED;
  39.                 }
  40.                 else if( day > pBanInfo[ playerid ][ bDay ] )
  41.                     goto NOTBANNED;
  42.                 else
  43.                     goto BANNED;
  44.             }
  45.             else if( month > pBanInfo[ playerid ][ bMonth ] )
  46.                 goto NOTBANNED;
  47.             else
  48.                 goto BANNED;
  49.         }
  50.         else if( pBanInfo[ playerid ][ bYear ] == 0 )
  51.             goto PERMBANNED;
  52.         else if( year > pBanInfo[ playerid ][ bYear ] )
  53.             goto NOTBANNED;
  54.         else
  55.             goto BANNED;
  56.  
  57.         PERMBANNED:
  58.         {
  59.             SendClientMessage( playerid, COLOR_RED, "[ERROR] You are PERMANENTLY banned from this server." );
  60.             SendClientMessage( playerid, COLOR_RED, "The ban will never be lifted." );
  61.             Kick( playerid );
  62.             goto BANCHECK_DONE;
  63.         }
  64.  
  65.  
  66.         BANNED:
  67.         {
  68.             SendClientMessage( playerid, COLOR_RED, "[ERROR] You are banned from this server." );
  69.             format( banString, sizeof( banString ), "The ban will be lifted: %s %02i, %i - %02i:%02i server time.", MonthDateToName( pBanInfo[ playerid ][ bMonth ] ), pBanInfo[ playerid ][ bDay ], pBanInfo[ playerid ][ bYear ], pBanInfo[ playerid ][ bHour ], pBanInfo[ playerid ][ bMinute ] );
  70.             SendClientMessage( playerid, COLOR_RED, banString );
  71.             Kick( playerid );
  72.             goto BANCHECK_DONE;
  73.         }
  74.  
  75.         NOTBANNED:
  76.         {
  77.             new
  78.                 INI:banFile = INI_Open( "banlist.ini" );
  79.  
  80.             INI_DeleteTag( banFile, PlayerName( playerid ));
  81.             INI_Close( banFile );
  82.  
  83.             new
  84.                 INI:pFile = INI_Open( UserPath( playerid ));
  85.  
  86.             INI_SetTag( pFile, "data" );
  87.             INI_WriteBool( pFile, "banned", false );
  88.             INI_Close( pFile );
  89.  
  90.             printf( "Entry removed from banlist.ini (expiration): %s", PlayerName( playerid ));
  91.         }
  92.     }
  93.  
  94.     BANCHECK_DONE:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement