SA-MP Forums Archive
Read a string saved with Y_ini - 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: Read a string saved with Y_ini (/showthread.php?tid=425636)



Read a string saved with Y_ini - Saw® - 26.03.2013

Hey , when a player is banned , the admin name + reason are saved in the Ini file, I wanna load them when a player connect:
pawn Код:
if(PlayerInfo[playerid][pBanned]==1)
                    {
                    new INI:File = INI_Open(UserPath(playerid));
                    new string[200];
                    INI:File[](name[], value[])
                    {
                    INI_String("AdminBan", ad, 15);
                    INI_String("Reason", reason, 70);
                    return 0; // This is now required.
                    }
                    }
When compiling I get these errors:
Код:
C:\Documents and Settings\Administrateur\Bureau\Mrich's CnR\gamemodes\CnR.pwn(223) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrateur\Bureau\Mrich's CnR\gamemodes\CnR.pwn(223) : error 017: undefined symbol "@INI_File_"
C:\Documents and Settings\Administrateur\Bureau\Mrich's CnR\gamemodes\CnR.pwn(223) : error 017: undefined symbol "@INI_File_"
C:\Documents and Settings\Administrateur\Bureau\Mrich's CnR\gamemodes\CnR.pwn(223) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
How to fix it ? thanks.


Re: Read a string saved with Y_ini - Saw® - 26.03.2013

so it must be outside the Publics , then how the public(in this case onDialog..) will know it?

Or even how to make the code work any ideas?
thanks


Re: Read a string saved with Y_ini - Saw® - 26.03.2013

I read your tutorial but some parts aren't clear for me :
pawn Код:
ew
    gSomeInteger,
    Float:gAFloat,
    gTheString[32];

forward anyini_examples(name[], value[]);
public anyini_examples(name[], value[])
{
    INI_Int("some_integer", gSomeInteger);
}

forward anyini_more_examples(name[], value[]);
public anyini_more_examples(name[], value[])
{
    INI_Int("a_float", gAFloat);
    INI_String("the_string", gTheString, sizeof (gTheString));
}

main()
{
    INI_ParseFile("mine.INI", "anyini_%s");
    INI_ParseFile("other.INI", "anyini_%s");
}
what is its relation with my problem? the admin & reason are saved ; I ONLY WANNA load it but don't know how ...(ofc using Y_ini functions)...


Re: Read a string saved with Y_ini - Saw® - 26.03.2013

I read at the end you're talking about user file only how to save & load variables not strings..


Re: Read a string saved with Y_ini - Finn - 26.03.2013

Is this what you're looking for?

pawn Код:
new gReason[70],
    gAdmin[MAX_PLAYER_NAME];

forward LoadReason(name[], value[])
public LoadReason(name[], value[])
{
    INI_String("Reason", gReason, sizeof(gReason));
    INI_String("AdminBan", gAdmin, sizeof(gAdmin));
    return 1;
}
Usage:
pawn Код:
if(PlayerInfo[playerid][pBanned] == 1)
{
    INI_ParseFile(UserPath(playerid), "LoadReason");

    printf("Player %d is banned for %s by admin %s.", playerid, gReason, gAdmin);
}



Re: Read a string saved with Y_ini - Saw® - 26.03.2013

Quote:
Originally Posted by Finn
Посмотреть сообщение
Is this what you're looking for?

pawn Код:
new gReason[70],
    gAdmin[MAX_PLAYER_NAME];

forward LoadReason(name[], value[])
public LoadReason(name[], value[])
{
    INI_String("Reason", gReason, sizeof(gReason));
    INI_String("AdminBan", gAdmin, sizeof(gAdmin));
    return 1;
}
Usage:
pawn Код:
if(PlayerInfo[playerid][pBanned] == 1)
{
    INI_ParseFile(UserPath(playerid), "LoadReason");

    printf("Player %d is banned for %s by admin %s.", playerid, gReason, gAdmin);
}
Exactly thank you for making huge effor writing this code , I save the admin name & reason in /ban command :
pawn Код:
INI_WriteString(File,"AdminBan",GetName(playerid));
INI_WriteString(File,"Reason",reason);
I wanna load them when a player connect again , so your code will do that?