y_ini Saving Problem SOLVED! <<
#1

Hello, so i have tried a lot to make way to save player's skin and score but i always fail..

Can someone give me any idea?

Here is My Enumerator info and player's data:

PHP код:
#include <a_samp>
#include <YSI\y_ini>
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pHelper,
    
pScore,
    
pKills,
    
pDeaths,
    
pSkin,
    
pVIP,
    
pCookie,
    
pCake,
    
pIcecream
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",PlayerInfo[playerid][pPass]);
    
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Kills",PlayerInfo[playerid][pKills]);
    
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_Int("Score",PlayerInfo[playerid][pScore]);
    
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    
INI_Int("VIP",PlayerInfo[playerid][pVIP]);
    
INI_Int("Cookie",PlayerInfo[playerid][pCookie]);
    
INI_Int("Cake",PlayerInfo[playerid][pCake]);
    
INI_Int("Icecream",PlayerInfo[playerid][pIcecream]);
    
INI_Int("Helper",PlayerInfo[playerid][pHelper]);
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
string[364];
    new 
name [MAX_PLAYER_NAME];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME);
    switch(
reason)
    {
       case 
0:     format(string,sizeof(string),"{f00f00}Left: {F56F18}%s(%i) {5e5c5c}has Disconnected from {5e5c5c}Server,|{f00f00}(Timed-Out)",name,playerid);
       case 
1:     format(string,sizeof(string),"{f00f00}Left: {F56F18}%s(%i) {5e5c5c}has Disconnected from {5e5c5c}Server,|{f00f00}(Leaving)",name,playerid);
       case 
2:  format(string,sizeof(string),"{f00f00}Left: {F56F18}%s(%i) {5e5c5c}has Disconnected from {5e5c5c}Server,|{f00f00}(Kicked/Banned)",name,playerid);
    }
    
SendClientMessageToAll(0xf8f8f8fffstring);
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
    
INI_WriteInt(File,"Cookie",PlayerInfo[playerid][pCookie]);
    
INI_WriteInt(File,"Cake",PlayerInfo[playerid][pCake]);
    
INI_WriteInt(File,"Icecream",PlayerInfo[playerid][pIcecream]);
    
INI_WriteInt(File,"Helper",PlayerInfo[playerid][pHelper]);
    
INI_Close(File);
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""COL_WHITE"Register",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register an CvR new account.","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Skin",0);
                
INI_WriteInt(File,"VIP",0);
                
INI_WriteInt(File,"Helper",0);
                
INI_Close(File);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You've Successfully Registered Your Account! Welcome!","Ok","");
                new 
string[128];
                new 
name[MAX_PLAYER_NAME];
                
GetPlayerName(playeridname,sizeof(name));
                
format(string,sizeof(string),"-RegServ- {F56F18}%s(%i) {FFFFFF}Has registered a new account in Cops Vs Racers Server! Welcome!",name,playerid);
                
SendClientMessageToAll(0xf8f8f8fff,string);
            }
        }
        case 
DIALOG_LOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                    new 
string[128];
                    new 
name[MAX_PLAYER_NAME];
                    
GetPlayerName(playeridname,sizeof(name));
                     
format(string,sizeof(string),"-LogServ- {F56F18}%s(%i) {FFFFFF}Has Logged in his account! Welcome Back!",name,playerid);
                    
SendClientMessageToAll(0xf8f8f8fff,string);
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 
1;
            }
        }
    }
    return 
1;

Any idea?
Reply
#2

Do you have
Код:
SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
under OnPlayerSpawn?

Does the skin/score number appear in the user's ini file?
Reply
#3

Quote:
Originally Posted by Troydere
Посмотреть сообщение
Do you have
Код:
SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
under OnPlayerSpawn?

Does the skin/score number appear in the user's ini file?
Ouch! didn't added those commands, i thought it will be auto enabled. Thanks anyw :*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)