14.07.2011, 17:32
Right now I am trying to design a ban system in which it will show the reason why the player was banned and all of that. My problem is that now when I check to see if a player is banned it won't show the login dialog. Here's the code...
pawn Код:
public OnPlayerConnect(playerid)
{
new banfile[64];
format(banfile, sizeof(banfile),"SArcr/Users/Bans/%s.ban",GetPlayerIp(playerid, PlayerName(playerid), 32));
if(dini_Exists(banfile))
{
if(!strcmp(dini_Get(banfile, "BanName"), PlayerName(playerid), true))
{
new banmsg[128];
SendClientMessage(playerid, COLOR_ADMIN, "This player name has been banned from [Sarcr]");
format(banmsg, sizeof(banmsg), "Date of Ban: %s", dUser(PlayerName(playerid)).("BanDate"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Time of Ban: %s", dUser(PlayerName(playerid)).("BanTime"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Banned By: %s", dUser(PlayerName(playerid)).("BannedBy"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Banned For: %s", dUser(PlayerName(playerid)).("BanReason"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
SendClientMessage(playerid, COLOR_ADMIN, "If you feel that this ban is a mistake, please make an appeal at www.sa-rcr.com");
Kick(playerid);
}
else
{
new banmsg[128];
SendClientMessage(playerid, COLOR_ADMIN, "This IP Address has been banned from [Sarcr]");
format(banmsg, sizeof(banmsg), "Date of Ban: %s", dUser(PlayerName(playerid)).("BanDate"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Time of Ban: %s", dUser(PlayerName(playerid)).("BanTime"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Banned By: %s", dUser(PlayerName(playerid)).("BannedBy"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Banned For: %s", dUser(PlayerName(playerid)).("BanReason"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
SendClientMessage(playerid, COLOR_ADMIN, "If you feel that this ban is a mistake, please make an appeal at www.sa-rcr.com");
Kick(playerid);
}
}
format(banfile, sizeof(banfile), USER_FILE_PATH, PlayerName(playerid));
if(dini_Exists(banfile))
{
if(dUserINT(banfile).("Banned") == 1)
{
new banmsg[128];
SendClientMessage(playerid, COLOR_ADMIN, "This player name has been banned from [Sarcr]");
format(banmsg, sizeof(banmsg), "Date of Ban: %s", dUser(PlayerName(playerid)).("BanDate"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Time of Ban: %s", dUser(PlayerName(playerid)).("BanTime"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Banned By: %s", dUser(PlayerName(playerid)).("BannedBy"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
format(banmsg, sizeof(banmsg), "Banned For: %s", dUser(PlayerName(playerid)).("BanReason"));
SendClientMessage(playerid, COLOR_ADMIN, banmsg);
SendClientMessage(playerid, COLOR_ADMIN, "If you feel that this ban is a mistake, please make an appeal at www.sa-rcr.com");
Kick(playerid);
}
}
if(udb_Exists(banfile))
{
SendClientMessage(playerid,COLOR_ERROR,"This player name has already been registered. Please login before you spawn.");
ShowLoginScreen(playerid);
}
else
{
SendClientMessage(playerid,COLOR_ERROR,"This player name has not been registered. You must register before playing on [Sarcr].");
ShowRegisterScreen(playerid);
}
// other stuff...
return 1;
}