21.06.2012, 14:50
Hi guys,
I have made a filterscript called SavePos and everything works fine excepted of that the player spawns the first time random at the world. I don't know how I can make that the player spawns at this coordinates: 2229.0200,-1159.7896,25.7981,90.0000 at the first time. Please help me.
This is my script:
I have made a filterscript called SavePos and everything works fine excepted of that the player spawns the first time random at the world. I don't know how I can make that the player spawns at this coordinates: 2229.0200,-1159.7896,25.7981,90.0000 at the first time. Please help me.
This is my script:
PHP код:
#include <a_samp>
#include <dini>
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" SavePos Filterscript");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
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;
}