[HELP] Saving user skins
#1

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

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

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;
}
Download Dini HERE
Reply
#4

This code will only work if he's using dini/dudb-system.
Reply
#5

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

Well at the top iv included

dutils and dudb

will it work

AND im against GF. so not possible
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)