SA-MP Forums Archive
Skin isn't saving - 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: Skin isn't saving (/showthread.php?tid=279923)



Skin isn't saving - Kingunit - 29.08.2011

<fixed>


Re: Skin isn't saving - iPLEOMAX - 29.08.2011

How do you Parse the load function?


Re: Skin isn't saving - Jafet_Macario - 29.08.2011

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


Re: Skin isn't saving - Kingunit - 29.08.2011

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.


Re: Skin isn't saving - PhoenixB - 29.08.2011

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


Re: Skin isn't saving - Kingunit - 29.08.2011

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.


Re: Skin isn't saving - [MG]Dimi - 29.08.2011

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.


Re: Skin isn't saving - iPLEOMAX - 29.08.2011

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



Re: Skin isn't saving - Kingunit - 29.08.2011

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