[HELP] Saving user skins - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Saving user skins (
/showthread.php?tid=94334)
[HELP] Saving user skins -
Matthew_Murdoch - 29.08.2009
Topic says it all.
How do i . .when i pick a skin then leave and go back into server, spawn at the location i set.
I choose a skin, play, exit server. Then when i come back have to go through selecting a skin again.
Help.
Re: [HELP] Saving user skins -
Correlli - 29.08.2009
I don't know what are you using (dini/dudb, .. ?), but you would need to get the player's skin by using GetPlayerSkin and save it to player's account and then load it on the next login and set it by using SetPlayerSkin.
https://sampwiki.blast.hk/wiki/GetPlayerSkin
https://sampwiki.blast.hk/wiki/SetPlayerSkin
Re: [HELP] Saving user skins -
James_Alex - 29.08.2009
this code saves your stats when you disconnect and you got it you when you log back
pawn Код:
/*================================================================================================
This Code was created by James_Aex to help Matthew_Murdoch
==================================================================================================*/
//=======================================|Includes|================================================//
#include <a_samp>
#include <dini>
public OnPlayerDisconnect(playerid, reason)
{
new str[128];
new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname));
format(str, sizeof(str), "Stats/%s.cfg", plname);
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, A);
dini_FloatSet(str, "CrashX", X); dini_FloatSet(str, "CrashY", Y); dini_FloatSet(str, "CrashZ", Z); dini_FloatSet(str, "CrashAngle", A);
dini_IntSet(str, "CrashInt", GetPlayerInterior(playerid));
dini_IntSet(str, "Skin", GetPlayerSkin(playerid));
if(reason == 0)
{
dini_IntSet(str, "Crashed", 1);
return 1;
}
return 1;
}
public OnPlayerSpawn(playerid)
{
new str[128];
new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname));
format(str, sizeof(str), "Stats/%s.cfg", plname);
if(dini_Exists(str))
{
new crashed = dini_Int(str, "Crashed");
if(crashed == 1)
{
SetPlayerPos(playerid, dini_Float(str, "CrashX"), dini_Float(str, "CrashY"), dini_Float(str, "CrashZ"));
SetPlayerInterior(playerid, dini_Int(str, "CrashInt")); SetPlayerFacingAngle(playerid, dini_Float(str, "CrashAngle"));
GameTextForPlayer(playerid, "~r~crashed. ~w~returning to your last position.", 7000, 1);
dini_IntSet(str, "Crashed", 0);
SetPlayerSkin(playerid, dini_Int(str, "Skin"));
return 1;
}
return 1;
}
else
{
dini_Create(str);
}
return 1;
}
Re: [HELP] Saving user skins -
Correlli - 29.08.2009
This code will only work if he's using dini/dudb-system.
Re: [HELP] Saving user skins -
James_Alex - 29.08.2009
so he can use the GF system
or create his own one
i've juste gived him this code, cuz it is the most easy
Re: [HELP] Saving user skins -
Matthew_Murdoch - 29.08.2009
Well at the top iv included
dutils and dudb
will it work
AND im against GF. so not possible