Banned Variable
#1

Alright guys i've got a little question i've made a banned variable for my server so if a players gets banned the variable in his userfile will turn 1 and he won't be able to connect.
But i can only seem to add this in Dialog_LOGIN when i try to add it on the onplayerconnect it simpely doesn't work.



pawn Код:
case DIALOG_LOGIN: {
            if(!response) return Kick(playerid);
            if(response) {
                new password[23],password2[23],rank[60];
                if(sscanf(inputtext, "s[23]", password)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                new file[64],PlayerName[24];
                GetPlayerName(playerid, PlayerName, sizeof PlayerName);
                format(file, sizeof file, "Admin/%s.ini", PlayerName);
                if(!fexist(file)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register Below", "Enter A Password To Register And Play!", "Register", "Quit");
                INI_Open(file);
                INI_ReadString(password2, "Password");
                if(strcmp(password, password2) != 0) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
                PInfo[playerid][Rank] = INI_ReadInt("Rank");
                PInfo[playerid][Level] = INI_ReadInt("Level");
                PInfo[playerid][Operator] = INI_ReadInt("Operator");
                PInfo[playerid][Banned] = INI_ReadInt("Banned");
                PInfo[playerid][Kills] = INI_ReadInt("Kills");
                PInfo[playerid][Deaths] = INI_ReadInt("Deaths");
                PInfo[playerid][Score] = INI_ReadInt("Score");
                PInfo[playerid][Money] = INI_ReadInt("Money");
                if(PInfo[playerid][Banned] != 0)
                {
                SendClientMessage(playerid, 0xFF0000FF, "ERROR: This account is banned if this is a mistake apply at our forums");
                SetTimerEx("KickPlayer",500,0,"d", playerid);
                return 1;
                }
                INI_Close();
                SendClientMessage(playerid,-1,"You have been successfully logged in!");
                format(rank, sizeof(rank), "Your rank is %s", GetRankName(playerid));
                SendClientMessage(playerid, -1, rank);
                PInfo[playerid][Logged] = 1;
                SetPlayerScore(playerid, PInfo[playerid][Score]);
                GivePlayerMoney(playerid, PInfo[playerid][Money]);
                return 1;
            }
        }
pawn Код:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,red,"Welcome to Priority WarTorn! Dont forget to check /updates ! ");
    SendClientMessage(playerid,GREEN,"Remember to /buyrank to buy a rank ");
    new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "** %s has joined Priority WarTorn", name);
    IsOnAdminDuty[playerid] = false;
    PInfo[playerid][Money] = 0;
    PInfo[playerid][Score] = 0;
    PInfo[playerid][Kills] = 0;
    PInfo[playerid][Deaths] = 0;
    PInfo[playerid][Level] = 0;
    PInfo[playerid][Rank] = 0;
    SendClientMessageToAll(-1, string);
    PMEnabled[playerid] = 1;
    IsMuted[playerid] = 0;
    TogglePlayerSpectating(playerid, false);

    new file[64],PlayerName[25];//Creating a variable where we can store the file path, and the variable to store the player's name.
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);//Storing the players name in the PlayerName variable.
    format(file,sizeof file,"Admin/%s.ini",PlayerName);//Storing the file path with the players name.
    if(fexist(file)) {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login Below", "Enter Your Password To Login!", "Login", "Quit");
    } else {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register Below", "Enter A Password To Register And Play!", "Register", "Quit");
    }
    return 1;
}
Reply


Messages In This Thread
Banned Variable - by Biess - 18.09.2013, 16:53
Re: Banned Variable - by DanishHaq - 18.09.2013, 16:56
Re: Banned Variable - by Biess - 18.09.2013, 16:57
Re: Banned Variable - by Patrick - 18.09.2013, 17:02
Re: Banned Variable - by Biess - 18.09.2013, 17:03
Re: Banned Variable - by Patrick - 18.09.2013, 17:06
Re: Banned Variable - by Konstantinos - 18.09.2013, 17:10
Re: Banned Variable - by Patrick - 18.09.2013, 17:12
Re: Banned Variable - by Konstantinos - 18.09.2013, 17:22
Re: Banned Variable - by Biess - 18.09.2013, 17:27

Forum Jump:


Users browsing this thread: 1 Guest(s)