Just a simple help
#1

How can i put User name here.

I'm using this:

PHP код:
public OnAccountCheck(playerid)
{
    new 
rows, fields;
    
cache_get_data(rows, fields, mysql);
    if(
rows)
    {
        
cache_get_field_content(0, "Password", Player[playerid][Password], mysql, 129);
        
Player[playerid][IDs] = cache_get_field_content_int(0, "IDs");
        
ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Welcome back!\n\nType your password below to log in.\n\nIf this is not your account,please join with \nanother username - this one is taken!\n", "Login", "Quit");
    }
    else
    {
        
ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Register", "Welcome !\n\nYour account is not registered yet!\nType your password into the box below to register your account.", "Register", "Quit");
    }
    return 
true;
} 
and I want to make it like this:

PHP код:
stock ShowPlayerLoginDialog(playerid, info[])
{
    
dialog = "";
    
format(dialog, sizeof(dialog),
    
"Welcome back, %s!\n\nType your password below to log in.\n\nIf this is not your account,please join with \nanother username - this one is taken!\n\n%s",
      
pData[playerid][Name], info);
    
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_PASSWORD, "Login", dialog, "Login", "Quit");
    return 
1;
} 
Idk

I want put player name here. Idk how i tired . Anyone help?
Reply
#2

PHP код:
    new pName[MAX_PLAYER_NAME];
    
GetPlayerName(playerid, pName, sizeof(pName)); 
Then replace pData[playerid][Name] with that^
Reply
#3

pawn Код:
stock ShowPlayerLoginDialog(playerid, info[])
{
    new string[256];
    format(dialog, sizeof(dialog), "Welcome back, %s!\n\nType your password below to log in.\n\nIf this is not your account, please join with\nanother \
    username - this one is taken!\n\n%s"
, PlayerName(playerid), info);
    return ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_PASSWORD, "Login", dialog, "Login", "Quit");
}

stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}
Reply
#4

Thanks, But this script is buggy. I'm using this, https://sampforum.blast.hk/showthread.php?tid=574714.
You can login with wrong password and also it gives you double money when you re-join. I have posted on his thread if he wants to check. Anyways, Is there any best MYSQL register/login saving system tut?
Reply
#5

http://forum.sa-mp.com/search.php?searchid=9582356
Reply
#6

Rep you bro. Thanks
Reply


Forum Jump:


Users browsing this thread: