Variable restart when i GMX?
#1

Hi all...

Why this variable restart?
That's a name of a character system, here's the code.

pawn Код:
//When it saves
strcpy(PlayerInfo[playerid][pNomePersonaggio1], inputtext, 64);
            OnPlayerSave(playerid);
//OnPlayerConnect
PlayerInfo[playerid][pNomePersonaggio1] = PlayerInfo[playerid][pNomePersonaggio1];
    PlayerInfo[playerid][pNomePersonaggio2] = PlayerInfo[playerid][pNomePersonaggio2];
    PlayerInfo[playerid][pNomePersonaggio3] = PlayerInfo[playerid][pNomePersonaggio3];
//OnPlayerRegister
format(var, 32, "NomePersonaggio1=%s\n",PlayerInfo[playerid][pNomePersonaggio1]);fwrite(hFile, var);
//OnPlayerSave
    format(var, 32, "NomePersonaggio1=%s\n",PlayerInfo[playerid][pNomePersonaggio1]);fwrite(hFile, var);
If I slog and Relog, it works, but if I restart or stop the server, that restarts.
Reply
#2

Help please
Reply
#3

OnGamemodeExit?
Reply
#4

I have a OnGameModeInitExitFunc, for when I use /gmx, but I don't think that will work with /rcon gmx or gmx by console right?

However, here's the OnGameModeInitExitFunc.

pawn Код:
public GameModeInitExitFunc()
{

    gmx = 1;
    new string[128];
    format(string, sizeof(string), "(ONE-RP): Il server и in fase di spegnimento...");
    //foreach(Player, i)
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            OnPlayerSave(i);
            DisablePlayerCheckpoint(i);
            SendClientMessage(i, COLOR_ORANGE, string);
            //GameTextForPlayer(i, string, 4000, 5);
            SetPlayerInterior(i, 0);
            SetPlayerVirtualWorld(i, 0);
            InterpolateCameraPos(i, -1581.887695, 327.298400, 21.836509, -1634.896606, 409.670410, 59.854118, 15000);
        InterpolateCameraLookAt(i, -1584.259277, 331.332061, 23.598611, -1637.349853, 413.546051, 61.844299, 15000);
        SetPlayerVirtualWorld(i, 1);
        SetPlayerPos(i, -1581.887695, 327.298400, 21.836509);
        SetTimerEx("VisualeLogin2", 15000, false, "i", i);
            gPlayerLogged[i] = 0;
            new Float: UltimaX, Float: UltimaY, Float: UltimaZ;
GetPlayerPos(i, UltimaX,UltimaY, UltimaZ);
PlayerInfo[i][pUltimaX] = UltimaX;
    PlayerInfo[i][pUltimaY] = UltimaY;
    PlayerInfo[i][pUltimaZ] = UltimaZ;
    PlayerInfo[i][pUltimaX] = Float: UltimaX;
    PlayerInfo[i][pUltimaY] = Float: UltimaY;
    PlayerInfo[i][pUltimaZ] = Float: UltimaZ;
    printf("//Coordinate salvata %f %f %f", PlayerInfo[i][pUltimaX],PlayerInfo[i][pUltimaY],PlayerInfo[i][pUltimaZ]);
    OnPlayerSave(i);
        }
    }
    SavePoints();
    SaveFamilies();
    SaveFamVehicles();
    SaveHouses();
    SaveFacGates();
    SaveFamGates();
    SaveBusinesses();
    SaveMapIcons();
    SaveATMs();
    SaveMAPBs();
    SaveGSTATIONs();
    SaveHSSigns();
    SaveOOCshops();
    SaveInfoBoards();
    Savemotels();
    SaveTaxi();
    Savebuildings();
    SaveEntrances();
    SaveDriveThrus();
    SaveFactionPay();
    SaveFactions();
    SaveFactionSkins();
    SaveGarages();
    SaveObjects();
    SaveHQs();
    SaveGates();
    //SaveTurfs();
    SetTimer("GameModeExitFunc", 4000, 0);
    return 1;
}

public GameModeExitFunc()
{
        TextDrawHideForAll(TD);
    TextDrawDestroy(TD);
    for(new i; i<TotalMenus; i++)
    {
        DestroyMenu(CCTVMenu[i]);
    }
    KillTimer(synctimer);
    KillTimer(savechartimer);
    KillTimer(unjailtimer);
    KillTimer(othtimer);
    KillTimer(cartimer);
    KillTimer(checkgastimer);
    KillTimer(pickuptimer);
    KillTimer(productiontimer);
    KillTimer(autokicktimer);
    KillTimer(stoppedvehtimer);
    KillTimer(Prison_Buttons[GateTimerID]);
    KillTimer(Prison_Buttons[CellTimerID]);
    KillTimer(claimedtimer);
    KillTimer(pointtimer);
    //KillTimer(botanimtimer);
    DestroyDynamicPickup(iArrest5);
    DestroyDynamicPickup(iArrest6);
    DestroyDynamicPickup(iBROTHER);
    DestroyDynamicPickup(iCafeteria);
    DestroyDynamicPickup(iCityhall);
    //DestroyDynamicPickup(iDonuts);
    //DestroyDynamicPickup(iDonuts2);
    DestroyDynamicPickup(iFBI);
    DestroyDynamicPickup(iFD);
    DestroyDynamicPickup(iInfirmary);
    DestroyDynamicPickup(iLSED);
    DestroyDynamicPickup(iLockerRoom);
    DestroyDynamicPickup(iPDGarage);
    DestroyDynamicPickup(iPDRoof);
    DestroyDynamicPickup(iPrison);
    DestroyDynamicPickup(iSASD);
    DestroyDynamicPickup(irb);
    TextDrawHideForAll(TD);
    TextDrawDestroy(TD);
    DestroyDynamicObject(entrancegate);
    DestroyDynamicObject(exitgate);
    DestroyDynamicObject(3);
    DestroyDynamicPickup(1);
    Delete3DTextLabel(entrancetext);
    for (new g = 1; g < MAX_GARAGES; g += 1) DestroyDynamic3DTextLabel(GarageInfo[g][GarageLabel]);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerVehicleID(i) == GetPlayerVehicleID(usingcarwash))
        {
            DestroyPlayerObject(i, water1);
            DestroyPlayerObject(i, water2);
            DestroyPlayerObject(i, water3);
            DestroyPlayerObject(i, water4);
            DestroyPlayerObject(i, water5);
            DestroyPlayerObject(i, water6);
            DestroyPlayerObject(i, water7);
            TogglePlayerControllable(i, 1);
            SetCameraBehindPlayer(i);
        }
    }
        for(new i; i < MAX_FLAMES; i++)
    {
        KillFire(i);
    }
    for(new playerid; playerid < MAX_PLAYERS; playerid++)
    {
        if(PlayerOnFire[playerid] && !CanPlayerBurn(playerid, 1))
        {
            StopPlayerBurning(playerid);
        }
    }
    for(new i; i<TotalMenus; i++)
    {
        DestroyMenu(CCTVMenu[i]);
    }
    GameModeExit();
}
Reply
#5

save the variables (pNomePersonaggio3) in gamemodeExitFunc
Reply
#6

Are you using fclose after fwrite?
Reply
#7

Yes.
Reply
#8

So? Help me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)