Score save help
#1

I got register sys i need it to save score.

this is my dialog
PHP код:
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"{FF0000}>>|{00CC00}Please Register{FF0000}|<<",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a 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"Score"GetPlayerScore(playerid));
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_Close(File);
                
SetSpawnInfo(playerid001958.331343.1215.36269.15000000);
                
SpawnPlayer(playerid);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great ! Please Relog to save your stats.!","Ok","");
                
TogglePlayerControllable(playerid0);
            }
        }
        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]);
                    
SendClientMessage(playerid1"{ff0000}[SERVER]{ffffff}: You have successfully logged in !");
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"{FF0000}>>|{00CC00}Please Login{FF0000}|<<",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 
1;
            }
        }
    }
    return 
1;

In my enums i got.. pScore,
Reply
#2

So what's the problem ?
Reply
#3

I understand that you're using Kush's Tutorial (Make Login and Register System Using Y_INI)
So I Helped you by that variables !
if your code is different, show me your code to help you.

pawn Код:
//>Add pScore Variable in player info enum
enum pInfo
{
 pScore,
 //Other info...
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//>Save Player Score OnPlayerDisconnect
public OnPlayerDisconnect(playerid, reason)
{
if(fexist(UserPath(playerid)))
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    //>Other...........
    INI_Close(File);
}
//>In Login Dialog add this After: GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
//Add This:
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
//>Full Login Dialog:

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(playerid, PlayerInfo[playerid][pCash]);
                    //Here>>>
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                    //**
                    SendClientMessage(playerid, 1, "{ff0000}[SERVER]{ffffff}: You have successfully logged in !");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"{FF0000}>>|{00CC00}Please Login{FF0000}|<<",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
Reply
#4

same but thnx fo helpin tho
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)