i got a problem in my rban command when i ban the player i need to save the date and time of his ban but the saved date and time is 1 idk why here is the code
pawn Код:
CMD:rban(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if(PlayerInfo[playerid][Level] >= 4) {
new ip[128], Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
if(isnull(params)) return SendClientMessage(playerid, blue, "Usage: /rban [PlayerID] [Reason]");
if(isnull(tmp2)) return SendClientMessage(playerid, red, "ERROR: Reason unspecified!");
new player1;
new string[128];
new playername[MAX_PLAYER_NAME];
new adminname [MAX_PLAYER_NAME];
new file[256];
new DateString[256];
new TimeString[256];
player1 = strval(tmp);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel])){
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
new year,month,day; getdate(year, month, day);
new hour,minuite,second; gettime(hour,minuite,second);
CMDMessageToAdmins(playerid,"RBAN");
format(string,sizeof(string),"%s has been Range Banned by Administrator %s | Reason: %s [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,params[2],day,month,year,hour,minuite);
SendClientMessageToAll(grey,string);
new str[128];
format(str,sizeof(str),"%s has been Range Banned by Administrator %s | Reason: %s",playername,adminname,params[2]);
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(playername));
SaveToFile("BanLog",str);
print(string);
if(udb_Exists(PlayerName2(player1)) && PlayerInfo[player1][LoggedIn] == 1) {
dUserSetINT(PlayerName2(player1)).("banned",1);
dini_IntSet(file,"Date", format(DateString,sizeof(DateString),"%d/%d/%d",day,month,year));
dini_IntSet(file,"Time", format(TimeString,sizeof(TimeString),"%d:%d",hour,minuite));
dini_Set(file,"Reason", params[2]);
dini_Set(file,"Administrator", adminname);}
GetPlayerIp(player1,ip,sizeof(ip));
strdel(ip,strlen(ip)-2,strlen(ip));
format(ip,128,"%s**",ip);
format(ip,128,"banip %s",ip);
SendRconCommand(ip);
Kick(player1);
return 1;
} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Код:
dini_IntSet(file,"Date", format(DateString,sizeof(DateString),"%d/%d/%d",day,month,year));
dini_IntSet(file,"Time", format(TimeString,sizeof(TimeString),"%d:%d",hour,minuite));
Код:
format(DateString,sizeof(DateString),"%02d/%02d/%d",day,month,year);
dini_IntSet(file,"Date", Datestring);
format(TimeString,sizeof(TimeString),"%02d:%02d:%02d",hour,minuite,second);
dini_IntSet(file,"Time", TimeString);