Player Data Failing to Save After Updating Includes
#1

I was updating my pawno\include folder and deleted all the includes (there was a ton of includes I didn't believe were required) and started fresh with the updated includes.

(!)My gamemode finally complied and all seemed well. However, player data is now failing to save and I've tried fixing it myself but I can't find the problem. I'm assuming I am missing an essential include which I cannot recover :/


My includes: http://i.imgur.com/jJuxu7n.png

My plugins: http://i.imgur.com/68SOYU2.png

PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>
#include "../include/gl_common.inc" 
PHP код:
enum PlayerInfo
{
    
Pass[129],
    
Adminlevel,
    
Premlevel,
    
CharSkin,
    
CharMoney,
    
CharScore,
    
CharKills,
    
CharDeaths,
    
IsJailed,

PHP код:
forward loadaccount_user(playeridname[], value[]);
public 
loadaccount_user(playeridname[], value[])
{
    
printf("%s -> %s"namevalue);
    
INI_String("Password"pInfo[playerid][Pass], 129);
    
INI_Int("Adminlevel" ,pInfo[playerid][Adminlevel]);
    
INI_Int("Premlevel"pInfo[playerid][Premlevel]);
    
INI_Int("CharSkin"pInfo[playerid][CharSkin]);
    
INI_Int("CharMoney"pInfo[playerid][CharMoney]);
    
INI_Int("CharScore"pInfo[playerid][CharScore]);
    
INI_Int("CharKills"pInfo[playerid][CharKills]);
    
INI_Int("CharDeaths"pInfo[playerid][CharDeaths]);
    
INI_Int("IsJailed"pInfo[playerid][IsJailed]);
    return 
1;

PHP код:
public OnPlayerConnect(playerid)
{
        
format(string2sizeof(string2), "{A9C4E4}# [Server] %s {EAEAEA}has connected to the server."GetName(playerid));
        
SendClientMessageToAll(COLOR_SERVER ,string2);
        
SetTimerEx("ClearScreen"1false"i"playerid);
        
        new 
string1[300]; new registerid; new loginid; new name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        if(
fexist(Path(playerid)))
        {
        
INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra true, .extra playerid);
        
format(string1sizeof(string1), "{EAEAEA}Enter your password below to login!"GetName(loginid), loginid);
        
ShowPlayerDialog(playeridLOGIN_DIALOGDIALOG_STYLE_PASSWORD"{A9C4E4}Server {EAEAEA}- Login:"string1"Login""Quit");
        }
        else
        {
        
format(stringsizeof(string), "{EAEAEA}Enter a password below to register!"GetName(registerid), registerid);
        
ShowPlayerDialog(playeridREGISTER_DIALOGDIALOG_STYLE_PASSWORD"{A9C4E4}Server {EAEAEA}- Register:"string"Register""Quit");
        return 
1;
        } 
PHP код:
stock save(playerid)
{
    new 
INI:file INI_Open(Path(playerid));
    
INI_SetTag(file"Character");
    
INI_WriteInt(file"Adminlevel"pInfo[playerid][Adminlevel]);
    
INI_WriteInt(file"Premlevel"pInfo[playerid][Premlevel]);
    
INI_WriteInt(file"CharSkin"pInfo[playerid][CharSkin]);
    
INI_WriteInt(file"CharMoney"GetPlayerMoney(playerid));
    
INI_WriteInt(file"CharScore"GetPlayerScore(playerid));
    
INI_WriteInt(file"CharKills"pInfo[playerid][CharKills]);
    
INI_WriteInt(file"CharDeaths"pInfo[playerid][CharDeaths]);
    
INI_WriteInt(file"IsJailed"pInfo[playerid][IsJailed]);
    
INI_Close(file);
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == REGISTER_DIALOG)
    {
        if(!
response)return Kick(playerid);
        if(
response)
        {
            if(!
strlen(inputtext))
            {
            new 
string[300];
            new 
registerid;
            
format(stringsizeof(string), "{EAEAEA}Hello, {A9C4E4}%s{EAEAEA}.\n\nPlease enter a password below."GetName(registerid));
            
ShowPlayerDialog(playeridREGISTER_DIALOGDIALOG_STYLE_PASSWORD"{A9C4E4}Server {EAEAEA}- Register:"string"Register""Quit");
            return 
1;
            }
            new 
hashpass[129];
            
WP_Hash(hashpasssizeof(hashpass), inputtext);
            new 
INI:file INI_Open(Path(playerid));
            
INI_SetTag(file"Character");
            
INI_WriteString(file"Password"hashpass);
            
INI_WriteInt(file"Adminlevel"0);
            
INI_WriteInt(file"Premlevel"0);
            
INI_WriteInt(file"CharSkin"60);
            
INI_WriteInt(file"CharMoney"15000);
            
INI_WriteInt(file"CharScore"1);
            
INI_WriteInt(file"CharKills"1);
            
INI_WriteInt(file"CharDeaths"1);
            
INI_WriteInt(file"IsJailed"0);
            
INI_Close(file);
            new 
rstring[200];
            new 
registerid;
            
format(rstringsizeof(rstring), "{A9C4E4}Server {EAEAEA}- You have successfully registered, {A9C4E4}%s{EAEAEA}!"GetName(registerid));
            
SendClientMessage(playeridCOLOR_SERVER"Reminder: {EAEAEA}The server is currently underdevelopment - You might experience bugs");
            
SendClientMessage(playeridCOLOR_GREENrstring);
            
muted[playerid] = 0;
            return 
1;
        }
    }
    if(
dialogid == LOGIN_DIALOG)
    {
        if(!
response)return Kick(playerid);
        if(
response)
        {
            new 
hashpass[129];
            
WP_Hash(hashpasssizeof(hashpass), inputtext);
            if(!
strcmp(hashpasspInfo[playerid][Pass]))
            {
                new 
loginid playerid;
                new 
lstring[300];
                
INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra true, .extra playerid);
                
SetPlayerScore(playeridpInfo[playerid][CharScore]);
                
GivePlayerMoney(playeridpInfo[playerid][CharMoney]);
                
format(lstringsizeof(lstring), "{EAEAEA}Welcome Back, {A9C4E4}%s{EAEAEA}. {EAEAEA}You have successfully logged in!"GetName(loginid));
                
SendClientMessage(playeridCOLOR_SERVER"Reminder: {EAEAEA}The server is currently underdevelopment - You might experience bugs");
                
SendClientMessage(playeridCOLOR_GREENlstring);
                
muted[playerid] = 0;
            }
            else
            {
                   new 
string1[300];
                
format(string1sizeof(string1), "{EAEAEA}Enter your password below to login!"GetName(playerid), playerid);
                
ShowPlayerDialog(playeridLOGIN_DIALOGDIALOG_STYLE_PASSWORD"{A9C4E4}Server - {EAEAEA}Login:"string1"Login""Quit");
                
SendClientMessage(playeridCOLOR_RED"{ff6347}Error: Wrong Password!");
            }
        }
        return 
1// We handled a dialog, so return 1. Just like OnPlayerCommandText.
    
}
    return 
0// You MUST return 0 here! Just like OnPlayerCommandText.

Also; the .ini file(s) update after changes ingame (admin, kills etc) but gmx and reconnecting they all will reset.

Any suggestions/solutions?
Reply
#2

Update; the .ini file(s) update after changes ingame (admin, kills etc) but gmx or closing/restarting samp-server.exe and they all reset back to 0.
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=574754
Reply
#4

Quote:
Originally Posted by Yashas
Посмотреть сообщение
I appreciate the response but I'm not quite sure how this helps in my case. My "INI" were working perfectly fine prior to updating my includes and all the player's data was being saved. I had too much information thrown at me when reading your thread and none of it seemed to be related to my issue.

I even recovered my old includes and pasted them into pawno/include (didn't overwrite any of the updated) and still it's failing.
Reply
#5

The includes "core" and "float" are implicitly included by a_samp and don't need to be included on their own. You should not include a_npc since that is exclusively for npcmodes. Thirdly and most importantly don't use spaces or special characters in key names when working with ini ("Player's Data") because they royally screw things up.
Reply
#6

Thanks.

It worked fine as "Player's Data" previously (changed anyway ty). I tried an old copy of the gamemode to confirm my suspicion and it's not a gamemode error.

It's updating live when I'm ingame but once I restart the server (samp-server.exe) and reconnect to the server everything resets back to zero. It's fine if I just reconnect without gmx though so it isn't onplayerconnect etc error.

It makes no sense to me, it's frustrating.

http://i.imgur.com/hSup8wf.png
Код:
[Character]
IsJailed = 0
CharDeaths = 0
CharKills = 0
CharScore = 60
CharMoney = 15000
CharSkin = 3
Premlevel = 1
Adminlevel = 5
Password = 1542..-
Reply
#7

try to check if player logged onplayerdisconnect if yes save all stats then set logged to false or zero
Reply
#8

Quote:
Originally Posted by Whatname
Посмотреть сообщение
try to check if player logged onplayerdisconnect if yes save all stats then set logged to false or zero
It saves OnPlayerDisconnect with my stock (see original post).

PHP код:
[1Register //               Working
[2Spawn //                  Working (add pInfo)
[6Disconnect //             Working (save pInfo)
[4Connect //                Allows you to use incorrect password
[5Spawn //                  Working (excluding [4])
[6Disconnect //             Working (saved pInfo: excluding [4])
[7Follow with GMX//       Working (saved pInfo: excluding [4])
[8Connect //                All reset; [1] 
Reply
#9

BUMP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)