[AYUDA] Godfather
#1

Wenas mire por los FilterScripts me encontre con este codigo:

Код:
#include <Dini>
#include <dudb>

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

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)
{
	SetPlayerPos(playerid,1182.7733,-1323.6193,13.5785);
	positionx = 1182.7733;
	positiony = -1323.6193;
	positionz = 13.5785;
	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), "%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");
}
Sirve para que cuando salgas se guarden las posiciones en un archivo DINI y luego al entrar aparezcas donde lo dejastes, pero yo puse este codigo en el Godfather y no funciona... alguna ayuda?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)