06.08.2018, 01:49
Well the command and everything works it just doens't load the ban somehow when the player connects
OnPlayerConnect
CheckPlayerAccount
CheckPlayerBan
OnPlayerConnect
PHP код:
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);
PHP код:
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 );
PHP код:
/*
#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 );
}
}