How the Hell to load y_ini File?
#1

Hey Guys i was confusing how to Load this
pawn Код:
COMMAND:god(playerid, params[])
{
    if(PlayerInfo[playerid][PlayerAdmin] == 0) return SendClientMessage(playerid,COLOR_RED, ""LEVEL_ERROR1"");
    if(PlayerInfo[playerid][PlayerAdmin] >= 1)
    if(GodMode[playerid] == 0)
    {
        SetPlayerHealth(playerid, 1000000);
        GodMode[playerid] = 1; //
        SendClientMessage(playerid, COLOR_WHITE, "God Mode has been actived Type /god to Deactive it");
        new name[MAX_PLAYER_NAME], file[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file,sizeof(file),"/Users/%s.txt",name);
        if(fexist(file))
        {
        new INI:Acc = INI_Open(file);
        INI_WriteInt(Acc,"God", 1); // << Save To 1
        INI_Close(Acc);
        }
    }
    else if(GodMode[playerid] == 1)
    {
        SetPlayerHealth(playerid, 100.0);
        GodMode[playerid] = 0;
        SendClientMessage(playerid, COLOR_WHITE, "God mode Deactive type /god to Active it");
        new name[MAX_PLAYER_NAME], file[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file,sizeof(file),"/Users/%s.txt",name);
        if(fexist(file))
        {
        new INI:Acc = INI_Open(file);
        INI_WriteInt(Acc,"God", 0); << Save it To 0
        INI_Close(Acc);
    }
    }
    return 1;
}
Then i want to ask how to load that string?
if The God String was 1 then OnPlayerSpawn GodMode[playerid] = 1;

Sorry My English :P
Reply
#2

i already Trying use your tutorial but i dont Understand
Reply
#3

I have to admit that ******' tutorial about y_ini is a bit confused (general use), but there are 3 good tutorials about how to make a registration system by using y_ini.

[Tutorial] Login and Register System - Dialogs - Using Y_INI by Kush
[Tutorial] Making a registration system - Using "Y_INI + Whirlpool + Dialogs" by Guitar
[Tutorial] Login/Register system [YINI+Whirlpool] by newbienoob
Reply
#4

WTF u guys -_-
i just need how to load the ini File
Example like this
pawn Код:
public OnPlayerSpawn(playerid)
{
    new file[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"/Users/%s.txt",name);
    if(fexist(file))
    {
            if(PlayerInfo[playerid][God] = 1)
            {
                GodMode[playerid] = 1;
                                SendClientMessage(playerid, COLOR_RED, "God Mode Enable");
            }
}
    return 1;
}
See?
but it's dont work
Reply
#5

If you read the tutorials, you'll see how to load the data. You need to check if the file exists and INI_ParseFile to load the data from a callback.
pawn Код:
forward LoadUser_data(playerid, name[], value[]);
public LoadUser_data(playerid, name[], value[])
{
    // Data
    return 1;
}
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
And we have now given you FOUR explanations of how to do that!
you making that y_ini why u dont know how to do that


Quote:
Originally Posted by Dwane
Посмотреть сообщение
forward LoadUser_data(playerid, name[], value[]);
public LoadUser_data(playerid, name[], value[])
{
// Data
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    new file[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"/Users/%s.txt",name);
    if(fexist(file))
    INI_ParseFile(file, "LoadUser", false, true, playerid, true, false );
    if(PlayerInfo[playerid][God] == 1)
    {
    SendClientMessage(playerid, COLOR_RED, "TETETETE");
    }
}
    return 1;
}
pawn Код:
forward LoadUser(playerid, name[], value[]);
public LoadUser(playerid, name[], value[])
{
if(!strcmp(name, "Score"))SetPVarInt(playerid,"Score", strval(value ));
if(!strcmp(name, "God"))SetPVarInt(playerid,"God", strval(value ));
}
Still Dont Work
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
I do know how to do that - I wrote a nice in-depth explanation of it!
i got it from your tutorial when you type this
// Write an integer value with the key "some_integer" under the current tag:
INI_WriteInt(iniFile, "some_integer", 42);
So i Add INI_WriteInt(file, "God", 1); at my God command
Then i it's worked Perfect and Writed to The .txt Files
Код:
Score = 5021
God = 1
And How the hell to Load that if the Value is 1
Reply
#8

What the Hell is tag -_-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)