Little "format" and "dini" help
#1

I made a system, which would ban the user of the player through dini. It set the hour, date, admin which banned, and reason. The issue is on OnPlayerConnect, when the player logs being banned: Doesn't shows who banned, the reason. And the Date and Time are incomplete oO

Here's the code:
pawn Код:
if(PlayerInfo[playerid][Banned] == 1)
    {
       PlayerInfo[playerid][BannedBy] = dini_Int(file,"BannedBy");
       PlayerInfo[playerid][Date] = dini_Int(file,"Date");
       PlayerInfo[playerid][Time] = dini_Int(file,"Time");
       PlayerInfo[playerid][Reason] = dini_Int(file,"Reason");
       new admin[128], data[128], time[128], reason[128];
       format(admin,sizeof(admin),"You have been banned by the adminstrator %s",PlayerInfo[playerid][BannedBy]);
       format(data,sizeof(data),"Date which you have been banned: %s",PlayerInfo[playerid][Date]);
       format(time,sizeof(time),"Time which you have been banned: %s",PlayerInfo[playerid][Time]);
       format(reason,sizeof(reason),"Reason by the which you have been banned: %s",PlayerInfo[playerid][Reason]);
       SendClientMessage(playerid, vermelho, "____________________________");
       SendClientMessage(playerid, vermelho, admin);
       SendClientMessage(playerid, vermelho, data);
       SendClientMessage(playerid, vermelho, time);
       SendClientMessage(playerid, vermelho, reason);
       SendClientMessage(playerid, vermelho, "* Your ban haven't over yet *");
       SendClientMessage(playerid, vermelho, "____________________________");
       Kick(playerid);

    }
I bet the problem might be on the format. Here's my dini file (my user):
Код:
Password=*************
Level=5
Cash=0
Score=0
Jail=0
Registrado=1
Ip=127.0.0.1
Nome=the_runner
Bank=1000
Skin=0
Banned=1
Team=0
PosX=1936.048217
PosY=1288.406738
PosZ=12.820312
Spawnou=1
BannedBy=the_runner
Date=27/12/2010
Time=23:50:36
Reason=Wasn't given a reason
PS: I did a command for see the params, for check if there weren't anything wrong on OnPlayerConnect. The result was equal to this one:
Another PS:
Код:
Date=27/12/2010 // On server it's showing 7/12/2010
Time=23:50:36  // On server it's showing 3:50:36
Reply
#2

Reading sometimes dosent work really well on dini, suggesting some new file reading, creating systems like, y_ini, mysql, BUD - blazing user database, there the ones which are good.

By the way on a second notice did you ban the player with the reason
Код:
 Reason=Wasn't given a reason
or you just edited and said that the reason aint showing upon there?

I think you can close files and open them with dini, do so there..
Reply
#3

From what I see,BannedBy,Date,Time and Reason are strings,so you need to use dini_Get
pawn Код:
if(PlayerInfo[playerid][Banned] == 1)
    {
       PlayerInfo[playerid][BannedBy] = dini_Get(file,"BannedBy");
       PlayerInfo[playerid][Date] = dini_Get(file,"Date");
       PlayerInfo[playerid][Time] = dini_Get(file,"Time");
       PlayerInfo[playerid][Reason] = dini_Get(file,"Reason");
       new admin[128], data[128], time[128], reason[128];
       format(admin,sizeof(admin),"You have been banned by the adminstrator %s",PlayerInfo[playerid][BannedBy]);
       format(data,sizeof(data),"Date which you have been banned: %s",PlayerInfo[playerid][Date]);
       format(time,sizeof(time),"Time which you have been banned: %s",PlayerInfo[playerid][Time]);
       format(reason,sizeof(reason),"Reason by the which you have been banned: %s",PlayerInfo[playerid][Reason]);
       SendClientMessage(playerid, vermelho, "____________________________");
       SendClientMessage(playerid, vermelho, admin);
       SendClientMessage(playerid, vermelho, data);
       SendClientMessage(playerid, vermelho, time);
       SendClientMessage(playerid, vermelho, reason);
       SendClientMessage(playerid, vermelho, "* Your ban haven't over yet *");
       SendClientMessage(playerid, vermelho, "____________________________");
       Kick(playerid);

    }
Reply
#4

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Reading sometimes dosent work really well on dini, suggesting some new file reading, creating systems like, y_ini, mysql, BUD - blazing user database, there the ones which are good.

By the way on a second notice did you ban the player with the reason
Код:
 Reason=Wasn't given a reason
or you just edited and said that the reason aint showing upon there?

I think you can close files and open them with dini, do so there..
I made a ban command according with params: without params2, the reason would be: "Wasn't given a reason".
Thx at all. Maybe Im gonna try y_ini or any other system of these, since you're not the first one told me to do it xP

Quote:
Originally Posted by Gavibro
Посмотреть сообщение
From what I see,BannedBy,Date,Time and Reason are strings,so you need to use dini_Get
pawn Код:
if(PlayerInfo[playerid][Banned] == 1)
    {
       PlayerInfo[playerid][BannedBy] = dini_Get(file,"BannedBy");
       PlayerInfo[playerid][Date] = dini_Get(file,"Date");
       PlayerInfo[playerid][Time] = dini_Get(file,"Time");
       PlayerInfo[playerid][Reason] = dini_Get(file,"Reason");
       new admin[128], data[128], time[128], reason[128];
       format(admin,sizeof(admin),"You have been banned by the adminstrator %s",PlayerInfo[playerid][BannedBy]);
       format(data,sizeof(data),"Date which you have been banned: %s",PlayerInfo[playerid][Date]);
       format(time,sizeof(time),"Time which you have been banned: %s",PlayerInfo[playerid][Time]);
       format(reason,sizeof(reason),"Reason by the which you have been banned: %s",PlayerInfo[playerid][Reason]);
       SendClientMessage(playerid, vermelho, "____________________________");
       SendClientMessage(playerid, vermelho, admin);
       SendClientMessage(playerid, vermelho, data);
       SendClientMessage(playerid, vermelho, time);
       SendClientMessage(playerid, vermelho, reason);
       SendClientMessage(playerid, vermelho, "* Your ban haven't over yet *");
       SendClientMessage(playerid, vermelho, "____________________________");
       Kick(playerid);

    }
Thank you, did work.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)