SA-MP Forums Archive
Question - 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: Question (/showthread.php?tid=93907)



Question - Jokerr_mayne - 27.08.2009

I have created a login /register system in my gm but how do i make that when you do /login you spawn with the skin you have choosen and the position where you where last if sombody know please explane to me

Hope to get some help


Re: Question - James_Alex - 27.08.2009

search for it
i remeber that i answered this question 5 times


Re: Question - Jokerr_mayne - 27.08.2009

Oke thanks alot i go try but if i dont find maby you want to past a link :P


Re: Question - James_Alex - 27.08.2009

ok take this code
pawn Код:
/*================================================================================================
                    This Code was created by James_Aex to help Jokerr_mayne
==================================================================================================*/


//=======================================|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



Re: Question - Jokerr_mayne - 27.08.2009

Cant find what i mean i search player save pos

my question is that when a player disconect his loc is saved and when he log back in he spawns at his disconnect location ?


Re: Question - James_Alex - 27.08.2009

change "OnPlayerSawn"
by "OnPlayerLogin" the code that gaves it to you save the player pos and skin when he disconnect


Re: Question - Jokerr_mayne - 27.08.2009

does it matter that my /register and /login use dudb ?