ban warn cmd
#1

How can I make that script will read how much ban warnings player has when he will connect?
For now I have this:

pawn Код:
enum PlayerData
{
    Bwarnings, // ------
};
new PlayerInfo[MAX_PLAYERS][PlayerData];
And I have command:

pawn Код:
dcmd_bwarn(playerid,params[]) { // ban warn
    if(PlayerInfo[playerid][Level] >= 2) { // admins lvl 2 or more
        new tmp[256], tmp2[256], Index;     tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /bwarn [playerid] [reason]"); // error msg
        new warned = strval(tmp), str[128]; // defines
        if(PlayerInfo[warned][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(warned) && warned != INVALID_PLAYER_ID) { // if is player connected and it's not invalid ID
            if(warned != playerid) { // you can't warn yourself
                CMDMessageToAdmins(playerid,"WARN"); // msg to admins
                PlayerInfo[warned][Bwarnings]++;
                if( PlayerInfo[warned][Bwarnings] == MAX_BWARNINGS) {
                    format(str, sizeof (str), "***Administrator \"%s\" has kicked \"%s\".  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
                    SendClientMessageToAll(grey, str);
                    SaveToFile("KickLog",str);  Kick(warned); //
                    return PlayerInfo[warned][Bwarnings] = 0; // ban warns
                } else {
                    format(str, sizeof (str), "***Administrator \"%s\" has given \"%s\" a BAN warning.  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Bwarnings], MAX_BWARNINGS);
                    return SendClientMessageToAll(yellow, str);
                }
            } else return SendClientMessage(playerid, red, "ERROR: You cannot warn yourself");
        } else return SendClientMessage(playerid, red, "ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
So how can I make that banwarns will be saved to player? And when he will connect it will read from file and when he will disconnect they will be saved?

REP+ for every helper
Reply


Messages In This Thread
ban warn cmd - by Lajko1 - 03.04.2014, 13:05
Re: ban warn cmd - by Bingo - 03.04.2014, 13:20
Re: ban warn cmd - by Lajko1 - 03.04.2014, 13:45
Re: ban warn cmd - by Lajko1 - 03.04.2014, 17:44
Re: ban warn cmd - by Kyance - 03.04.2014, 18:16
Re: ban warn cmd - by Lajko1 - 03.04.2014, 18:29
Re: ban warn cmd - by Extraordinariness - 04.04.2014, 00:22
Re: ban warn cmd - by Bingo - 04.04.2014, 00:25
Re: ban warn cmd - by Lajko1 - 04.04.2014, 15:55
Re: ban warn cmd - by Lajko1 - 05.04.2014, 22:46

Forum Jump:


Users browsing this thread: 2 Guest(s)