SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Tutorials (https://forum.sa-mp.com/forumdisplay.php?f=70)
-   -   [Tutorial] Login and Register System - Dialogs - Using Y_INI (https://forum.sa-mp.com/showthread.php?t=273088)

Kush 26/08/2011 10:06 AM

Re: Login and Register System - Dialogs - Using Y_INI
 
This is because you need to GivePlayerMoney. Remember, the LoadUser_data function simply loads the values, but that doesn't mean it will give you your money, nor will it give you weapons if you don't tell it what to do.

Try something like this:

PHP Code:

forward OnPlayerLogin(playerid);
public 
OnPlayerLogin(playerid)
{
    
GivePlayerCash(playeridPlayerInfo[playerid][pCash]);
    
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
    return 
1;
}

case 
DIALOG_LOGIN:
{
    if ( !
response ) return Kick playerid );
     if( 
response )
      {
           if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""EMBED_WHITE"Login",""EMBED_RED"You have entered an incorrect password.\n"EMBED_WHITE"Type your password below to login.","Login","Quit");

        if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
        {
            
INI_ParseFile(PlayerPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
            
OnPlayerLogin(playerid); //here
        
}
        else
        {
              
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""EMBED_WHITE"Login",""EMBED_RED"You have entered an incorrect password.\n"EMBED_WHITE"Type your password below to login.","Login","Quit");
        }
    }


That would work.

Henkie 26/08/2011 10:16 AM

Re: Login and Register System - Dialogs - Using Y_INI
 
Quote:

Originally Posted by Kush (Post 1368979)
This is because you need to GivePlayerMoney. Remember, the LoadUser_data function simply loads the values, but that doesn't mean it will give you your money, nor will it give you weapons if you don't tell it what to do.

Try something like this:

PHP Code:

forward OnPlayerLogin(playerid);
public 
OnPlayerLogin(playerid)
{
    
GivePlayerCash(playeridPlayerInfo[playerid][pCash]);
    
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
    return 
1;
}

case 
DIALOG_LOGIN:
{
    if ( !
response ) return Kick playerid );
     if( 
response )
      {
           if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""EMBED_WHITE"Login",""EMBED_RED"You have entered an incorrect password.\n"EMBED_WHITE"Type your password below to login.","Login","Quit");

        if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
        {
            
INI_ParseFile(PlayerPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
            
OnPlayerLogin(playerid); //here
        
}
        else
        {
              
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""EMBED_WHITE"Login",""EMBED_RED"You have entered an incorrect password.\n"EMBED_WHITE"Type your password below to login.","Login","Quit");
        }
    }


That would work.

That is not the answer for my question.
It does not save the money when I disconnect. The value does not change in the .ini file.
Thats the problem.
But i dunno how to fix it.

Kush 26/08/2011 10:28 AM

Re: Login and Register System - Dialogs - Using Y_INI
 
Quote:

Originally Posted by [PC]henkie[NL] (Post 1368991)
That is not the answer for my question.
It does not save the money when I disconnect. The value does not change in the .ini file.
Thats the problem.
But i dunno how to fix it.

All I've read was 'Cash doesn't save'. My bad, but yea I've just re-downloaded the Full Download and it saves for me. What changes have you made?

Henkie 26/08/2011 10:49 AM

Re: Login and Register System - Dialogs - Using Y_INI
 
Quote:

Originally Posted by Kush (Post 1369004)
All I've read was 'Cash doesn't save'. My bad, but yea I've just re-downloaded the Full Download and it saves for me. What changes have you made?

I added some variables like: pFaction, pSkin etc.
And didn't download yours, but I just copied the code from your first post.
I'll try to use your download later this day.
I can't do it now, because I'm using my mobile phone right now.

SantarioLeone 28/08/2011 04:41 PM

Re: Login and Register System - Dialogs - Using Y_INI
 
HTML Code:

[C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : error 017: undefined symbol "pInfo"
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : warning 215: expression has no effect
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : error 001: expected token: ";", but found "]"
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : error 029: invalid expression, assumed zero
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

My errors are this and GREAT tutorial by the way. Im not sure where i went wrong but i followed it step by step.

Kush 28/08/2011 04:42 PM

Re: Login and Register System - Dialogs - Using Y_INI
 
Quote:

Originally Posted by SantarioLeone (Post 1371884)
HTML Code:

[C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : error 017: undefined symbol "pInfo"
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : warning 215: expression has no effect
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : error 001: expected token: ";", but found "]"
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : error 029: invalid expression, assumed zero
C:\Users\Tab\Desktop\Los Santos RolePlay\Los Santos RolePlay\gamemodes\Scratch.pwn(61) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

My errors are this and GREAT tutorial by the way. Im not sure where i went wrong but i followed it step by step.

Thanks and show the code.

SantarioLeone 28/08/2011 04:48 PM

Re: Login and Register System - Dialogs - Using Y_INI
 
HTML Code:

public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",pInfo[playerid][pPass]); //line 61
    INI_Int("Cash",pInfo[playerid][pCash]);
    INI_Int("Admin",pInfo[playerid][pAdmin]);
    INI_Int("Kills",pInfo[playerid][pKills]);
    INI_Int("Deaths",pInfo[playerid][pDeaths]);
    return 1;
}

HTML Code:

enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new pInfo[MAX_PLAYERS][pInfo];


Kush 28/08/2011 04:53 PM

Re: Login and Register System - Dialogs - Using Y_INI
 
EDIT: Nevermind, gamemode received*.

SantarioLeone 28/08/2011 05:04 PM

Re: Login and Register System - Dialogs - Using Y_INI
 
I sent you the full script in a Pm, its still giving errors.

Kush 28/08/2011 05:20 PM

Re: Login and Register System - Dialogs - Using Y_INI
 
Quote:

Originally Posted by SantarioLeone (Post 1371912)
I sent you the full script in a Pm, its still giving errors.

Gamemode sent. Fixed.


All times are GMT. The time now is 09:15 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.