Little Help Please? -
Janek17 - 05.02.2011
Hi, how to do such a thing as that, when a player logs on the server, and when he logs on the server, it will spawn back there where he wrote the
Re: Little Help Please? -
Janek17 - 05.02.2011
Can somebody to help me?
Re: Little Help Please? -
xRyder - 05.02.2011
A little more informations ?
Quote:
Originally Posted by Janek17
it will spawn back there where he wrote the
|
Unfinished sentence?
Re: Little Help Please? -
Janek17 - 05.02.2011
When the player log out in unyti and the spawn is in the airport, then when he log on he spawn there where he log off in unyti not in airport!
Sorry me bad english
Re: Little Help Please? -
Mean - 05.02.2011
Save it to file:
FOR DINI:
pawn Код:
CMD:savemypos(playerid, params[]) {
new file[256];
new name[24];
GetPlayerName(playerid, name, 24);
format(file, 256, "%s.txt");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
dini_IntSet(file, "LastXPos", x);
dini_IntSet(file, "LastYPos", y);
dini_IntSet(file, "LastZPos", z);
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid) {
new file[256];
new name[24];
GetPlayerName(playerid, name, 24);
format(file, 256, "%s.txt", name);
SetPlayerPos(playerid, dini_Int(file, "LastXPos"), dini_Int(file, "LastYPos"), dini_Int(file, "LastZPos));
return 1;
}
Untested, wrote it quickly!
In order to get better speeds, use Y_Ini or anything else than Dini!
Re: Little Help Please? -
xRyder - 05.02.2011
You can write his coordinates to file using something like dini or what ever you like.
Than when he logs back you just put him back to his last position.
EDIT: Damn, Mean is quick!!

EDIT2: @Mean - You should save X, Y and Z as a float. And read it as a float.
Right code would look something like this: (just edited it quickly, and haven't tested it since I don't have SA installed)
pawn Код:
CMD:savemypos(playerid, params[])
{
new file[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.txt", name);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
dini_FloatSet(file, "LastXPos", x);
dini_FloatSet(file, "LastYPos", y);
dini_FloatSet(file, "LastZPos", z);
return 1;
}
public OnPlayerSpawn(playerid)
{
new file[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "%s.txt", name);
SetPlayerPos(playerid, dini_Float(file, "LastXPos"), dini_Float(file, "LastYPos"), dini_Float(file, "LastZPos"));
return 1;
}
Re: Little Help Please? -
Janek17 - 05.02.2011
Tnaks Mean and xRyder for help me!!
Re: Little Help Please? -
Janek17 - 05.02.2011
pawn Код:
C:\Users\Janek\Desktop\Avolotion RolePlay\gamemodes\Avolotion.pwn(4207) : error 017: undefined symbol "dini_Float"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
I got that error now?
Re: Little Help Please? -
xRyder - 05.02.2011
Which line?
Weird, I compile this with no errors.
Re: Little Help Please? -
Janek17 - 05.02.2011
pawn Код:
SetPlayerPos(playerid, dini_Float(file, "LastXPos"), dini_Float(file, "LastYPos"), dini_Float(file, "LastZPos"));