SA-MP Forums Archive
Spawning at Blueberry - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spawning at Blueberry (/showthread.php?tid=461111)



Spawning at Blueberry - Toucan - 31.08.2013

I have searched and found some threads about others having the same problem but I haven't really found a real solution for it that works for me.

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <dini>

public OnPlayerDisconnect(playerid, reason)
{
new file[128], pname[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\SavePos\\%s.ini", pname);
if(!dini_Exists(file))
dini_Create(file);
GetPlayerPos(playerid, x, y, z);
dini_FloatSet(file, "posX", x);
dini_FloatSet(file, "posY", y);
dini_FloatSet(file, "posZ", z);
return 1;
}

public OnPlayerSpawn(playerid)
{
new file[128], pname[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\SavePos\\%s.ini", pname);
x = dini_Float(file, "posX");
y = dini_Float(file, "posY");
z = dini_Float(file, "posZ");
SetPlayerPos(playerid, x, y, z);
return 1;
}
Here is my filterscript for saving the position of a player once they log out. With this script it causes me to spawn at blueberry when I log in, and I have tried adding a new class to my game mode but that did not fix the problem. I have tried a few other things but nothing has worked yet.

This is one of the first scripts that has worked for me with saving a players position after logging out so I would hate to have to try to find another one that works, but if its the script that is the problem then I will.