17.06.2012, 20:24
Hi,I'm using enums for saving so let me try to explain what i don't know.
This is my PlayerInfo enum:
My registering stock
Loading stock
And saving stock
Lets take an example on how i would make my admin system:
First i would set the player admin to 0 when he registers
Then when the player logins i would load it
and when he leaves i would save it
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.
This is my PlayerInfo enum:
pawn Код:
enum PInfo
{
Lozinka,
Tut,
Regan,
Loginf,
Logiran,
Spol,
Godine,
Level,
Skin,
Novac,
Admin
}
new IgracInfo[MAX_PLAYERS][PInfo];
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;
}
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;
}
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;
}
First i would set the player admin to 0 when he registers
pawn Код:
stock Registracija(playerid,key[])
{
dini_IntSet(datoteka,"Admin",0);
return 1;
}
pawn Код:
stock UcitavanjeAcc(playerid)
{
IgracInfo[playerid][Admin]=dini_Int(datoteka,"Admin");
return 1;
}
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.