Doesn't load/save user's data
#1

Everytime I connect to my localhost server, the password saves but the rest doesn't. Here's the info of the server.

PHP код:
public OnPlayerConnect(playerid)
{
    
GangZoneShowForPlayer(playeridBlackRadar0x000000FF);
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    if(
fexist(Path(playerid)))
    {
        
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra true, .extra playerid);
        
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome back to "COL_LRED""SERVER_NAME" "SERVER_VERSION""COL_WHITE". This account is registered. \nInsert your password to login to your account","Login","Quit");
    }
    else 
    {
        
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register","Welcome to "COL_LRED""SERVER_NAME" "SERVER_VERSION""COL_WHITE"! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
        return 
1;
      }
    return 
1;

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    if(
INI_Exists(Path(playerid)))
    {
        
SaveStats(playerid);
        return 
1;
    }
    for(new 
i=0i<MAX_PLAYER_ATTACHED_OBJECTSi++)
     {
        if(
IsPlayerAttachedObjectSlotUsed(playeridi)) RemovePlayerAttachedObject(playeridi);
    }
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_REGISTER:
        {
            if(!
response)
            {
                
SendClientMessage(playeridCOLOR_LIGHTRED"You need to be registered to play at "COL_LRED""SERVER_NAME" "SERVER_VERSION"");
                 
Kick(playerid);
            }
            else if(
response)
            {
                if(!
strlen(inputtext))
                {
                       
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                    return 
1;
                }
                new 
hashpass[129];
                
WP_Hash(hashpass,sizeof(hashpass),inputtext);
                new 
INI:File INI_Open(Path(playerid));
                
INI_SetTag(File,"Player's Data");
                
INI_WriteString(File,"Password",hashpass);
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"AdminLevel",0);
                
INI_WriteInt(File,"ZombiesKilled",0);
                
INI_WriteInt(File,"HumansKilled",0);
                
INI_WriteInt(File,"HumanDeaths",0);
                
INI_WriteInt(File,"ZombieDeaths",0);
                
INI_WriteInt(File,"Premium",0);
                
INI_WriteFloat(File,"Pos_X",0.0);
                
INI_WriteFloat(File,"Pos_Y",0.0);
                
INI_WriteFloat(File,"Pos_Z",0.0);
                
INI_WriteInt(File,"PM",0);
                
INI_WriteInt(File,"Hours",0);
                
INI_WriteInt(File,"Seconds",0);
                
INI_WriteInt(File,"Minutes",0);
                
INI_WriteInt(File,"Muted",0);
                
INI_WriteInt(File,"Warnings",0);
                
INI_WriteBool(File,"Logged",true);
                
INI_WriteInt(File,"NewbieMute",0);
                
INI_WriteInt(File,"TotalNMute",0);
                
INI_WriteInt(File,"Banned",0);
                
INI_WriteInt(File,"Vote",0);
                
INI_WriteInt(File,"VotedPlayer",0);
                
INI_WriteInt(File,"Mask",0);
                
INI_WriteInt(File,"MaskOn",0);
                
INI_WriteInt(File,"Cookies",0);
                
INI_Close(File);
                
GivePlayerMoney(playerid10000);
                
SaveStats(playerid);
                
SendClientMessage(playerid,-1,"You have been successfully registered");
                
SpawnPlayer(playerid);
                return 
1;
            }
        }
        case 
DIALOG_LOGIN:
        {
            if(!
response)
            {
                
SendClientMessage(playeridCOLOR_LIGHTRED"You need to be registered to play at "COL_LRED""SERVER_NAME" "SERVER_VERSION"");
                 
Kick(playerid);
            }
              else if(
response)
            {
                new 
hashpass[129];
                
WP_Hash(hashpass,sizeof(hashpass),inputtext);
                if(!
strcmp(hashpasspInfo[playerid][Password], false))
                {
                    
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra true, .extra playerid);
                    
SetPlayerScore(playerid,pInfo[playerid][ZombiesKilled]);
                    
GivePlayerMoney(playerid,pInfo[playerid][zMoney]);
                    
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
                    
pInfo[playerid][pLogged] = true;
                    
SaveStats(playerid);
                }
                else
                {
                    
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Welcome back to "COL_LRED""SERVER_NAME" "SERVER_VERSION""COL_WHITE". This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
                    
return 1;
                }
            }
        }
    }

PHP код:
forward loadaccount_user(playeridname[], value[]);
public 
loadaccount_user(playeridname[], value[])
{
    
INI_String("Password"pInfo[playerid][Password],129);
    
INI_Int("zMoney",pInfo[playerid][zMoney]);
    
INI_Int("AdminLevel",pInfo[playerid][pAdminLevel]);
    
INI_Int("ZombiesKilled",pInfo[playerid][ZombiesKilled]);
    
INI_Int("HumansKilled",pInfo[playerid][HumansKilled]);
    
INI_Int("HumanDeaths",pInfo[playerid][HumanDeaths]);
    
INI_Int("ZombieDeaths",pInfo[playerid][ZombieDeaths]);
    
INI_Int("Premium",pInfo[playerid][pPremium]);
    
INI_Float("Pos_X",pInfo[playerid][pX]);
    
INI_Float("Pos_Y",pInfo[playerid][pY]);
    
INI_Float("Pos_Z",pInfo[playerid][pZ]);
    
INI_Int("PM",pInfo[playerid][pPM]);
    
INI_Int("Hours",pInfo[playerid][pHour]);
    
INI_Int("Seconds",pInfo[playerid][pSec]);
    
INI_Int("Minutes",pInfo[playerid][pMin]);
    
INI_Int("Muted",pInfo[playerid][Muted]);
    
INI_Int("Warnings",pInfo[playerid][Warnings]);
    
INI_Bool("Logged",pInfo[playerid][pLogged]);
    
INI_Int("NewbieMute",pInfo[playerid][pNMute]);
    
INI_Int("TotalNMute",pInfo[playerid][pNMuteTotal]);
    
INI_Int("Banned",pInfo[playerid][pBanned]);
    
INI_Int("Vote",pInfo[playerid][pVote]);
    
INI_Int("VotedPlayer",pInfo[playerid][VotedPlayer]);
    
INI_Int("Mask",pInfo[playerid][pMask]);
    
INI_Int("MaskOn",pInfo[playerid][pMaskOn]);
    
INI_Int("Cookies",pInfo[playerid][pCookies]);
    
INI_Int("Jailed",pInfo[playerid][pJailed]);
    
INI_Int("JailTime",pInfo[playerid][pJailTime]);
    
INI_Int("FirstPS",pInfo[playerid][FirstPS]);
    return 
1;
}
forward SaveStats(playerid);
public 
SaveStats(playerid)
{
    
GetPlayerPosplayeridpInfo[playerid][pX], pInfo[playerid][pY], pInfo[playerid][pZ] );
    
pInfo[playerid][zMoney] = GetPlayerMoney(playerid);
    new 
INI:File INI_Open(Path(playerid));
    
INI_SetTag(File,"PlayerData");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"AdminLevel",pInfo[playerid][pAdminLevel]);
    
INI_WriteInt(File,"ZombiesKilled",pInfo[playerid][ZombiesKilled]);
    
INI_WriteInt(File,"HumansKilled",pInfo[playerid][HumansKilled]);
    
INI_WriteInt(File,"HumanDeaths",pInfo[playerid][HumanDeaths]);
    
INI_WriteInt(File,"ZombieDeaths",pInfo[playerid][ZombieDeaths]);
    
INI_WriteInt(File,"Premium",pInfo[playerid][pPremium]);
    
INI_WriteFloat(File,"Pos_X",pInfo[playerid][pX]);
    
INI_WriteFloat(File,"Pos_Y",pInfo[playerid][pY]);
    
INI_WriteFloat(File,"Pos_Z",pInfo[playerid][pZ]);
    
INI_WriteInt(File,"PM",pInfo[playerid][pPM]);
    
INI_WriteInt(File,"Hours",pInfo[playerid][pHour]);
    
INI_WriteInt(File,"Seconds",pInfo[playerid][pSec]);
    
INI_WriteInt(File,"Minutes",pInfo[playerid][pMin]);
    
INI_WriteInt(File,"Muted",pInfo[playerid][Muted]);
    
INI_WriteInt(File,"Warnings",pInfo[playerid][Warnings]);
    
INI_WriteBool(File,"Logged",true);
    
INI_WriteInt(File,"NewbieMute",pInfo[playerid][pNMute]);
    
INI_WriteInt(File,"TotalNMute",pInfo[playerid][pNMuteTotal]);
    
INI_WriteInt(File,"Banned",pInfo[playerid][pBanned]);
    
INI_WriteInt(File,"Vote",pInfo[playerid][pVote]);
    
INI_WriteInt(File,"VotedPlayer",pInfo[playerid][VotedPlayer]);
    
INI_WriteInt(File,"Mask",pInfo[playerid][pMask]);
    
INI_WriteInt(File,"MaskOn",pInfo[playerid][pMaskOn]);
    
INI_WriteInt(File,"Cookies",pInfo[playerid][pCookies]);
    
INI_WriteInt(File,"Jailed",pInfo[playerid][pJailed]);
    
INI_WriteInt(File,"JailTime",pInfo[playerid][pJailTime]);
    
INI_WriteInt(File,"FirstPS",pInfo[playerid][FirstPS]);
    
INI_Close(File);
    return 
1;

Reply


Messages In This Thread
Doesn't load/save user's data - by NealPeteros - 03.11.2016, 16:14
Re: Doesn't load/save user's data - by NealPeteros - 03.11.2016, 16:48
Re: Doesn't load/save user's data - by NealPeteros - 03.11.2016, 17:01
Re: Doesn't load/save user's data - by AndySedeyn - 03.11.2016, 17:52
Re: Doesn't load/save user's data - by NealPeteros - 04.11.2016, 01:25
Re: Doesn't load/save user's data - by AndySedeyn - 04.11.2016, 01:40
Re: Doesn't load/save user's data - by NealPeteros - 04.11.2016, 01:50
Re: Doesn't load/save user's data - by NealPeteros - 04.11.2016, 02:01
Re: Doesn't load/save user's data - by AndySedeyn - 04.11.2016, 02:03
Re: Doesn't load/save user's data - by NealPeteros - 04.11.2016, 02:09

Forum Jump:


Users browsing this thread: 3 Guest(s)