02.01.2011, 10:39
I got this code :
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; 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"); }
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"); }