how would i save this? -
Lethaal - 22.02.2011
how would i like save this using this save function
Код:
dUserSetINT(PlayerName(playerid)).("vip",???;
i want to make it save this
vip[playerid] = 0;
and making it load ur level
Код:
???(playerid,dUserINT(PlayerName(playerid)).("vip"));
thanks
Re: how would i save this? -
Anteino - 22.02.2011
Save it to where? A file, database?
Re: how would i save this? -
Lethaal - 22.02.2011
Quote:
Originally Posted by Anteino
Save it to where? A file, database?
|
to this account
*note* this file is called Cookie.dudb
password_hash=*hidden*
money=444844
score=205
i want it to be
password_hash=*hidden*
money=444844
score=205
vip=*the lv*
Re: how would i save this? -
maramizo - 22.02.2011
pawn Код:
dini_IntSet(file, "vip", vip[playerid]);
pawn Код:
vip[playerid] = dini_Int(file, "vip");
Re: how would i save this? -
Lethaal - 22.02.2011
Quote:
Originally Posted by maramizo
pawn Код:
dini_IntSet(file, "vip", vip[playerid]);
pawn Код:
vip[playerid] = dini_Int(file, "vip");
|
could you please write it out in this
example :
Код:
dUserSetINT(PlayerName(playerid)).("score",GetPlayerScore(playerid));
thanks
Re: how would i save this? -
maramizo - 22.02.2011
You should save everything at once, instead of using dUserSetINT many times over and over.
Here's the tutorial.
pawn Код:
dcmd_register(playerid, params[])
{
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE:/register [password]");
if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "You are already registered!");
dini_Create(file);
dini_IntSet(file, "hashPW", udb_hash(params));
dini_Set(file, "password", params);
dini_IntSet(file, "level", 0);
dini_IntSet(file, "score", GetPlayerScore(playerid));
dini_IntSet(file, "money", GetPlayerMoney(playerid));
new string[128];
format(string, 128, "You succesfully registered the nickname %s with password %s", pname, params);
SendClientMessage(playerid, COLOR_YELLOW, string);
logged[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "You have been automatically logged in!");
return 1;
}
I'd rather use OnPlayerDisconnect public though, so it automatically saves whenever you leave.
Re: how would i save this? -
Lethaal - 22.02.2011
Quote:
Originally Posted by maramizo
You should save everything at once, instead of using dUserSetINT many times over and over.
Here's the tutorial.
pawn Код:
dcmd_register(playerid, params[]) { new file[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), "\\Users\\%s.ini", pname); if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE:/register [password]"); if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "You are already registered!"); dini_Create(file); dini_IntSet(file, "hashPW", udb_hash(params)); dini_Set(file, "password", params); dini_IntSet(file, "level", 0); dini_IntSet(file, "score", GetPlayerScore(playerid)); dini_IntSet(file, "money", GetPlayerMoney(playerid)); new string[128]; format(string, 128, "You succesfully registered the nickname %s with password %s", pname, params); SendClientMessage(playerid, COLOR_YELLOW, string); logged[playerid] = 1; SendClientMessage(playerid, COLOR_YELLOW, "You have been automatically logged in!"); return 1; }
I'd rather use OnPlayerDisconnect public though, so it automatically saves whenever you leave.
|
k but all i want is it gets ur vip whatever it is saves it and when u login it loads it :S
Re: how would i save this? -
maramizo - 22.02.2011
Again...
pawn Код:
dini_IntSet(file, "vip", vip[playerid]);
pawn Код:
vip[playerid] = dini_Int(file, "vip");
Re: how would i save this? -
Lethaal - 22.02.2011
Quote:
Originally Posted by maramizo
Again...
pawn Код:
dini_IntSet(file, "vip", vip[playerid]);
pawn Код:
vip[playerid] = dini_Int(file, "vip");
|
i get 1 error
C:\Users\Stephen-Laptop\Desktop\Samp Stunt Server\filterscripts\regsystem.pwn(74) : error 017: undefined symbol "file"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: how would i save this? -
maramizo - 22.02.2011
pawn Код:
//Should be like this
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
Add that behind line 74.
Re: how would i save this? -
Lethaal - 22.02.2011
it doesnt save it - it doesnt add vip=Thenumber
it just stays as
password_hash=*hidden*
money=0
score=0
could we possably teamviewer it?
Re: how would i save this? -
Lethaal - 23.02.2011
sorry need to bump also heres my register & login code
Код:
dcmd_register(playerid,params[]) {
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"{F81414}Your Already Registered!");
if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"{F81414}Your Registered But Not Logged In Type /login [password]");
if (strlen(params)==0) return SystemMsg(playerid,"{F81414}USAGE: /register [password]");
if (udb_Create(PlayerName(playerid),params))
{
SystemMsg(playerid,"{6EF83C}Account Created! Now Use /login [password] To Login.");
}
return true;
}
dcmd_login(playerid,params[]) {
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Your Already Logged In!");
if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"You Do Not Have An Account, Please /register [password]");
if (strlen(params)==0) return SystemMsg(playerid,"USAGE: /login [password]");
if (udb_CheckLogin(PlayerName(playerid),params)) {
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score"));
SetPlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money"));
PLAYERLIST_authed[playerid]=true;
registerspawn[playerid] = 1;
SystemMsg(playerid,"{6EF83C}Thank you For Logging In Have Fun!");
loginspeak[playerid] = 1;
return 1;
}
return SystemMsg(playerid,"{F81414}ERROR : Incorrect Password");
}
all i want is it to save their vip=theirlevel
because in the gamemode it sets it to 0 so i want it to save as - vip=0
and when they login it sets their vip to - whatever their vip=?
is
thanks
Re: how would i save this? -
Lethaal - 23.02.2011
bump
Re: how would i save this? -
MadeMan - 23.02.2011
Saving:
pawn Код:
dUserSetINT(PlayerName(playerid)).("vip",vip[playerid]);
Loading:
pawn Код:
vip[playerid] = dUserINT(PlayerName(playerid)).("vip");
Re: how would i save this? -
Lethaal - 23.02.2011
Quote:
Originally Posted by MadeMan
Saving:
pawn Код:
dUserSetINT(PlayerName(playerid)).("vip",vip[playerid]);
Loading:
pawn Код:
vip[playerid] = dUserINT(PlayerName(playerid)).("vip");
|
you know i love you right?
ty
Re: how would i save this? -
[$A$]W33D$P33D - 22.04.2011
I get this error
F:\GTA-SA\Samp\filterscripts\vip.pwn(75) : error 017: undefined symbol "logged"
F:\GTA-SA\Samp\filterscripts\vip.pwn(75) : warning 215: expression has no effect
F:\GTA-SA\Samp\filterscripts\vip.pwn(75) : error 001: expected token: ";", but found "]"
F:\GTA-SA\Samp\filterscripts\vip.pwn(75) : error 029: invalid expression, assumed zero
F:\GTA-SA\Samp\filterscripts\vip.pwn(75) : fatal error 107: too many error messages on one line