Dini issue
#1

~~~~~~~~~~
Reply
#2

Stop using dini. It's old and VERY inefficient. Use y_ini.
Reply
#3

My gm is dini so thats why i use dini...
Reply
#4

You can change dini to y_ini..
Reply
#5

Код:
enum PlayerStats
{
    FavSkin
}
pStats[MAX_PLAYERS][PlayerStats];
Код:
public OnPlayerConnect(playerid)
{
    new file[256];
    format(file, sizeof file, "Stats/%s.ini", PlayerName(playerid));

    if(!dini_Exists(file))
    {
        dini_Create(file);
        dini_IntSet(file, "FavSkin", 300);
        return 1;
    }
    if(dini_Exists(file))
    {
        if(dini_Int(file, "FavSkin") < 300)
	pStats[playerid][FavSkin] = dini_Int(file, "FavSkin");
        return 1;
    }
}

public OnPlayerSpawn(playerid)
{
    new file[256];
    format(file, sizeof file, "Stats/%s.ini", PlayerName(playerid));
    if(dini_Exists(file))
    {
        SetPlayerSkin(playerid, pStats[playerid][FavSkin]);
    }
    return 1;
}

CMD:favouriteskin(playerid, params[])
{
    #pragma unused params
    if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    new file[256];
    format(file, sizeof file, "Stats/%s.ini", PlayerName(playerid));
    dini_IntSet(file, "FavSkin", GetPlayerSkin(playerid));
    pStats[playerid][FavSkin] = GetPlayerSkin(playerid);
    SendClientMessage(playerid, COLOR_PINK, "You Have Successfully Saved Your Skin.");
    return 1;
}
Reply
#6

Still crashing.....
Reply
#7

Quote:
Originally Posted by VishvaJeet
Посмотреть сообщение
Код:
enum PlayerStats
{
    FavSkin
}
pStats[MAX_PLAYERS][PlayerStats];
should be
pawn Код:
enum PlayerStats
{
    FavSkin
}
new pStats[MAX_PLAYERS][PlayerStats];
Reply
#8

oh yes i forgot to add
Код:
new
Reply
#9

Already had that
Reply
#10

Here, this works like a charm:
pawn Код:
enum PlayerStats
{
    FavSkin
}
new pStats[MAX_PLAYERS][PlayerStats];


public OnPlayerConnect(playerid)
{
    new file[256];
    format(file, sizeof(file), "Stats/%s.ini", PlayerName(playerid));

    if(!dini_Exists(file))
    {
        dini_Create(file);
        dini_IntSet(file, "FavSkin", 0);
    }
    else
    {
        pStats[playerid][FavSkin] = dini_Int(file, "FavSkin");
    }
    return 1;
}


public OnPlayerSpawn(playerid)
{
    SetPlayerSkin(playerid, pStats[playerid][FavSkin]);
    return 1;
}



//Command:
    if (strcmp("/favouriteskin", cmdtext, true, 10) == 0)
    {
        new file[256];
        format(file, sizeof(file), "Stats/%s.ini", PlayerName(playerid));
        dini_IntSet(file, "FavSkin", 2);
        SetPlayerSkin(playerid, 2);
        SendClientMessage(playerid, -1, "You Have Successfully Saved Your Skin.");
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)