Carlosso co zatim ctu tak mu celou dobu radis spatne. Nerad kdyz nevis co poradit. Tohle by melo fugovat:
new pSpawn[MAX_PLAYERS char];
public OnPlayerSpawn(playerid)
{
if(pSpawn{playerid} == 0)
{
new path[40];
GetPlayerName(playerid, path, MAX_PLAYER_NAME);
format(path, sizeof path, "%s.ini", path);
INI_ParseFile(path, "LoadPlayerSpawn", .bExtra = true, .extra = playerid);
pSpawn{playerid} = 1;
}
return 1;
}
forward LoadPlayerSpawn(playerid, name[], value[]);
public LoadPlayerSpawn(playerid, name[], value[])
{
new Float:pos_x, Float:pos_y, Float:pos_z;
INI_Float("posX", pos_x);
INI_Float("posY", pos_y);
INI_Float("posZ", pos_z);
SetPlayerPos(playerid, pos_x, pos_y, pos_z);
return 0;
}
public OnPlayerDisconnect(playerid)
{
new path[40], Float:pos_x, Float:pos_y, Float:pos_z;
GetPlayerPos(playerid, pos_x, pos_y, pos_z);
GetPlayerName(playerid, path, MAX_PLAYER_NAME);
format(path, sizeof path, "%s.ini", path);
new INI:file = INI_Open(path);
INI_WriteFloat(file, "posX", pos_x);
INI_WriteFloat(file, "posY", pos_y);
INI_WriteFloat(file, "posZ", pos_z);
INI_Close(file);
pSpawn{playerid} = 0;
}