Varible question
#1

Hi,I'm using enums for saving so let me try to explain what i don't know.

This is my PlayerInfo enum:
pawn Код:
enum PInfo
{
    Lozinka,
    Tut,
    Regan,
    Loginf,
    Logiran,
    Spol,
    Godine,
    Level,
    Skin,
    Novac,
    Admin
}
new IgracInfo[MAX_PLAYERS][PInfo];
My registering stock
pawn Код:
stock Registracija(playerid,key[])
{
    new datoteka[64];new name[24];
    GetPlayerName(playerid,name,sizeof(name));
    format(datoteka,sizeof(datoteka),"/korisnici/%s.txt",name);
    dini_Create(datoteka);
    dini_Set(datoteka,"Lozinka",key);
    dini_IntSet(datoteka,"Tut",0);
    dini_IntSet(datoteka,"Level",1);
    dini_IntSet(datoteka,"Regan",0);
    dini_IntSet(datoteka,"Novac",500);
    dini_IntSet(datoteka,"Logiran",0);
    return 1;
}
Loading stock
pawn Код:
stock UcitavanjeAcc(playerid)
{
    new datoteka[64];
    new name[24];
    GetPlayerName(playerid,name,sizeof(name));
    format(datoteka,sizeof(datoteka),"/korisnici/%s.txt",name);
    IgracInfo[playerid][Lozinka]=dini_Int(datoteka,"Lozinka");
    IgracInfo[playerid][Tut]=dini_Int(datoteka,"Tut");
    IgracInfo[playerid][Spol]=dini_Int(datoteka,"Spol");
    IgracInfo[playerid][Skin]=dini_Int(datoteka,"Skin");
    SetPlayerScore(playerid,dini_Int(datoteka,"Level"));
    GivePlayerMoney(playerid,dini_Int(datoteka,"Novac"));
    IgracInfo[playerid][Logiran]=dini_Int(datoteka,"Logiran");
    IgracInfo[playerid][Godine]=dini_Int(datoteka,"Godine");
        return 1;
}
And saving stock
pawn Код:
stock SpremanjeAcc(playerid)
{
    new datoteka[64],name[24];
    GetPlayerName(playerid,name,sizeof(name));
    format(datoteka,sizeof(datoteka),"/korisnici/%s.txt",name);
    dini_IntSet(datoteka,"Level",GetPlayerScore(playerid));
    dini_IntSet(datoteka,"Novac",GetPlayerMoney(playerid));
    dini_IntSet(datoteka,"Spol",IgracInfo[playerid][Spol]);
    dini_IntSet(datoteka,"Godine",IgracInfo[playerid][Godine]);
    dini_IntSet(datoteka,"Tut",IgracInfo[playerid][Tut]);
    dini_IntSet(datoteka,"Skin",GetPlayerSkin(playerid));
    dini_IntSet(datoteka,"Logiran",0);
    return 1;
}
Lets take an example on how i would make my admin system:

First i would set the player admin to 0 when he registers

pawn Код:
stock Registracija(playerid,key[])
{
    dini_IntSet(datoteka,"Admin",0);
    return 1;
}
Then when the player logins i would load it
pawn Код:
stock UcitavanjeAcc(playerid)
{
    IgracInfo[playerid][Admin]=dini_Int(datoteka,"Admin");
    return 1;
}
and when he leaves i would save it
pawn Код:
stock SpremanjeAcc(playerid)
{
    dini_IntSet(datoteka,"Admin",IgracInfo[playerid][Admin]);
    return 1;
}

Now i would like to make and /setadmin [playerid] [admin level] command and here i m stuck.

I would also like to know how could i make all this using SetPVarInt?

Thanks.
Reply
#2

Anyone knows
Reply
#3

http://*******/ddZnp

And for the love of god, use English variable names! Keywords are English, function names are English, the program is English. Ito nly makes it harder to understand for people that do not speak your language.
Reply
#4

Can PVars get in conflicts with another?Like transfering to other players?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)