Accounts not saving/loading on random occasions
#1

Well... for some stupid reason, Accounts save when they feel like it.... Sometimes they will randomly save, sometimes not... not sure what is going on....

Код:
  
switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"San Andreas Border Partrol",""COL_RED"Incorrect Password, please try again.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                if(20 < strlen(inputtext) || strlen(inputtext) < 4 ) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"San Andreas Border Partrol",""COL_RED"Please choose a password between 4 and 20 characters.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
				new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"Player Data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"CitySpawn",0);
                INI_WriteInt(File,"SpawnInHouse",0);
                INI_WriteInt(File,"Seconds",0);
                INI_WriteInt(File,"Minutes",0);
                INI_WriteInt(File,"Hours",0);
                INI_WriteInt(File,"Money",10000);
                INI_WriteInt(File,"BankCash",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Grams",0);
                INI_WriteInt(File,"Seeds",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Warnings",0);
                INI_WriteInt(File,"Skin",0);
                INI_WriteInt(File,"Team",0);
                INI_WriteInt(File,"TruckMCompleted",0);
                INI_WriteInt(File,"Wanted_Level",0);
                INI_WriteInt(File,"WeaponSlot1",0);
    			INI_WriteInt(File,"WeaponSlot1_Ammo",0);
			 	INI_WriteInt(File,"WeaponSlot2",0);
    			INI_WriteInt(File,"WeaponSlot2_Ammo",0);
    			INI_WriteInt(File,"WeaponSlot3",0);
    			INI_WriteInt(File,"WeaponSlot3_Ammo",0);
    			INI_WriteInt(File,"WeaponSlot4",28);
    			INI_WriteInt(File,"WeaponSlot4_Ammo",1000);
    			INI_WriteInt(File,"WeaponSlot5",0);
    			INI_WriteInt(File,"WeaponSlot5_Ammo",0);
    			INI_WriteInt(File,"WeaponSlot6",0);
    			INI_WriteInt(File,"WeaponSlot6_Ammo",0);
                INI_Close(File);
                Info[playerid][Logged] = true;
                TogglePlayerSpectating(playerid,0);
                SendClientMessage(playerid, COLOR_GREEN, "You have successfully registered. You can now choose your team.");
                SetTimerEx("GameTimeStats",1000,1,"i",playerid);
            }
        }
Reply
#2

Can anyone assist me....
Reply
#3

Tags cannot contain spaces.
Change "Player Data" to "Player_Data"
Reply
#4

Quote:
Originally Posted by biker122
Посмотреть сообщение
Tags cannot contain spaces.
Change "Player Data" to "Player_Data"
ty.... but now it wont load at all >.>
Reply
#5

Quote:
Originally Posted by biker122
Посмотреть сообщение
Tags cannot contain spaces.
Change "Player Data" to "Player_Data"
I work with ini file, and my tags have space, I assure him that what he said makes no sense.

Try this and check if you create the file, it could also be "userpath" the code you eh given should work.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if(strlen(inputtext) < 4 || strlen(inputtext) > 20)
                {
                    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"San Andreas Border Partrol",""COL_RED"Please choose a password between 4 and 20 characters.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                }
                else if(strlen(inputtext) >= 4 && strlen(inputtext) < 21)
                {
                    new INI:File = INI_Open(UserPath(playerid));
                    INI_SetTag(File,"Player Data");
                    INI_WriteInt(File,"Password",udb_hash(inputtext));
                    INI_WriteInt(File,"Admin",0);
                    INI_WriteInt(File,"CitySpawn",0);
                    INI_WriteInt(File,"SpawnInHouse",0);
                    INI_WriteInt(File,"Seconds",0);
                    INI_WriteInt(File,"Minutes",0);
                    INI_WriteInt(File,"Hours",0);
                    INI_WriteInt(File,"Money",10000);
                    INI_WriteInt(File,"BankCash",0);
                    INI_WriteInt(File,"Score",0);
                    INI_WriteInt(File,"Grams",0);
                    INI_WriteInt(File,"Seeds",0);
                    INI_WriteInt(File,"Kills",0);
                    INI_WriteInt(File,"Deaths",0);
                    INI_WriteInt(File,"Warnings",0);
                    INI_WriteInt(File,"Skin",0);
                    INI_WriteInt(File,"Team",0);
                    INI_WriteInt(File,"TruckMCompleted",0);
                    INI_WriteInt(File,"Wanted_Level",0);
                    INI_WriteInt(File,"WeaponSlot1",0);
                    INI_WriteInt(File,"WeaponSlot1_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot2",0);
                    INI_WriteInt(File,"WeaponSlot2_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot3",0);
                    INI_WriteInt(File,"WeaponSlot3_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot4",28);
                    INI_WriteInt(File,"WeaponSlot4_Ammo",1000);
                    INI_WriteInt(File,"WeaponSlot5",0);
                    INI_WriteInt(File,"WeaponSlot5_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot6",0);
                    INI_WriteInt(File,"WeaponSlot6_Ammo",0);
                    INI_Close(File);

                    Info[playerid][Logged] = true;
                    TogglePlayerSpectating(playerid,0);
                    SendClientMessage(playerid, COLOR_GREEN, "You have successfully registered. You can now choose your team.");
                    SetTimerEx("GameTimeStats", 1000, 1, "i", playerid);
                }
            }
        }
    }
    return true;
}
Reply
#6

It does make sense.
1. You use spaces while writing the field / tag names.
2. You don't save the players' stats in OnPlayerDisconnect (if you actually have a saving code there, check for spaces in your fields (INI_SetTag, INI_WriteInt, INI_WriteString, INI_WriteFloat)
Reply
#7

Quote:
Originally Posted by JuanStone
Посмотреть сообщение
I work with ini file, and my tags have space, I assure him that what he said makes no sense.

Try this and check if you create the file, it could also be "userpath" the code you eh given should work.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if(strlen(inputtext) < 4 || strlen(inputtext) > 20)
                {
                    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"San Andreas Border Partrol",""COL_RED"Please choose a password between 4 and 20 characters.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                }
                else if(strlen(inputtext) >= 4 && strlen(inputtext) < 21)
                {
                    new INI:File = INI_Open(UserPath(playerid));
                    INI_SetTag(File,"Player Data");
                    INI_WriteInt(File,"Password",udb_hash(inputtext));
                    INI_WriteInt(File,"Admin",0);
                    INI_WriteInt(File,"CitySpawn",0);
                    INI_WriteInt(File,"SpawnInHouse",0);
                    INI_WriteInt(File,"Seconds",0);
                    INI_WriteInt(File,"Minutes",0);
                    INI_WriteInt(File,"Hours",0);
                    INI_WriteInt(File,"Money",10000);
                    INI_WriteInt(File,"BankCash",0);
                    INI_WriteInt(File,"Score",0);
                    INI_WriteInt(File,"Grams",0);
                    INI_WriteInt(File,"Seeds",0);
                    INI_WriteInt(File,"Kills",0);
                    INI_WriteInt(File,"Deaths",0);
                    INI_WriteInt(File,"Warnings",0);
                    INI_WriteInt(File,"Skin",0);
                    INI_WriteInt(File,"Team",0);
                    INI_WriteInt(File,"TruckMCompleted",0);
                    INI_WriteInt(File,"Wanted_Level",0);
                    INI_WriteInt(File,"WeaponSlot1",0);
                    INI_WriteInt(File,"WeaponSlot1_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot2",0);
                    INI_WriteInt(File,"WeaponSlot2_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot3",0);
                    INI_WriteInt(File,"WeaponSlot3_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot4",28);
                    INI_WriteInt(File,"WeaponSlot4_Ammo",1000);
                    INI_WriteInt(File,"WeaponSlot5",0);
                    INI_WriteInt(File,"WeaponSlot5_Ammo",0);
                    INI_WriteInt(File,"WeaponSlot6",0);
                    INI_WriteInt(File,"WeaponSlot6_Ammo",0);
                    INI_Close(File);

                    Info[playerid][Logged] = true;
                    TogglePlayerSpectating(playerid,0);
                    SendClientMessage(playerid, COLOR_GREEN, "You have successfully registered. You can now choose your team.");
                    SetTimerEx("GameTimeStats", 1000, 1, "i", playerid);
                }
            }
        }
    }
    return true;
}
Well the way you offered, does in fact, create files and loads them, but does NOT save player data for some reason.....

Quote:
Originally Posted by biker122
Посмотреть сообщение
It does make sense.
1. You use spaces while writing the field / tag names.
2. You don't save the players' stats in OnPlayerDisconnect (if you actually have a saving code there, check for spaces in your fields (INI_SetTag, INI_WriteInt, INI_WriteString, INI_WriteFloat)
As the way you offered does create files, saves player data, but does not load and will not allow a player to login...

:/
Reply
#8

Create a Folder for UserPath
Reply
#9

Quote:
Originally Posted by Arxalan
Посмотреть сообщение
Create a Folder for UserPath
?

Elaborate please.
Reply
#10

Ok so weirdly, I think the issue is NOW, The accounts are being created twice in the same file at the same time.



Example:

Код:
[Player Data]
Password = 261948280
Admin = 0
CitySpawn = 0
SpawnInHouse = 0
Seconds = 0
Minutes = 0
Hours = 0
Money = 10000
BankCash = 0
Score = 0
Grams = 0
Seeds = 0
Kills = 0
Deaths = 0
Warnings = 0
Skin = 0
Team = 0
TruckMCompleted = 0
Wanted_Level = 0
WeaponSlot1 = 0
WeaponSlot1_Ammo = 0
WeaponSlot2 = 0
WeaponSlot2_Ammo = 0
WeaponSlot3 = 0
WeaponSlot3_Ammo = 0
WeaponSlot4 = 28
WeaponSlot4_Ammo = 1000
WeaponSlot5 = 0
WeaponSlot5_Ammo = 0
WeaponSlot6 = 0
WeaponSlot6_Ammo = 0
[Player_Data]
Admin = 5
VIP = 0
CitySpawn = 0
SpawnInHouse = 0
Seconds = 20
Minutes = 1
Hours = 0
Money = 15000
BankCash = 0
Score = 0
Seeds = 5
Grams = 0
Kills = 0
Deaths = 0
Skin = 114
Team = 0
IP = ********************
TruckMCompleted = 0
LastVehicle = 0
Wanted_Level = 0
WeaponSlot1 = 0
WeaponSlot1_Ammo = 0
WeaponSlot2 = 0
WeaponSlot2_Ammo = 0
WeaponSlot3 = 0
WeaponSlot3_Ammo = 0
WeaponSlot4 = 0
WeaponSlot4_Ammo = 0
WeaponSlot5 = 0
WeaponSlot5_Ammo = 0
WeaponSlot6 = 0
WeaponSlot6_Ammo = 0
Note: Based on the two same accounts being saved, not all info is saved the same on each.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)