public OnPlayerConnect(playerid)
{
new banfile[64], ipstring[32], string[128];
SendClientMessage(playerid, COLOR_DEADCONNECT, "|_Ban Check Started_|");
SendClientMessage(playerid, COLOR_YELLOW, "Checking for bans...");
GetPlayerIp(playerid, ipstring, sizeof(ipstring));
format(banfile, sizeof(banfile),"SArcr/Users/Bans/%s.ban", ipstring);
if(DOF2_FileExists(banfile))
{
new banmsg[128];
if(!strcmp(DOF2_GetString(banfile, "BanName"), PlayerName(playerid), true))
{
SendClientMessage(playerid, COLOR_YELLOW, "====================================BANNED=====================================");
SendClientMessage(playerid, COLOR_YELLOW, "This player name has been banned from [Sarcr]");
format(banmsg, sizeof(banmsg), "Date of Ban: %s", dUser(PlayerName(playerid)).("BanDate"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
format(banmsg, sizeof(banmsg), "Time of Ban: %s", dUser(PlayerName(playerid)).("BanTime"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
format(banmsg, sizeof(banmsg), "Banned By: %s", dUser(PlayerName(playerid)).("BannedBy"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
format(banmsg, sizeof(banmsg), "Banned For: %s", dUser(PlayerName(playerid)).("BanReason"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this ban is a mistake, please make an appeal at www.sa-rcr.com");
SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
Kick(playerid);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "====================================BANNED=====================================");
SendClientMessage(playerid, COLOR_YELLOW, "This IP Address has been banned from [Sarcr]");
format(banmsg, sizeof(banmsg), "Date of Ban: %s", dUser(PlayerName(playerid)).("BanDate"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
format(banmsg, sizeof(banmsg), "Time of Ban: %s", dUser(PlayerName(playerid)).("BanTime"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
format(banmsg, sizeof(banmsg), "Banned By: %s", dUser(PlayerName(playerid)).("BannedBy"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
format(banmsg, sizeof(banmsg), "Banned For: %s", dUser(PlayerName(playerid)).("BanReason"));
SendClientMessage(playerid, COLOR_YELLOW, banmsg);
SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this ban is a mistake, please make an appeal at www.sa-rcr.com");
SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
Kick(playerid);
}
return 1;
}
if(udb_Exists(PlayerName(playerid)))
{
if(dUserINT(PlayerName(playerid)).("Banned") == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "====================================BANNED=====================================");
SendClientMessage(playerid, COLOR_YELLOW, "This player name has been banned from [Sarcr]");
SendClientMessage(playerid, COLOR_YELLOW, "The data regarding this ban is unavailable.");
SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this is a mistake, please write an appeal at www.sa-rcr.com");
SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
Kick(playerid);
}
ShowLoginScreen(playerid);
}
else if(!udb_Exists(PlayerName(playerid)))
{
ShowRegisterScreen(playerid);
}
SendClientMessage(playerid, COLOR_DEADCONNECT, "|_Ban Check Complete_|");
SendClientMessage(playerid, COLOR_GREEN, "No Bans were found");
new name[24], str[128];
GetPlayerName(playerid, name, 24);
ircSay(EchoConnection, EchoChan,str);
format(str, 128, "%s(%d) Has Joined San Andreas Roleplay/Cops/Robbers v%s", name,playerid,sversion);
SendClientMessageToAll(0x808080AA, str);
printf("%s(%d) Has Joined San Andreas Roleplay/Cops/Robbers v%s (IP: %s)", str,playerid,sversion,ipstring);
InShamal[playerid] = 0;
SetPlayerColor(playerid,COLOR_DEADCONNECT);
SetPlayerVirtualWorld(playerid,0);
format(string, sizeof(string), "San Andreas Roleplay/Cops/Robbers - Script Version %s",sversion);
SendClientMessage(playerid,COLOR_WHITE, string);
SendClientMessage(playerid,0x87CEEBAA, "This is NOT a deathmatch server. Do not randomly kill players");
SendClientMessage(playerid,0x87CEEBAA, "Visit our website to report bugs/suggestions/complaints etc");
SendClientMessage(playerid,0x87CEEBAA, "There is a full list of commands/rules and other information on our website" );
SendClientMessage(playerid,0x87CEEBAA, "Visit our website at www.sa-rcr.com");
//little variables that I deleted just now so that you can have an easier time reading :P
return 1;
}
print("1");
//......
print("2");
new banfile[64], ipstring[32], string[128];
SendClientMessage(playerid, COLOR_DEADCONNECT, "|_Ban Check Started_|");
SendClientMessage(playerid, COLOR_YELLOW, "Checking for bans...");
GetPlayerIp(playerid, ipstring, sizeof(ipstring));
format(banfile, sizeof(banfile),"SArcr/Users/Bans/%s.ban", ipstring);
if(DOF2_FileExists(banfile))
else if(udb_Exists(PlayerName(playerid)))
{
if(dUserINT(PlayerName(playerid)).("Banned") == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "===================================[BANNED]====================================");
SendClientMessage(playerid, COLOR_YELLOW, "This player name has been banned from [Sarcr]");
SendClientMessage(playerid, COLOR_YELLOW, "The data regarding this ban is unavailable.");
SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this is a mistake, please write an appeal at www.sa-rcr.com");
SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
Kick(playerid);
}
ShowLoginScreen(playerid);
return 1;
}
else if(!udb_Exists(PlayerName(playerid)))
{
ShowRegisterScreen(playerid);
return 1;
}
Maybe, your script is having trouble connecting to the database to check the bans?
|
Well i have had that problem when it hangs on connect while checking the players bantime and it had to do with Kick(playerid); bug. Comment it off once. I aint saying that is the problem but its worth a try.
|
else if(udb_Exists(PlayerName(playerid)))
{
if(dUserINT(PlayerName(playerid)).("Banned") == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "===================================[BANNED]====================================");
SendClientMessage(playerid, COLOR_YELLOW, "This player name has been banned from [Sarcr]");
SendClientMessage(playerid, COLOR_YELLOW, "The data regarding this ban is unavailable.");
SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this is a mistake, please write an appeal at www.sa-rcr.com");
SendClientMessage(playerid, COLOR_YELLOW, "===============================================================================");
Kick(playerid);
}
ShowLoginScreen(playerid);
return 1;
}
else if(!udb_Exists(PlayerName(playerid)))
{
ShowRegisterScreen(playerid);
return 1;
}
Just tried that, commented out all of the 'Kicks' and it was still hanging there forever. I'm pretty sure that it has more to do with these lines:
pawn Code:
|
ShowLoginScreen(playerid);
Guess your best bet is use Print("Debug"); between every line on that part and see where it stops. Could have somthing to do with your file system. I only know how to use y_ini so far not double-o-files.
Also show us pawn Code:
|
stock ShowLoginScreen(playerid)
{
new string[128];
format(string, sizeof(string), "Welcome back %s\nBefore playing you must login\nEnter your password below and click login",PlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login required",string,"Login","Cancel");
}
stock ShowRegisterScreen(playerid)
{
new string[128];
format(string, sizeof(string), "Welcome to the server %s\nThis server requires you to register an account before playing",PlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registration",string,"Register","Cancel");
}