16.02.2011, 05:02
Ok i think i got it now but how can i make the files with there names? It dont look like it will work unless there files are there names :S
how can i make LogPos.txt into LogPos/%s.txt so i gets and saves the positions to there names ??
Please help
how can i make LogPos.txt into LogPos/%s.txt so i gets and saves the positions to there names ??
Please help
pawn Код:
#include <a_samp>
#include <dini>
new Float:pX, Float:pY, Float:pZ;
new Float:LogPosX[MAX_PLAYERS];
new Float:LogPosY[MAX_PLAYERS];
new Float:LogPosZ[MAX_PLAYERS];
new bool:FirstLog[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
FirstLog[playerid] = true;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
GetPlayerPos(playerid, pX, pY, pZ);
LogPosX[playerid] = pX;
LogPosY[playerid] = pY;
LogPosZ[playerid] = pZ;
if(!dini_Exists("LogPos.txt"))
{
dini_Create("LogPos.txt");
}
if(dini_Exists("LogPos.txt"))
{
dini_FloatSet("LogPos.txt", "LogPosX", pX);
dini_FloatSet("LogPos.txt", "LogPosY", pY);
dini_FloatSet("LogPos.txt", "LogPosZ", pZ);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(FirstLog[playerid] == true)
{
if(dini_Exists("LogPos.txt"))
{
LogPosX[playerid] = dini_Int("LogPos.txt", "LogPosX");
LogPosY[playerid] = dini_Int("LogPos.txt", "LogPosY");
LogPosZ[playerid] = dini_Int("LogPos.txt", "LogPosZ");
}
SetPlayerPos(playerid,LogPosX[playerid],LogPosY[playerid],LogPosZ[playerid]);
FirstLog[playerid] = false;
}
return 1;
}