Little Help Please?
#1

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
Reply
#2

Can somebody to help me?
Reply
#3

A little more informations ?

Quote:
Originally Posted by Janek17
Посмотреть сообщение
it will spawn back there where he wrote the
Unfinished sentence?
Reply
#4

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
Reply
#5

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!
Reply
#6

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;
}
Reply
#7

Tnaks Mean and xRyder for help me!!
Reply
#8

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?
Reply
#9

Which line?
Weird, I compile this with no errors.
Reply
#10

pawn Код:
SetPlayerPos(playerid, dini_Float(file, "LastXPos"), dini_Float(file, "LastYPos"), dini_Float(file, "LastZPos"));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)