save score - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: save score (
/showthread.php?tid=505921)
save score -
WorldPro - 10.04.2014
how to save score after exit the server ?
Re: save score -
DerickClark - 10.04.2014
OnPlayerDisconnect
**EDIT**
What saving system you using?
Like,
Mysql, Y_Ini, Dini, or other admin system?
Re: save score -
WorldPro - 11.04.2014
Quote:
Originally Posted by DerickClark
OnPlayerDisconnect
**EDIT**
What saving system you using?
Like,
Mysql, Y_Ini, Dini, or other admin system?
|
i want a saving system using Dini.
Re: save score -
Affan - 11.04.2014
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name); // Change path
if(gPlayerLogged[playerid] == 1) // Change your is player logged in
{
dini_IntSet(file, "Score", PInfo[playerid][pScore]); // Change to the settings you made in the enum
}
return 1;
}
Re: save score -
DerickClark - 11.04.2014
Quote:
Originally Posted by Affan
pawn Код:
public OnPlayerDisconnect(playerid, reason) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); // Change path if(gPlayerLogged[playerid] == 1) // Change your is player logged in { dini_IntSet(file, "Score", PInfo[playerid][pScore]); // Change to the settings you made in the enum } return 1; }
|
.......
Re: save score -
WorldPro - 12.04.2014
Quote:
Originally Posted by Affan
pawn Код:
public OnPlayerDisconnect(playerid, reason) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); // Change path if(gPlayerLogged[playerid] == 1) // Change your is player logged in { dini_IntSet(file, "Score", PInfo[playerid][pScore]); // Change to the settings you made in the enum } return 1; }
|
you just send me a unfull code -_-
Re: save score -
Equuuuin0X - 12.04.2014
I can make you a Y_INI saving system, aight ?
put this ontop of the script
pawn Код:
#define PATH "/Users/%s.ini"
put this anywhere
pawn Код:
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
Put this somewhere (if you have already the public, then put it at the public)
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Score",GetPlayerScore);
INI_Close(File);
return 1;
}
Isn't it simple ? instead of using dini, which is more complicated.
Re: save score -
WorldPro - 12.04.2014
Quote:
Originally Posted by Equuuuin0X
I can make you a Y_INI saving system, aight ?
put this ontop of the script
pawn Код:
#define PATH "/Users/%s.ini"
put this anywhere
pawn Код:
stock UserPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),PATH,playername); return string; }
Put this somewhere (if you have already the public, then put it at the public)
pawn Код:
public OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Score",GetPlayerScore); INI_Close(File); return 1; }
Isn't it simple ? instead of using dini, which is more complicated.
|
i did that the Score in tab will be money , it will be save me Score as money now ?
Re: save score -
Equuuuin0X - 12.04.2014
Anytime, dont forget to create directory/folder named ''Users'' in your scriptfiles.
EDIT:
Can you enlighten(explain) me more what do you mean ?
Re: save score -
WorldPro - 12.04.2014
Quote:
Originally Posted by Equuuuin0X
Anytime, dont forget to create directory/folder named ''Users'' in your scriptfiles.
|
D:\GAME-Zone\gamemodes\GAME-Zone.pwn(615) : error 076: syntax error in the expression, or invalid function call
Line:
INI_WriteInt(File,"Score",GetPlayerScore);