Skin isn't saving
#1

<fixed>
Reply
#2

How do you Parse the load function?
Reply
#3

pawn Код:
SetPlayerSkin(playerid,PlayerInfo[playerid][Skin]);
At OnPlayerConnect
Reply
#4

Quote:
Originally Posted by Jafet_Macario
Посмотреть сообщение
pawn Код:
SetPlayerSkin(playerid,PlayerInfo[playerid][Skin]);
At OnPlayerConnect
That doens't work since the skin isn't saving good.

@Above
Can you explain that better? My english isn't that good ...

// I've noticed something, the system is saving my skin when I /quit, but when I throw I GMX it isn't saved. Let me re-check everything.
Reply
#5

Try this?

pawn Код:
new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Adminlevel",PlayerInfo[playerid][Adminlevel]);
    INI_WriteInt(File,"Skin", PlayerInfo[playerid][Skin];
    INI_Close(File);

public OnPlayerDialogResponse blabla
{
    new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Adminlevel",0);
                INI_WriteInt(File,"Skin", PlayerInfo[playerid][Skin];
                INI_Close(File);
}

public OnPlayerSpawn
{
    SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
}

Give those a go, if not Re hit a post
Reply
#6

First of all thank you for posting something. I've tried it but again, when I drop a GMX I'm getting the CJ skin when I login. Just /quit and login works.
Reply
#7

When you use GMX non of the data saves since player doesn't dissconnect from server. It will just show that he lost connection from server but his client is still opened. oNce he quit the client Server wont notice it since it's offline and it won't store anything. Known SA-MP Bug. My suggestion for you is to, on command for server restart, kick all players (will save since they disconnected) and use timer to delay restart or simply store everyones data and then use timer delayed restart.
Reply
#8

If you close your server suddenly, It doesn't get any chance to save stats.
(or there is nothing that saves it on gmx)

Try something like this:

pawn Код:
forward SavePlayerStats(playerid);
public SavePlayerStats(playerid)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Adminlevel",PlayerInfo[playerid][Adminlevel]);
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_Close(File);
    return true;
}

//OnPlayerDisconnect:
SavePlayerStats(playerid);

//OnDialogResponse:
SavePlayerStats(playerid);

//OnGameModeExit:
for(new i=0; i<MAX_PLAYERS; i++) //or foreach(Player, i)
{
    if(IsPlayerConnected(i)) SavePlayerStats(playerid);
}
Reply
#9

Aah, Guys I see the problem. Since we are talking about the GMX I forget to add it there.
I think it's better to call a function instead of a big GMX.

Thank you very much all. Repped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)