[Ajuda] Deslogar e logar nas mesmas coords
#1

Olha, queria que quando o player deslogasse salvasse as coordenadas usando dof2 (include que eu uso) e apуs logar ele spawnar nas coordenadas que salvou a ele deslogar.. Comecei a mexer ontem com salvamentos de arquivos em .ini, e preciso de ajuda.. Att!
Reply
#2

up№ ajudaaa.
Reply
#3

Arrume conforme seu gm!
pawn Code:
TitoInfo::SalvarPlayer(playerid)
{
    new file[40];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(file, sizeof(file), "Contas/%s.ini", Name);

    if(!DOF2_FileExists(file)) DOF2_CreateFile(file);

    GetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
    DOF2_SetFloat(file, "PosX", PlayerInfo[playerid][PosX]);
    DOF2_SetFloat(file, "PosY", PlayerInfo[playerid][PosY]);
    DOF2_SetFloat(file, "PosZ", PlayerInfo[playerid][PosZ]);
    DOF2_SetFloat(file, "InteriorID", GetPlayerInterior(playerid));

    DOF2_SaveFile();
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new file[60];
    GetPlayerName(playerid, Name,sizeof(Name));
    format(file, sizeof(file), "Contas/%s.ini", Name);

    PlayerInfo[playerid][PosX] = DOF2_GetFloat(file, "PosX");
    PlayerInfo[playerid][PosY] = DOF2_GetFloat(file, "PosY");
    PlayerInfo[playerid][PosZ] = DOF2_GetFloat(file, "PosZ");
    SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]);
    SetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
    return 1;
}
Reply
#4

Quote:
Originally Posted by mau.tito
View Post
Arrume conforme seu gm!
pawn Code:
TitoInfo::SalvarPlayer(playerid)
{
    new file[40];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(file, sizeof(file), "Contas/%s.ini", Name);

    if(!DOF2_FileExists(file)) DOF2_CreateFile(file);

    GetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
    DOF2_SetFloat(file, "PosX", PlayerInfo[playerid][PosX]);
    DOF2_SetFloat(file, "PosY", PlayerInfo[playerid][PosY]);
    DOF2_SetFloat(file, "PosZ", PlayerInfo[playerid][PosZ]);
    DOF2_SetFloat(file, "InteriorID", GetPlayerInterior(playerid));

    DOF2_SaveFile();

    return 1;
}

public OnPlayerSpawn(playerid)
{
    new file[60];
    GetPlayerName(playerid, Name,sizeof(Name));
    format(file, sizeof(file), "Contas/%s.ini", Name);

    PlayerInfo[playerid][PosX] = DOF2_GetFloat(file, "PosX");
    PlayerInfo[playerid][PosY] = DOF2_GetFloat(file, "PosY");
    PlayerInfo[playerid][PosZ] = DOF2_GetFloat(file, "PosZ");
    SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]);
    SetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
    return 1;
}
rep+ tanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)