Saving interior and Virtual world.....
#1

I got this code :
Code:
#include <a_samp>
#include <Dini>
#include <dudb>

#define COLOR_PURPLE 0xC2A2DAAA

new Float:positionx;
new Float:positiony;
new Float:positionz;

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Addons for CityLife :)");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	LoadStats(playerid);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new Float:x;
	new Float:y;
	new Float:z;

	GetPlayerPos(playerid,x,y,z);
	positionx = x;
	positiony = y;
	positionz = z;
	if (!dini_Exists(FileStats(playerid)))
	{
		dini_Create(FileStats(playerid));
	}

	SaveStats(playerid);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerPos(playerid,positionx,positiony,positionz);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}


Player(playerid)
{
 new player[MAX_PLAYER_NAME];
 GetPlayerName(playerid, player, sizeof(player));
 return player;
}

FileStats(playerid)
{
  new a[256]; format(a, sizeof(a), "clrp/Positions/%s.ini",udb_encode(Player(playerid)));
  return a;
}

SaveStats(playerid)
{
  dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
}

LoadStats(playerid)
{
  positionx = dini_Int(FileStats(playerid), "PositionX");
  positiony = dini_Int(FileStats(playerid), "PositionY");
  positionz = dini_Int(FileStats(playerid), "PositionZ");
}
It saves my x,y and z position but how to make it save my interior and virtual world to ?
any help ? Thank you.

EDIT: Ahh im so confused im this far atm :

Code:
#include <a_samp>
#include <Dini>
#include <dudb>

#define COLOR_PURPLE 0xC2A2DAAA

new Float:positionx;
new Float:positiony;
new Float:positionz;
new Int = GetPlayerInterior(playerid);
new Vir = GetPlayerVirtualWorld(playerid);



public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Addons for CityLife :)");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	LoadStats(playerid);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new Float:x;
	new Float:y;
	new Float:z;
	new Int = GetPlayerInterior(playerid);
	new Vir = GetPlayerVirtualWorld(playerid);

	GetPlayerPos(playerid,x,y,z);
	GetPlayerInterior(playerid);
	GetPlayerVirtualWorld(playerid);
	positionx = x;
	positiony = y;
	positionz = z;
	if (!dini_Exists(FileStats(playerid)))
	{
		dini_Create(FileStats(playerid));
	}

	SaveStats(playerid);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	SetPlayerPos(playerid,positionx,positiony,positionz);
	SetPlayerInterior(playerid, 0);
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}


Player(playerid)
{
 new player[MAX_PLAYER_NAME];
 GetPlayerName(playerid, player, sizeof(player));
 return player;
}

FileStats(playerid)
{
  new a[256]; format(a, sizeof(a), "clrp/Positions/%s.ini",udb_encode(Player(playerid)));
  return a;
}

SaveStats(playerid)
{
  dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
}

LoadStats(playerid)
{
  positionx = dini_Int(FileStats(playerid), "PositionX");
  positiony = dini_Int(FileStats(playerid), "PositionY");
  positionz = dini_Int(FileStats(playerid), "PositionZ");
}
Reply
#2

Get the players interior and write it into a file.. Same with Virtual world. Not hard and mabe even simpler than position.
Reply
#3

Ahh Ffs someone help me please :/


Code:
#include <a_samp>
#include <Dini>
#include <dudb>

#define COLOR_PURPLE 0xC2A2DAAA

new Float:positionx;
new Float:positiony;
new Float:positionz;
new Int;
new Vir;

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Addons for CityLife :)");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    LoadStats(playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new Float:x;
    new Float:y;
    new Float:z;
    new Interior;
    new Virtual;

    GetPlayerPos(playerid,x,y,z);
    GetPlayerInterior(playerid);
    GetPlayerVirtualWorld(playerid);
    positionx = x;
    positiony = y;
    positionz = z;
	Interior = Int;
	Virtual = Vir;
    if (!dini_Exists(FileStats(playerid)))
    {
        dini_Create(FileStats(playerid));
    }

    SaveStats(playerid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid,positionx,positiony,positionz);
    SetPlayerInterior(playerid, Int);
    SetPlayerVirtualWorld(playerid, Vir);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}


Player(playerid)
{
 new player[MAX_PLAYER_NAME];
 GetPlayerName(playerid, player, sizeof(player));
 return player;
}

FileStats(playerid)
{
  new a[256]; format(a, sizeof(a), "CLRPPositions/%s.ini",udb_encode(Player(playerid)));
  return a;
}

SaveStats(playerid)
{
  dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
  dini_IntSet(FileStats(playerid), "Interior", floatround(Int));
  dini_IntSet(FileStats(playerid), "VirWorld", floatround(Vir));
}

LoadStats(playerid)
{
  positionx = dini_Int(FileStats(playerid), "PositionX");
  positiony = dini_Int(FileStats(playerid), "PositionY");
  positionz = dini_Int(FileStats(playerid), "PositionZ");
  Int = dini_Int(FileStats(playerid), "Interior");
  Vir = dini_Int(FileStats(playerid), "Virtual");
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)