[Ajuda] Sistema registro
#3

Para vocк fazer o sistema de salvar ao o player sair:
pawn Код:
#include a_samp
#include dof2

new Float:E_Pos[3]; //TOPO
new bool:Spawnou[MAX_PLAYERS]; //TOPO

public OnPlayerConnect(playerid)
{
    Spawnou[playerid] = false;
    return true;
}

public OnPlayerSpawn(playerid)
{
    if(Spawnou[playerid] == false)
    {
        Spawnou[playerid] = true;
        SetPlayerPos(playerid, DOF2::GetFloat(SalvarCoord(playerid), "Coordenada X"), DOF2::GetFloat(SalvarCoord(playerid), "Coordenada Y"), DOF2::GetFloat(SalvarCoord(playerid), "Coordenada Z"));
    }
    return true;
}

public OnPlayerDisconnect(playerid)
{
    GetPlayerPos(playerid, E_Pos[0], E_Pos[1], E_Pos[2]);
    if(!DOF2::FileExists(SalvarCoord(playerid))) DOF2::CreateFile(SalvarCoord(playerid));
    DOF2::SetFloat(SalvarCoord(playerid), "Coordenada X", E_Pos[0]);
    DOF2::SetFloat(SalvarCoord(playerid), "Coordenada Y", E_Pos[1]);
    DOF2::SetFloat(SalvarCoord(playerid), "Coordenada Z", E_Pos[2]);
    DOF2::SaveFile();
    return true;
}

stock SalvarCoord(playerid)
{
    new E_arquivo[40], E_name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, E_name, sizeof(E_name));
    format(E_arquivo, sizeof(E_arquivo), "Coordenada/%s.sav", E_name);
    return E_arquivo;
}
Reply


Messages In This Thread
Sistema registro - by sh0wtime - 11.12.2012, 16:07
Re: Sistema registro - by mau.tito - 11.12.2012, 16:21
Re: Sistema registro - by EditPawn - 11.12.2012, 16:31
Re: Sistema registro - by sh0wtime - 11.12.2012, 16:33
Re: Sistema registro - by EditPawn - 11.12.2012, 16:46
Re: Sistema registro - by sh0wtime - 11.12.2012, 16:57
Re: Sistema registro - by mau.tito - 11.12.2012, 17:09
Re: Sistema registro - by sh0wtime - 11.12.2012, 17:20
Re: Sistema registro - by JonathanFeitosa - 11.12.2012, 17:21
Re: Sistema registro - by sh0wtime - 11.12.2012, 17:24

Forum Jump:


Users browsing this thread: 2 Guest(s)