dialog help
#1

Hi again,

my dialog_age isnt working and does not let anyone get past it to spawn and go to the spawn point, it is also meant to say: Your age is: '18' but it does not do this either. It allows me to complete the dialog gender, however.

PHP код:
        case DIALOG_GENDER:
        {
            new 
string[128];
            
format(stringsizeof(string), "Male\nFemale");
            
ShowPlayerDialog(playeridDIALOG_GENDERDIALOG_STYLE_LIST"What is your characters gender?",string,"Select""");
            if(!
response) return ShowPlayerDialog(playeridDIALOG_GENDERDIALOG_STYLE_LIST"What is your characters gender?",string,"Select""");
            if(
listitem == 0)
            {
                
SendClientMessage(playerid, -1"You've selected: 'Male'");
                new 
query[225];
                
playerInfo[playerid][playerGend] = 1;
                
format(querysizeof(query), "UPDATE `accounts` SET `playerGend` = '%d', WHERE `playerName` = '%s'"playerInfo[playerid][playerGend], playerInfo[playerid][playerName]);
                
mysql_tquery(Databasequery);
                new 
string2[128];
                
format(string2sizeof(string2), "Please select an age between: '17' and '90'.");
                
ShowPlayerDialog(playeridDIALOG_AGEDIALOG_STYLE_INPUT"How old is your Character?",string2,"Select""");
            }
            else if(
listitem == 1)
            {
                
SendClientMessage(playerid, -1"You've selected: 'Female'");
                new 
query[225];
                
playerInfo[playerid][playerGend] = 2;
                
format(querysizeof(query), "UPDATE `accounts` SET `playerGend` = '%d', WHERE `playerName` = '%s'"playerInfo[playerid][playerGend], playerInfo[playerid][playerName]);
                
mysql_tquery(Databasequery);
                new 
string2[128];
                
format(string2sizeof(string2), "Please select an age between: '17' and '90'.");
                
ShowPlayerDialog(playeridDIALOG_AGEDIALOG_STYLE_INPUT"How old is your Character?",string2,"Select""");
            
            }
        }
        case 
DIALOG_AGE:
        {
            new 
string[128], age;
            
/*format(string, sizeof(string), "Please select an age between: '17' and '90'.");
            ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "How old is your Character?",string,"Select", "");
            */
            
age strval(inputtext);
            if(!
response) return ShowPlayerDialog(playeridDIALOG_AGEDIALOG_STYLE_INPUT"How old is your Character?",string,"Select""");
            if(
age 17 || age <= 90)
            return 
ShowPlayerDialog(playeridDIALOG_AGEDIALOG_STYLE_INPUT"How old is your Character?",string,"Select""");
            
            new 
query[600];
            
format(stringsizeof(string), "You have selected: '%d'."age);
            
SendClientMessage(playerid, -1string);
            
format(querysizeof(query), "UPDATE `accounts` SET `playerAge` = '%d', WHERE `playerName` = '%s'"playerInfo[playerid][playerAge], playerInfo[playerid][playerName]);
            
mysql_tquery(Databasequery);
            
mysql_tquery(Databasequery"OnPlayerRegister""d"playerid);
        } 
Reply
#2

You return when someone's age is higher then 17 or smaller than 91. That is not what you want to do.
Reply
#3

Okay, removed that line and nothing changes. It does not progress to let me spawn at all.
Any other ideas?
Reply
#4

Quote:
Originally Posted by yllo
Посмотреть сообщение
Okay, removed that line and nothing changes. It does not progress to let me spawn at all.
Any other ideas?
where's the spawning part at all? is it in OnPlayerRegister? if so, can you post the code? also please explain again what happens exactly, which dialogs work because i'm not sure how far your code gets
Reply
#5

First: new query[600] for a short query, my eyes are bleeding.

Second: Use SpawnPlayer(playerid);

Third: You don't have to execute a query just because a player selected Male/Female or age. Just update your local Player enum: Ex Player[playerid][Genre] and set 1/2 for Male/Female.

Use the query just to save the stats when the player disconnects.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)