2021-03-23, 12:37 PM
(2021-03-23, 08:42 AM)Genon_May Wrote: Hey, im wondering does anyone know where i can find a whitelist system for samp. There used to be a few on the samp forums but cant reach them right now since they are down. If anyone knows where i can find one (english version) i would be very grateful
If you use MySQL, the initial logic of the system would be this:
PHP Code:
public OnPlayerConnect(playerid)
{
? ? ? new query[60], str[16];
? ? ? //?SQL query that checks if the player's IP is in the whitelist table
? ? ??GetPlayerIp(playerid, str, sizeof(str));
? ? ? mysql_format(ConexaoSQL, query, sizeof(query), "SELECT `*` FROM `whitelist` WHERE `ip` = '%s'", str);
? ? ? mysql_tquery(ConexaoSQL, query, "OnVerifiedWhiteList", "i", playerid);
}
forward OnVerifiedWhiteList(playerid);
public OnVerifiedWhiteList(playerid)
{
? ? // if the player is on the whitelist
? ? if (cache_num_rows() > 0)
? ? {
? ? ? ? // Player Login
? ? }
? ? // if the player is not on the whitelist
? ? else
? ? {
? ? ? ? Kick(playerid);
? ? }
? ? return 1;
}