Server Whitelist [MySQL Support][Logging] -
lolumadd_ - 06.08.2011
Server Whitelist
Usage:
This script allows server admins (rcon) to add/remove users to the server whitelist. The whitelist allows and disallows players to join your server.
Commands (Rcon):
pawn Code:
COMMAND: /whiteadd [entry]
COMMAND: /whiteremove [entry]
Entries can either be a IP or a name.
Example of a whitelist:
Code:
lolumadd
batman
127.0.0.1
cow
Toggles (MySQL and Logging):
This script has MySQL support for better optimization or for players planning on connecting this script to web via php.
To enable MySQL make sure line #3 looks like this:
If it is 0, that means it is using files.
If you are using G-Stylez mysql plugin, make sure to comment the lines where it says stricken kid and uncomment the lines that say g-stylez. Also, you need to fill in your MySQL info in the lines provided in the script.
To enable logging (printing successful connections and unsuccessful connections make sure line #4 looks like this:
Otherwise, turn the value to 0.
Notes:
This script is Plug & Play. All you need to do put the script in the filterscripts folder, include it in server, and it is running. It will automatically create/recreate the needed files if not found. The same applies to MySQL version.
Have Fun
http://pastebin.mozilla.org/1291507
AMX Only:
http://www.mediafire.com/?2910b2j4lleo3yt
(Mozilla Pastebin FTW
)
Re: Server Whitelist [MySQL Support][Logging] -
[HiC]TheKiller - 06.08.2011
Not bad, if there is anything that I would recommend, it would be adding SQLite support
.
Re: Server Whitelist [MySQL Support][Logging] -
Sergei - 06.08.2011
1. Everyone who is not RCON admin will get the message "ERROR: Only admins can edit the whitelist." for every command they use.
2. Escape strings before using them in a query.
Re: Server Whitelist [MySQL Support][Logging] -
dreamboxxl - 22.12.2011
Hi, pastebin link is dead
Please would you fix it?
Thank You
Re: Server Whitelist [MySQL Support][Logging] - Astralis - 22.12.2011
Quote:
Originally Posted by dreamboxxl
Hi, pastebin link is dead
Please would you fix it?
Thank You
|
Well there's only .amx,if you want to leave credits,etc,then download it,or wait until he re-uploads pastebin!
Re: Server Whitelist [MySQL Support][Logging] -
dreamboxxl - 22.12.2011
Thank you for the answer.
But i need to enable a few things in this script like: mysql and other thing, before i'm using it.
We forget the forum rules, about posting just .amx files. But he posted .pwn, but the pastebin is dead already.
The rules was the first thing i've studied.
Many Greets Anyways
Re: Server Whitelist [MySQL Support][Logging] -
nickbouwhuis - 29.10.2012
I used DeAMX to decomile the script
Code:
#include <a_samp>
#include <core>
#include <float>
public OnFilterScriptInit()
{
print("Whitelist loaded.");
if(!fexist("whitelist.txt"))
{
print("Whitelist file created.");
new File:var0 = fopen("whitelist.txt", 1);
fwrite(var0, " ");
fclose(var0);
}
else
{
print("Whitelist file loaded.");
}
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
new var0 = 0;
new var1[120], var2[20], var3[16];
GetPlayerName(playerid, var2, 20);
GetPlayerIp(playerid, var3, 16);
new File:var4 = fopen("whitelist.txt", 0);
while(fread(var4, var1, 120))
{
if(!strcmp(var2, var1, true) || !strcmp(var3, var1, true))
{
printf("User %s (%s) has connected to the server successfully.", var2, var3);
var0 = 1;
return 1;
}
}
fclose(var4);
if(!var0)
{
SendClientMessage(playerid, 0xE8E1E3FF, "You are not on the server whitelist.");
printf("User %s (%s) has connected while not on the whitelist.", var2, var3);
Kick(playerid);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext)
{
if(!IsPlayerAdmin(playerid))
{
return SendClientMessage(playerid, 0xE8E1E3FF, "ERROR: Only admins can edit the whitelist.");
}
if(!strcmp(cmdtext, "/whiteadd", true, 9))
{
if(!(cmdtext + 40))
{
return SendClientMessage(playerid, 0xE8E1E3FF, "USAGE: /whiteadd [entry]");
}
strdel(cmdtext, 10, strlen(cmdtext));
new var0[32];
new File:var1 = fopen("whitelist.txt", 3);
format(var0, 32, "\r\n%s", cmdtext);
fwrite(var1, var0);
fclose(var1);
SendClientMessage(playerid, 0xE8E1E3FF, "Entry added.");
return 1;
}
if(!strcmp(cmdtext, "/whiteremove", true, 12))
{
if(!(cmdtext + 52))
{
return SendClientMessage(playerid, 0xE8E1E3FF, "USAGE: /whiteremove [entry]");
}
strdel(cmdtext, 12, strlen(cmdtext));
new var0[32], var1 = 0, var2 = 0;
new File:var3 = fopen("whitelist.txt", 0);
while(fread(var3, var0, 32))
{
var1++;
if(!strcmp(cmdtext, var0, true))
{
var2 = var1;
return 1;
}
}
fclose(var3);
functionA18("whitelist.txt", var2);
SendClientMessage(playerid, 0xE8E1E3FF, "Entry removed.");
return 1;
}
return 0;
}
functionA18(arg0, arg1)
{
new var0 = 0, var1[128], File:var2 = 0, File:var3 = 0;
var2 = fopen(arg0, 0);
var3 = fopen("tmpfile.txt", 1);
while(fread(var2, var1, 128))
{
if(++var0 != arg1)
{
fwrite(var3, var1);
}
}
fclose(var2);
fclose(var3);
var2 = fopen(arg0, 1);
var3 = fopen("tmpfile.txt", 0);
while(fread(var3, var1, 128))
{
fwrite(var2, var1);
}
fclose(var2);
fclose(var3);
fremove("tmpfile.txt");
return 1;
}
Gives a few error's though
Re: Server Whitelist [MySQL Support][Logging] -
elhanan - 30.04.2016
i have a problem when i login to Rcon Its Say Server Closed The Connection I Check In Server Log Why It Say
Player Blocked Enter Rcon Reason Not In White List... I Take From Someone Gamemode And I dont know how to fix it