1.
Not using y_ini you can convert it by you're self (i'm not a y_ini person (file functions or dini
![Cheesy](images/smilies/biggrin.png)
)
pawn Код:
enum E_POSITION_DATA
{
Float:e_fLastX,
Float:e_fLastY,
Float:e_fLastZ,
Float:e_fLastAngle,
e_iLastWorld,
e_iLastInt,
};
new PositionData[MAX_PLAYERS][E_POSITION_DATA];
stock SaveLastPos(playerid)
{
new
File:PosFile,
fOutput[64],
FileDest[MAX_PLAYER_NAME + 64];
GetPlayerPos(playerid, PositionData[playerid][e_fLastX], PositionData[playerid][e_fLastY], PositionData[playerid][e_fLastZ]);
GetPlayerFacingAngle(playerid, PositionData[playerid][e_fLastAngle]);
PositionData[playerid][e_iLastWorld] = GetPlayerVirtualWorld(playerid);
PositionData[playerid][e_iLastWorld] = GetPlayerInterior(playerid);
format(fOutput, sizeof(fOutput), "%f|%f|%f|%f|%d|%d",
PositionData[playerid][e_fLastX],
PositionData[playerid][e_fLastY],
PositionData[playerid][e_fLastZ],
PositionData[playerid][e_fLastAngle],
PositionData[playerid][e_iLastWorld],
PositionData[playerid][e_iLastInt]
);
GetPlayerName(playerid, FileDest, MAX_PLAYER_NAME);
format(FileDest, sizeof(FileDest), "lastpos/%s.txt", FileDest);
PosFile = fopen(FileDest, io_write);
fwrite(PosFile, fOutput);
fclose(PosFile);
}
stock LoadLastPos(playerid)
{
new
File:PosFile,
PosData[MAX_PLAYER_NAME + 64];
GetPlayerName(playerid, PosData, MAX_PLAYER_NAME);
format(PosData, sizeof(PosData), "lastpos/%s.txt", PosData);
if(fexist(PosData))
{
PosFile = fopen(PosData, io_read);
fread(PosFile, PosData);
fclose(PosFile);
sscanf(PosData, "p<|>ffffdd",
PositionData[playerid][e_fLastX],
PositionData[playerid][e_fLastY],
PositionData[playerid][e_fLastZ],
PositionData[playerid][e_fLastAngle],
PositionData[playerid][e_iLastWorld],
PositionData[playerid][e_iLastInt]
);
SetPlayerPos(playerid, PositionData[playerid][e_fLastX], PositionData[playerid][e_fLastY], PositionData[playerid][e_fLastZ]);
SetPlayerFacingAngle(playerid, PositionData[playerid][e_fLastAngle]);
SetPlayerVirtualWorld(playerid, PositionData[playerid][e_iLastWorld]);
SetPlayerInterior(playerid, PositionData[playerid][e_iLastInt]);
SetCameraBehindPlayer(playerid);
}
else
{
SetPlayerPos(playerid,x,y,z); // If they don't have a position saved they'll spawn here
}
}
public OnPlayerDisconnect(playerid) return SaveLastPos(playerid);
public OnPlayerSpawn(playerid) return LoadLastPos(playerid);
EDIT:
2.
Get you're defines/variables to registration system.
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(Logged[playerid] == 1)
{
// accesses the checkpoint
}
else
{
SendClientMessage(playerid,-1,"You are not registered");
}
return 1;
}