[Ajuda] nгo salva (dini)
#2

Aqui estб um salvamento em SII, se quiser usar, use-o pois й bem melhor.

pawn Код:
#include <SII> // topo do gamemode

stock SalvarDadosPlayer(playerid)
{
    static Float:PosX, Float:PosY, Float:PosZ, Float:Vida, Float:Colete;
    GetPlayerHealth(playerid, Vida);
    GetPlayerArmour(playerid, Colete);
    GetPlayerPos(playerid, PosX, PosY, PosZ);
    format(arquivo, sizeof(arquivo), ContasPlayers, getName(playerid));
    if(!INI_Exist(arquivo)) return 0x1;

    INI_Open(arquivo);
    INI_WriteInt("Dinheiro", GetPlayerMoney(playerid));
    INI_WriteInt("Level", GetPlayerScore(playerid));
    INI_WriteInt("Exp",PlayerInfo[playerid][Exp]);
    INI_WriteInt("LevelProcurado", GetPlayerWantedLevel(playerid));
    INI_WriteInt("Algemado",PlayerInfo[playerid][Algemado]);
    INI_WriteInt("Skin", GetPlayerSkin(playerid));
    INI_WriteFloat("Vida", Vida);
    INI_WriteFloat("Colete", Colete);
    INI_WriteFloat("PosX", PosX);
    INI_WriteFloat("PosY", PosY);
    INI_WriteFloat("PosZ", PosZ);
    INI_WriteInt("Interior", GetPlayerInterior(playerid));
    INI_WriteInt("VirtualWorld", GetPlayerVirtualWorld(playerid));
    INI_WriteInt("TemConta", PlayerInfo[playerid][TemConta]);
    INI_WriteInt("Saldo", PlayerInfo[playerid][Saldo]);
    INI_WriteInt("Admin", PlayerInfo[playerid][Admin]);
    INI_WriteInt("Profissao",PlayerProf[playerid]);
    INI_WriteInt("Gasolina",Gasolina[playerid]);
    INI_WriteInt("Morreu", Morreu[playerid]);
    INI_WriteInt("Matou", Matou[playerid]);
    INI_Save();
    INI_Close();
    return 0x1;
}

stock CarregarDadosPlayer(playerid)
{
    format(arquivo, sizeof(arquivo), ContasPlayers, getName(playerid));
    if(!INI_Exist(arquivo)) return 0x1;

    INI_Open(arquivo);
    GivePlayerMoney(playerid, INI_ReadInt("Dinheiro"));
    SetPlayerScore(playerid, INI_ReadInt("Level"));
    SetPlayerSkin(playerid, INI_ReadInt("SkinAtual"));
    SetPlayerWantedLevel(playerid, INI_ReadInt("LevelProcurado"));
    Morreu[playerid] = INI_ReadInt("Morreu");
    Matou[playerid] = INI_ReadInt("Matou");
    PlayerInfo[playerid][Admin] = INI_ReadInt("Admin");
    PlayerInfo[playerid][TemConta] = INI_ReadInt("TemConta");
    PlayerInfo[playerid][Saldo] = INI_ReadInt("Saldo");
    PlayerInfo[playerid][Level] = INI_ReadInt("Level");
    PlayerInfo[playerid][Dinheiro] = INI_ReadInt("Dinheiro");
    PlayerProf[playerid] = INI_ReadInt("Profissao");
    PlayerInfo[playerid][Exp] = INI_ReadInt("Exp");
    Gasolina[playerid] = INI_ReadInt("Gasolina");
    PlayerInfo[playerid][Algemado] = INI_ReadInt("Algemado");
    PlayerInfo[playerid][Plano] = INI_ReadInt("Plano");
    PlayerInfo[playerid][Convenio] = INI_ReadInt("Convenio");
    INI_Close();
    return 0x1;
}

// OnPlayerConnect
public OnPlayerConnect(playerid)
{
    new str[128];
    PrimeiroSpawn[playerid] = true;
    TextDrawShowForPlayer(playerid, Hora);
    TentativasDeLogar[playerid] = 0;
    format(arquivo, sizeof(arquivo), ContasPlayers, getName(playerid));
    if(!INI_Exist(arquivo))
    {
        format(_string, sizeof(_string), "{0000F6}SEUSERVIDOR\n{FFFFFF}MENSAGEM.\n\nNome: {FFFF80}%s\n\n{FFFFFF}Insira uma senha para registrar-se:", getName(playerid));
        ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_PASSWORD, "{0000F6}Grand{542900}Life{FFFFFF} - Registro", _string, "Registrar", "Sair");
    }
    if(INI_Exist(arquivo))
    {
        format(_string, sizeof(_string), "{0000F6SEUSERVIDOR\n{FFFFFF}MENSAGEM\n\nNome: {FFFF80}%s\n\n{FFFFFF}Insira sua senha para logar-se:", getName(playerid));
        ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "{0000F6}Grand{542900}Life{FFFFFF} - Login", _string, "Login", "Sair");
    }

// PlayerDisconnect

SalvarDadosPlayer(playerid);
Reply


Messages In This Thread
nгo salva (dini) - by Pietrotm2013 - 06.05.2013, 21:38
Re: nгo salva (dini) - by iCracker - 06.05.2013, 22:02
Re: nгo salva (dini) - by ViictorDaay- - 06.05.2013, 22:17
Re: nгo salva (dini) - by Pietrotm2013 - 06.05.2013, 22:54
Re: nгo salva (dini) - by ViictorDaay- - 06.05.2013, 23:15

Forum Jump:


Users browsing this thread: 2 Guest(s)