save score
#1

how to save score after exit the server ?
Reply
#2

OnPlayerDisconnect


**EDIT**
What saving system you using?

Like,
Mysql, Y_Ini, Dini, or other admin system?
Reply
#3

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.
Reply
#4

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;
}
Reply
#5

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;
}
.......
Reply
#6

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 -_-
Reply
#7

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.
Reply
#8

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 ?
Reply
#9

Anytime, dont forget to create directory/folder named ''Users'' in your scriptfiles.
EDIT:

Can you enlighten(explain) me more what do you mean ?
Reply
#10

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);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)