SA-MP Forums Archive
Finding out a players age - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Finding out a players age (/showthread.php?tid=269420)



Finding out a players age - slymatt - 16.07.2011

Alright i have my login and register code done but im unsure how to continue on from that to make my code find the age of the player could anyone help? im sure it would be just in the register place so heres my register part.

Код:
case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if (response)
            {
                if(!strlen(inputtext)) {
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""WHITE"Registering",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
                }

                if(INI_Open(getINI(playerid))) {
                INI_WriteString("pass", inputtext);
				INI_WriteInt("Age", strval(inputtext));
				INI_WriteInt("Cash", StartingCash);
				INI_WriteInt("Score",1);
				INI_WriteInt("Kills", 0);
				INI_WriteInt("Deaths", 0);
				INI_WriteInt("Timeplayed", 0);
				INI_WriteString("Ipaddress", "NEEDS SETTING");
				INI_WriteString("Saveposition", "NEEDS SETTING");
				INI_WriteInt("Admin", 0);
				INI_WriteInt("Faction", 0);
				INI_WriteInt("Faction", 0);
				INI_WriteInt("Bankdeposit", 0);
				INI_WriteInt("Banned", 0);
				INI_WriteString("Banreason", "");
				INI_WriteInt("House", 0);
				INI_WriteInt("Biz", 0);
				INI_WriteInt("Fightstyle", 0);
                INI_Save();
                INI_Close();

                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
            }
        }
    }
Thanks for any help given
REGARDS MATTHEW


Re: Finding out a players age - Steve M. - 16.07.2011

In what variable did you save player's age?


Re: Finding out a players age - slymatt - 16.07.2011

Im asking where do i add it in im not sure where to put it =S


Re: Finding out a players age - Steve M. - 16.07.2011

Do you have a dialog where you ask a player how old is he?


Re: Finding out a players age - slymatt - 16.07.2011

not yet no this is what i am asking how would i go about adding it


Re: Finding out a players age - Steve M. - 16.07.2011

Here is the example:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Your age", "Type in how old are you.", "Next", "Cancel"); // Show age dialog

case DIALOG_AGE: { // In the OnDialogResponse callback
    if (response) {
        PlayerInfo[playerid][pAge] = strval(inputtext); // Your variable to save player's age
       
        // Here you write player's age in his file
        if (INI_Open(getINI(playerid))) INI_WriteInt("Age", strval(inputtext));
               
        INI_Save();
        INI_Close();
    } else Kick(playerid);
}



Re: Finding out a players age - slymatt - 16.07.2011

Cheers