Dialog age help
#1

I want to make it where when the player types in their age below, it would get what they put so I can save it into their pAge stats. Help appreciated!

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 7)
    {
        switch(
listitem)
        {
            case 
0:
            {
                
ShowPlayerDialog(playerid,8,DIALOG_STYLE_INPUT,"Registration","Type your age below","Continue","");
                if (!
response) return Kick(playerid);
                
PlayerInfo[playerid][pSex]=1;
            }
               case 
1:
            {
                
ShowPlayerDialog(playerid,8,DIALOG_STYLE_INPUT,"Registration","Type your age below","Continue","");
                if (!
response) return Kick(playerid);
                
PlayerInfo[playerid][pSex]=2;
            }
        }
    }

PHP код:
    if(dialogid == 8)
    {
        
PlayerInfo[playerid][pAge]=
    } 
Reply
#2

PHP код:
if(dialogid == 8
    { 
        
PlayerInfo[playerid][pAge]= strval(inputtext);
    } 
Reply
#3

Thanks, but I have one more question. How do I make it where they can only set their age through ages 18-65?
Maybe something like this:

PHP код:
if(age 18 || age 65
Reply
#4

pawn Код:
new age = strval(inputtext);

if(!(18 <= age <= 65))
{
    // Error
}
else
{
    PlayerInfo[playerid][pAge] = age;
}
Reply
#5

PHP код:
if(dialogid == 8)  
    {  
        new 
age strval(inputtext);
        if(
age 18 || age 65) return ShowPlayerDialog(playerid,8,DIALOG_STYLE_INPUT,"Registration","Type your age below","Continue",""); 
        
PlayerInfo[playerid][pAge]= age;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)