Saving interior and Virtual world..... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Saving interior and Virtual world..... (
/showthread.php?tid=205785)
Saving interior and Virtual world..... -
!Pumpkin - 02.01.2011
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");
}
Re: Saving interior and Virtual world..... -
Jochemd - 02.01.2011
Get the players interior and write it into a file.. Same with Virtual world. Not hard and mabe even simpler than position.
Re: Saving interior and Virtual world..... -
!Pumpkin - 03.01.2011
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");
}
}