03.04.2014, 13:05
How can I make that script will read how much ban warnings player has when he will connect?
For now I have this:
And I have 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
For now I have this:
pawn Код:
enum PlayerData
{
Bwarnings, // ------
};
new PlayerInfo[MAX_PLAYERS][PlayerData];
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");
}
REP+ for every helper