Is this the correct way to make a string sized array == to inputtext?
#1

So I was wondering if I'm doing it correctly with this syntax, I am really not sure.
I have tried to do other methods just to check it and work around it, they worked in pawno but not sure if they'd work in-game.

So this is the method I've tried doing it yet I am unsure if this'll work correctly.

pawn Код:
new g_DialogName[100];

if(dialogid == DIALOG_SET_NAME)
    {
        if(response)
        {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_SET_NAME, DIALOG_STYLE_INPUT, "Enter A Name", "Please enter a desired name for your dialog.\nBy this unique name you can find it stored inside the scriptfiles folder.\nUnder the assigned name you'll give it.\n\n", "INSERT", "EXIT");
            else
            {
                                g_DialogName[99] = inputtext[99];
                ShowPlayerDialog(playerid, DIALOG_SET_TEXT, DIALOG_STYLE_INPUT, "Please enter desired text", "Please enter desired text that the dialog will display.\n\n", "Create", "Exit");
            }
        }
        return 1;
    }
Reply
#2

'else' is useless in this case.
However, about the string, it can be done by using format:
PHP код:
format(g_DialogName100inputtext); 
Or by the way you used, just without the string size [].
Reply
#3

Quote:
Originally Posted by ranme15
Посмотреть сообщение
'else' is useless in this case.
However, about the string, it can be done by using format:
PHP код:
format(g_DialogName100inputtext); 
Or by the way you used, just without the string size [].
Thanks bro, it works.

One little question though.

I have another problem, like this is simple yet unbelievably stupid.

I have done this:

pawn Код:
g_DialogID = strval(inputtext);
And it works and all, but when I'm showing it inside a dialog it like, writes a.. Well not a number nor a character, it's like a weird, symbol.

I don't know why it happends, do you know why?


Edit: Nevermind, I'm so dumb, accidently used a string specifier instead of an integer one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)