[ Help ] saving Pos Bug
#1

Guys i am here again to ask help
i am having trouble in loading the player last pos
i keep on spawning in blueberry
please can you help me fiX it?


pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(INI_Open(getINI(playerid))) {

    INI_WriteInt("Admin",pFiles[playerid][pAdmin]);
    INI_WriteInt("Cash",GetPlayerMoney(playerid));
    GetPlayerPos(playerid,pFiles[playerid][posX],pFiles[playerid][posY],pFiles[playerid][posZ]);
    INI_WriteFloat("LastX", pFiles[playerid][posX]);
    INI_WriteFloat("LastY", pFiles[playerid][posY]);
    INI_WriteFloat("LastZ", pFiles[playerid][posZ]);
    INI_Save();
    INI_Close();
    }
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(pFiles[playerid][posX] == 0)
    {
        SetPlayerPos(playerid,1958.3783, 1343.1572, 15.3746);
    }
    else
    {
        SetPlayerPos(playerid,pFiles[playerid][posX],pFiles[playerid][posY],pFiles[playerid][posZ]);
    }
    return 1;
}
pawn Код:
enum pInfo
{
    pPass,
    pAdmin,
    pCash,
    Float:posX,
    Float:posY,
    Float:posZ
}
Reply
#2

Why are you using an "if" statement on your first code part?

pawn Код:
INI_Save();
INI_Close();
// You need to tell what File to save and what file to close.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(INI_Open(getINI(playerid)))
    {

    INI_WriteInt("Admin",pFiles[playerid][pAdmin]);
    INI_WriteInt("Cash",GetPlayerMoney(playerid));
    GetPlayerPos(playerid,pFiles[playerid][posX],pFiles[playerid][posY],pFiles[playerid][posZ]);
    INI_WriteFloat("LastX", pFiles[playerid][posX]);
    INI_WriteFloat("LastY", pFiles[playerid][posY]);
    INI_WriteFloat("LastZ", pFiles[playerid][posZ]);
    INI_Save();
    INI_Close();
    }
    return 1;
}
That if statement I think is what's messing you up.
Reply
#3

huh can you fix it please
Reply
#4

anyone?
Reply
#5

please
Reply
#6

guys please anyone
Reply
#7

I cannot figure out what your problem is by the only thing you posted. There could be several things wrong.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)