[HELP]Ban System
#1

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;
}
Reply
#2

Bump
Reply
#3

pawn Код:
if(udb_Exists(banfile))
shouldn't it be:
pawn Код:
if(udb_Exists(userfile))
Located at the bottom of the call back
Reply
#4

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
pawn Код:
if(udb_Exists(banfile))
shouldn't it be:
pawn Код:
if(udb_Exists(userfile))
Located at the bottom of the call back
I've started using Double-O-Files so it's a little different from dudb. I also changed the code a bit and it still doesn't work.
pawn Код:
if(udb_Exists(PlayerName(playerid)))
    {
        if(dUserINT(PlayerName(playerid)).("Banned") == 1)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "This player name has been banned from [Sarcr]");
            SendClientMessage(playerid, COLOR_YELLOW, "Date of Ban: N/A");
            SendClientMessage(playerid, COLOR_YELLOW, "Time of Ban: N/A");
            SendClientMessage(playerid, COLOR_YELLOW, "Banned By: N/A");
            SendClientMessage(playerid, COLOR_YELLOW, "Banned For: N/A");
            SendClientMessage(playerid, COLOR_YELLOW, "If you feel that this is a mistake, please write an appeal at www.sa-rcr.com");
            Kick(playerid);
        }          
        SendClientMessage(playerid,COLOR_ERROR,"This player name has already been registered. Please login before you spawn.");
        ShowLoginScreen(playerid);
    }
    else if(!udb_Exists(PlayerName(playerid)))
    {
        SendClientMessage(playerid,COLOR_ERROR,"This player name has not been registered. You must register before playing on [Sarcr].");
        ShowRegisterScreen(playerid);
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)