Save pos problem.
#2

You have to save player data on files, use dini, SII or y_ini.

example with SII:
Writing:
pawn Код:
public OnPlayerDisconnect(playerid, reason);
{
  new Float:X,Float:Y,Float:Z;
  GetPlayerPos(playerid,X,Y,Z);
  INI_Open("Positions.txt");
  new string[256];
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,sizeof(name));
  format(string,sizeof(string),"%sX",name);
  INI_WriteFloat(string,X);
  format(string,sizeof(string),"%sY",name);
  INI_WriteFloat(string,Y);
  format(string,sizeof(string),"%sZ",name);
  INI_WriteFloat(string,Z);
  INI_Save();
  INI_Close();
  return 1;
}
To load it:
pawn Код:
OnPlayerConnect(playerid)
{
  SetPVarInt(playerid,"Spawned",0);
  return 1;
}

public OnPlayerSpawn(playerid)
{
  //First the other thing because theres a return 1 below.
  if(GetPVarInt(playerid, "Spawned") == 0)
  {
    SetPVarInt(playerid, "Spawned", 1);
    new name[20];
    new Float:X,Float:Y,Float:Z;
    GetPlayerName(playerid,name,sizeof(name));
    new string[256];
    INI_Open("Positions.txt");
    format(string,sizeof(string),"%sX",name);
    X = INI_ReadFloat(string);
    format(string,sizeof(string),"%sY",name);
    Y = INI_ReadFloat(string);
    format(string,sizeof(string),"%sZ",name);
    Z = INI_ReadFloat(string);
    SetPlayerPos(playerid,X,Y,Z);
    return 1;
  }
  return 1;
}
Reply


Messages In This Thread
Save pos problem. - by tuuker - 03.03.2011, 14:32
Re: Save pos problem. - by Sasino97 - 03.03.2011, 14:46
Re: Save pos problem. - by tuuker - 03.03.2011, 14:50
Re: Save pos problem. - by Sasino97 - 03.03.2011, 14:51
Re: Save pos problem. - by JaTochNietDan - 03.03.2011, 14:57
Re: Save pos problem. - by tuuker - 03.03.2011, 15:03
Re: Save pos problem. - by JaTochNietDan - 03.03.2011, 15:05
Re: Save pos problem. - by tuuker - 03.03.2011, 15:11
Re: Save pos problem. - by JaTochNietDan - 03.03.2011, 15:18
Re: Save pos problem. - by tuuker - 03.03.2011, 15:23

Forum Jump:


Users browsing this thread: 1 Guest(s)