new query[200];
mysql_format(SQL, query, sizeof(query), "SELECT * FROM `users` WHERE `name` = '%e' LIMIT 1", GetName(playerid));
mysql_pquery(SQL, query, "CheckPlayerAccount", "i", playerid);
new q[128];
mysql_format( SQL, q, sizeof(q), "SELECT * FROM `banned` WHERE `user_id` = '%d' LIMIT 1", PlayerInfo[playerid][pSqlID] );
mysql_pquery( SQL, q, "CheckPlayerBan", "i", playerid );
/*
#define FUNCTION:%0(%1) \
forward%0(%1); \
public%0(%1)
*/
FUNCTION: CheckPlayerBan( playerid ) {
new rows;
cache_get_row_count(rows);
if( !rows ) {
SetTimerEx( "Login", 100, false, "d", playerid ); // the login dialog and stuff
}
else {
new user_id;
user_id = cache_get_value_name_int( 0, "user_id", user_id );
new ban_reason[ 64 ], ban_date[ 64 ], ban_admin[ MAX_PLAYER_NAME ];
cache_get_value_name( 0, "ban_reason", ban_reason, 150 );
cache_get_value_name( 0, "ban_date", ban_date, 150 );
cache_get_value_name( 0, "ban_admin", ban_admin, 150 );
if( user_id == PlayerInfo[ playerid ][ pSqlID ] ) {
SendClientMessage( playerid, RED, "BANNED");
AC_Kick2( playerid );
/*
stock AC_Kick2(playerid)
{
SetTimerEx("TrueKick", 100, false, "i", playerid);
GameTextForPlayer(playerid, "~r~Kicked", 60000, 4);
TogglePlayerControllable(playerid, 0);
}
*/
return 1;
}
else SetTimerEx( "Login", 100, false, "d", playerid );
}
}
Looks like this happends only when I (ID: 0) ban someone I don't know why tho...
|
cmd:pban(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] < 1338) return SendClientMessage(playerid, RED, "Not allowed!");
new id, reason[ 40 ];
if( sscanf( params,"us[40]", id, reason ) ) return SendClientMessage( playerid, RED, "USAGE: /pban [ ID ] [ Reason ]");
if( !IsPlayerConnected( id ) ) return SendClientMessage( playerid, RED, " Wrong ID");
sql_ban_user( GetName( id ), PlayerInfo[ id ][ pSqlID ], 1, reason, GetName( playerid ) );
AC_Kick2( id );
return true;
}
// -- //
sql_ban_user( user_name[], user_id, ban_type, ban_reason[], admin_name[], ban_time = 0 ) {
new query[ 512 ], ban_date[ 64 ], tmphour, tmpminute, tmpsecond, year, month,day;
getdate( year, month, day );
gettimeEx( tmphour, tmpminute, tmpsecond );
FixHour( tmphour );
tmphour = shifthour;
format( ban_date, sizeof( ban_date ), "%02d/%02d/%d - %d/%d/%d", day, month, year, tmphour, tmpminute, tmpsecond );
mysql_format( SQL, query, sizeof( query ), "INSERT INTO `banned` (user_id, ban_type, ban_reason, ban_admin, ban_date, user_name) VALUES('%d', '%d', '%e', '%e', '%e', '%e')",
user_id, ban_type, ban_reason, admin_name, ban_date, user_name );
mysql_tquery( SQL, query );
return (true);
}
PAdm(ZUTA, porukica);
AC_Kick2( id );
SS[0][ssBanovi]++;
SacuvajStatistiku(0);
return true;
}
user_id = cache_get_value_name_int( 0, "user_id", user_id );
if( user_id == PlayerInfo[ playerid ][ pSqlID ] )
Код:
user_id = cache_get_value_name_int( 0, "user_id", user_id ); pawn Код:
|