y_ini - positions dont load
#1

Code:
hook OnPlayerConnect(playerid)
{
    new 
        pName[MAX_PLAYER_NAME],
        PlayerPathFile[50];

    GetPlayerName(playerid, pName, sizeof(pName));
    format(PlayerPathFile, sizeof(PlayerPathFile), "/PlayerData/%s.ini", pName);

    if(!dini_Exists(PlayerPathFile))
    {
        dini_Create(PlayerPathFile);
    }
    else
    {
        PlayerInfo[playerid][pPosX] = dini_Float(PlayerPathFile, "PositionX");
        PlayerInfo[playerid][pPosY] = dini_Float(PlayerPathFile, "PositionY");
        PlayerInfo[playerid][pPosZ] = dini_Float(PlayerPathFile, "PositionZ");
        PlayerInfo[playerid][pRot] = dini_Float(PlayerPathFile, "Rotation");
        PlayerInfo[playerid][pAdmin] = dini_Int(PlayerPathFile,"AdminLevel");
        SendClientMessage(playerid, COLOR_YELLOW, "Your player files have been loaded in. Enjoy your stay.");
    }

    SetSpawnInfo(playerid, 0, 0, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pRot], 0, 0, 0, 0, 0, 0);

    return 1;
}

hook OnPlayerDisconnect(playerid, reason)
{
    new 
        pName[MAX_PLAYER_NAME],
        PlayerPathFile[50];

    GetPlayerName(playerid, pName, sizeof(pName));
    format(PlayerPathFile, sizeof(PlayerPathFile), "/PlayerData/%s.ini", pName);

    dini_FloatSet(PlayerPathFile, "PositionX", PlayerInfo[playerid][pPosX]);
    dini_FloatSet(PlayerPathFile, "PositionY", PlayerInfo[playerid][pPosY]);
    dini_FloatSet(PlayerPathFile, "PositionZ", PlayerInfo[playerid][pPosZ]);
    dini_FloatSet(PlayerPathFile, "Rotation", PlayerInfo[playerid][pRot]);
    dini_IntSet(PlayerPathFile, "AdminLevel", PlayerInfo[playerid][pAdmin]);

    return 1;
}
For some reason the code don't save my position but it does save my admin level. Why?

ps: and yes you will probs ask why u dont use mysql and i will once i get the hang of pawn
Reply


Messages In This Thread
y_ini - positions dont load - by Mo123 - 03.11.2018, 15:25
Re: y_ini - positions dont load - by TheToretto - 03.11.2018, 16:11
Re: y_ini - positions dont load - by Mobtiesgangsa - 03.11.2018, 16:42
Re: y_ini - positions dont load - by Mo123 - 03.11.2018, 19:19
Re: y_ini - positions dont load - by GODEX - 03.11.2018, 19:38
Re: y_ini - positions dont load - by khRamin78 - 03.11.2018, 19:38
Re: y_ini - positions dont load - by Mo123 - 03.11.2018, 19:53
Re: y_ini - positions dont load - by TheToretto - 03.11.2018, 20:14
Re: y_ini - positions dont load - by Mo123 - 03.11.2018, 21:36
Re: y_ini - positions dont load - by Mobtiesgangsa - 03.11.2018, 23:10
Re: y_ini - positions dont load - by GODEX - 04.11.2018, 00:10
Re: y_ini - positions dont load - by Mobtiesgangsa - 04.11.2018, 01:46
Re: y_ini - positions dont load - by GODEX - 04.11.2018, 01:50
Re: y_ini - positions dont load - by Mobtiesgangsa - 04.11.2018, 01:57
Re: y_ini - positions dont load - by GODEX - 04.11.2018, 02:13
Re: y_ini - positions dont load - by TheToretto - 04.11.2018, 03:54

Forum Jump:


Users browsing this thread: 1 Guest(s)