[Tutorial] Login and Register System - Dialogs - Using Y_INI
#41

Quote:
Originally Posted by 0_o
View Post
You Mean... /me RightClicks And Creates New Folder ***End*** That's What You Mean?
PHP Code:
/me RightClicks And Creates New Folder 'Users'
Reply
#42

Quote:
Originally Posted by Kush
View Post
PHP Code:
/me RightClicks And Creates New Folder 'Users'
Done, Nothing Happened. Still The Same!
Reply
#43

Quote:
Originally Posted by 0_o
View Post
Done, Nothing Happened. Still The Same!
Download the Full Package, grab your includes and place them in the pawno>include folder. Other FS/Plugins needed and then place your script into the gamemode folder. Change some details in the .cfg and then ur good to go I guess.
Reply
#44

Quote:
Originally Posted by Kush
View Post
Download the Full Package, grab your includes and place them in the pawno>include folder. Other FS/Plugins needed and then place your script into the gamemode folder. Change some details in the .cfg and then ur good to go I guess.
Downloaded Full Package and runned The Server. Doesn't Work
Reply
#45

And you call yourself, a bad scripter..

Great Job, Man
Reply
#46

Quote:
Originally Posted by ElieJabbour
View Post
And you call yourself, a bad scripter..

Great Job, Man
Thanks man
Reply
#47

How would i load a string into a variable?
With an integer you do it like "INI_Int();", and with a string ?
I tried INI_String();, but then i get the error Undefined symbol INI_String();
Thanks!
Reply
#48

Quote:
Originally Posted by Wesley221
View Post
How would i load a string into a variable?
With an integer you do it like "INI_Int();", and with a string ?
I tried INI_String();, but then i get the error Undefined symbol INI_String();
Thanks!
I assume it works the same way as the way the password is stored. Though I've never worked around issues with loading strings.
Reply
#49

Why if admin is ingame the other players are admin?
Reply
#50

What do you mean "other player are admins". If you're saying that other people can execute administrative commands, then it's your code.

Place this code within you script, create a new account and test it.

PHP Code:
YCMD:test(playeridparams[], help)
{
    
#pragma unused help
    #pragma unused test
    
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, -1"You are not an Admin!");
    
SendClientMessage(playerid, -1"You are indeed an Admin!");
    return 
1;

Reply
#51

Quote:
Originally Posted by Kush
View Post
I assume it works the same way as the way the password is stored. Though I've never worked around issues with loading strings.
Because im trying to load a whirlpool hashed password, and since it also contains some letters, its an string. Think imma ask it in the y_ini topic then
Great tutorial btw
Reply
#52

Quote:
Originally Posted by Wesley221
View Post
Because im trying to load a whirlpool hashed password, and since it also contains some letters, its an string. Think imma ask it in the y_ini topic then
Great tutorial btw
Thanks but yea, it would work the same way.
Reply
#53

It doesnt save my cash when i use /q.
The code is under the onplayerdisconnect function.
What to do?
Reply
#54

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.
Reply
#55

Quote:
Originally Posted by Kush
View Post
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.
Reply
#56

Quote:
Originally Posted by [PC]henkie[NL]
View Post
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?
Reply
#57

Quote:
Originally Posted by Kush
View Post
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.
Reply
#58

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 © 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.
Reply
#59

Quote:
Originally Posted by SantarioLeone
View Post
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 © 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.
Reply
#60

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];
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)