Need help with ban variable
#1

Alright i made that variable banned but when i ban the person ig /ban it sets the variable in the file too 1
But when i reconnect it doesn't kick like it supposed to do.

pawn Код:
public OnPlayerConnect(playerid) {
    SendClientMessage(playerid,red,"Welcome to United Kingdom TDM! 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 United Kingdom TDM", 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(PInfo[playerid][Banned] > 0) {
                SendClientMessage(playerid, 0xFF444499, "You are banned from this server if this is a mistake appeal at our fourms");
                Kick(playerid);
           }
      }
    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
#2

Firstly,if you use that script

PInfo[playerid][Money] = 0;
PInfo[playerid][Score] = 0;
PInfo[playerid][Kills] = 0;
PInfo[playerid][Deaths] = 0;
PInfo[playerid][Level] = 0;
PInfo[playerid][Rank] = 0;

It will always reset the players data to 0. You wouldn't want that.

You must use INI_Parse file load function. If you are using y_ini see Alex ******'s tutorial.

Better use this and read it:

https://sampforum.blast.hk/showthread.php?tid=273088
Reply
#3

We needed to set that to 0 else the gets the old score of the old playerid example player 0 gets player 0 score.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)