SA-MP Forums Archive
How to read strings from INI files - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to read strings from INI files (/showthread.php?tid=458069)



How to read strings from INI files - Vanter - 14.08.2013

Hey, I just did offline ban and unban and stuff, modified them.
but I want to make checkban, I read the YSI topic but didn't how to read from an offline user file.
also when he logs in, it needs to show the reason, have a look
pawn Код:
/On Player Connect
public OnPlayerConnect(playerid)
{
    new string[128];
    new pname[24];
    new pIPp[16];
    GetPlayerIp(playerid, pIPp, sizeof(pIPp));
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        if(PlayerInfo[playerid][pBanned] == 1)
        {
          new INI:File = INI_Open(UserPath(playerid));
          INI_SetTag(File,"Player's Data");
          INI_WriteString(File,"IP",pIPp);
          INI_Close(File);

          format(string,sizeof(string),"[BANNED] You are currently banned from the server. [Reason: %s]",PlayerInfo[playerid][pBanReason]);
          SendClientMessage(playerid, COLOR_RED,string);
          SendClientMessage(playerid, COLOR_RED,"[BANNED] Please Ban Appeal on our forums at www.website.net");
          SetTimerEx("KickPlayer",1000,false,"i",playerid);
          return 1;
        }
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FF0000}SERVER","{FFFFFF}Welcome back to the server! \n Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid,//rest of dialog
    }
but nothing seems to be working, ''showing ban reason'' I'd appreciate help


Re: How to read strings from INI files - dEcooR - 14.08.2013

So in public loaduserdata INI_String i guess


Re: How to read strings from INI files - Vanter - 14.08.2013

I've been searching, didn't find anything useful, so someone?


check ban - Vanter - 14.08.2013

not solved
pawn Код:
dcmd_checkban(playerid,params[])
{
    new string[128];
    new tname[24];
    new filestring[79];
    if(sscanf(params,"s[24]",tname))
    {
        SendClientMessage(playerid,COLOR_ERROR,"[USAGE] /checkban (Player Name)");
        return 1;
    }
    format(filestring, sizeof(filestring), "/Users/%s.ini", tname);
    if(!fexist(filestring)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] That player name does not exist in our database.");
    if(fexist(filestring))
    {
        INI_ParseFile(filestring, "LoadUser_%s", .bExtra = false, .extra = playerid);
        if(PlayerInfo[filestring][pBanned] == 1) //10275
        {
          format(string,sizeof(string),"[BAN CHECK] %s is currently banned from the server. [Reason: %s]",filestring, PlayerInfo[filestring][pBanReason]); //10277
          SendClientMessage(playerid, COLOR_RED,string);
          return 1;
        }
    }
    return 1;
}
Код:
error 033: array must be indexed (variable "filestring")
error 033: array must be indexed (variable "filestring")



Re: How to read strings from INI files - Edix - 14.08.2013

Quote:
Originally Posted by Vanter
Посмотреть сообщение
I've been searching, didn't find anything useful, so someone?
Looks like you didnt search good enough.

https://sampforum.blast.hk/showthread.php?tid=175565


Re: How to read strings from INI files - Vanter - 14.08.2013

Edix, I tried reading that for sure.. didn't understand much of it.


Re: How to read strings from INI files - Vanter - 15.08.2013

bump.


Re: How to read strings from INI files - dominik523 - 15.08.2013

Код:
// under enums
mystring[13]
// save
dini_Set(file, "text", PlayerInfo[playerid][mystring]);
// load
format(PlayerInfo[playerid][mystring], 13, "%s", dini_Get(file, "text"));



Re: How to read strings from INI files - Vanter - 15.08.2013

I'm using Y_INI


Re: How to read strings from INI files - sKgaL - 15.08.2013

Show me public "LoadUser.." .