Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* BANCHECK */
- {
- pBanInfo[ playerid ][ bYear ] = -1;
- INI_ParseFile( "banlist.ini", "BannedPlayers", .bExtra = true, .extra = playerid, .bPassTag = true ); //load file
- if( pBanInfo[ playerid ][ bYear ] == -1 )
- goto BANCHECK_DONE;
- new
- year,
- month,
- day,
- hour,
- minute,
- second,
- banString[ 128 ];
- getdate( year, month, day );
- gettime( hour, minute, second );
- if( year == pBanInfo[ playerid ][ bYear ] )
- {
- if( month == pBanInfo[ playerid ][ bMonth ] )
- {
- if( day == pBanInfo[ playerid ][ bDay ] )
- {
- if( hour == pBanInfo[ playerid ][ bHour ] )
- {
- if( minute >= pBanInfo[ playerid ][ bMinute ] )
- goto NOTBANNED;
- else
- goto BANNED;
- }
- else if( hour > pBanInfo[ playerid ][ bHour ] )
- goto NOTBANNED;
- else
- goto BANNED;
- }
- else if( day > pBanInfo[ playerid ][ bDay ] )
- goto NOTBANNED;
- else
- goto BANNED;
- }
- else if( month > pBanInfo[ playerid ][ bMonth ] )
- goto NOTBANNED;
- else
- goto BANNED;
- }
- else if( pBanInfo[ playerid ][ bYear ] == 0 )
- goto PERMBANNED;
- else if( year > pBanInfo[ playerid ][ bYear ] )
- goto NOTBANNED;
- else
- goto BANNED;
- PERMBANNED:
- {
- SendClientMessage( playerid, COLOR_RED, "[ERROR] You are PERMANENTLY banned from this server." );
- SendClientMessage( playerid, COLOR_RED, "The ban will never be lifted." );
- Kick( playerid );
- goto BANCHECK_DONE;
- }
- BANNED:
- {
- SendClientMessage( playerid, COLOR_RED, "[ERROR] You are banned from this server." );
- 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 ] );
- SendClientMessage( playerid, COLOR_RED, banString );
- Kick( playerid );
- goto BANCHECK_DONE;
- }
- NOTBANNED:
- {
- new
- INI:banFile = INI_Open( "banlist.ini" );
- INI_DeleteTag( banFile, PlayerName( playerid ));
- INI_Close( banFile );
- new
- INI:pFile = INI_Open( UserPath( playerid ));
- INI_SetTag( pFile, "data" );
- INI_WriteBool( pFile, "banned", false );
- INI_Close( pFile );
- printf( "Entry removed from banlist.ini (expiration): %s", PlayerName( playerid ));
- }
- }
- BANCHECK_DONE:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement