Cant Save Player Cordinates
#1

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerPos(playerid, Float:PlayerInfo[playerid][pX], Float:PlayerInfo[playerid][pY], Float:PlayerInfo[playerid][pZ]);
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "X",PlayerInfo[playerid][pX]);
        dini_IntSet(file, "Y",PlayerInfo[playerid][pY]);
        dini_IntSet(file, "Z",PlayerInfo[playerid][pZ]);
        
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}
X, Y, and Z are saved but too high value
example

X=1152845889
Y=-992376736
Z=1096335360
Reply
#2

Coordinates are floating point values. Use dini_FloatSet. (Why do people keep using dini anyway? Bah).
Reply
#3

i tried dini_FloatSet but failed too

what is better to use instead of dini ?
Reply
#4

i fixed it

changed from

Код:
enum pInfo
{
    pX,
    pY,
    pZ,
}
to

Код:
enum pInfo
{
    Float:pX,
    Float:pY,
    Float:pZ,
}
Reply
#5

Quote:
Originally Posted by omario
Посмотреть сообщение
i fixed it

changed from

Код:
enum pInfo
{
    pX,
    pY,
    pZ,
}
to

Код:
enum pInfo
{
    Float:pX,
    Float:pY,
    Float:pZ,
}
and aslo change this:

Код:
GetPlayerPos(playerid, Float:PlayerInfo[playerid][pX], Float:PlayerInfo[playerid][pY], Float:PlayerInfo[playerid][pZ]);
to this:
Код:
GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)