How to read strings from INI files
#1

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
Reply
#2

So in public loaduserdata INI_String i guess
Reply
#3

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

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")
Reply
#5

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
Reply
#6

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

bump.
Reply
#8

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

I'm using Y_INI
Reply
#10

Show me public "LoadUser.." .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)