open.mp forum
[Server] INI_Int..? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Support (https://forum.open.mp/forumdisplay.php?fid=12)
--- Thread: [Server] INI_Int..? (/showthread.php?tid=2529)



INI_Int..? - Mivco - 2023-12-25

Hi, I translated one timeban from DOF2 to y_ini just for the sake of pride, a few lines won't complicate the mod.

Code: 
PHP Code:
new Qip INI_Int(way,"IP");
new 
dovod INI_Int(way,"Dovod");
new 
QQQQ INI_Int(way,"Admin");
new 
edy INI_Int(way,"Kedy");
new 
oKedy INI_Int(way,"Dokedy"); 



Full Timeban
I use it at Login when the player logs in whether he has a ban or not.

PHP Code:
if(fexist(way))
{
                new Qip INI_Int(way,"IP");
                new dovod INI_Int(way,"Dovod");
                new QQQQ INI_Int(way,"Admin");
                new edy INI_Int(way,"Kedy");
                new oKedy INI_Int(way,"Dokedy");

                if(gettime() > DoKedy)
                {
                      SendClientMessage(playerid,0x0000FFFF,"[ Server ] {FF0000}Ban ti vypršal, dúfam že si sa poučil");
                      fremove(way);
                }
                else
               {
                      new bigstring[500];
                      format(bigstring,500,"Tvoj ešte stále nevypršal !\nNick:\t\t\t%s\nIP:\t\t\t%s\nDôvod:\t\t\t%s\nAdmin:\t\t\t%s\nKedy:\t\t\t%s\nPlatnosť:\t\t%s",PlayerName(playerid),Qip,dovod,QQQQ,date(edy),date(oKedy));
                      ShowPlayerDialog(playerid,Dialog_NoEffect,DIALOG_STYLE_MSGBOX,"{0000FF}TimeBan",bigstring,"Ok","");
                      SetTimerEx("KickPublic"15000"d"playerid);
               }



How do I fix it?


RE: INI_Int..? - Radical - 2023-12-25

You should use INI_String to get the IP, Dovod and Admin because they are strings, not integers.

Take a look to documents.
https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Storage/y_ini/api.md


RE: INI_Int..? - Mivco - 2023-12-26

(2023-12-25, 08:51 PM)Radical Wrote: You should use INI_String to get the IP, Dovod and Admin because they are strings, not integers.

Take a look to documents.
https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Storage/y_ini/api.md

PHP Code:
new way[32];
format(way,32,"VRLS/TimeBan/%s.cfg",PlayerName(playerid));
if(
DOF2_FileExists(way))
{
new 
Qip DOF2_GetInt(way,"IP");
new 
dovod DOF2_GetInt(way,"Dovod");
                new QQQQ DOF2_GetInt(way,"Admin");
                new Kedy DOF2_GetInt(way,"Kedy");
                new DoKedy DOF2_GetInt(way,"Dokedy"); 

This is how it is original and it works and I wanted to put it in the INI version, but with INI_Int it doesn't complicate the mod for me and when I used INI_String it gives me an error

error 017: undefined symbol "INI_String"

But with "INI String" I know that there are 3 positions and in the third I don't know what to put, what weight. 
And when I put, for example, the value 0 in the third position, it shows me the error "name"