SA-MP Forums Archive
Is this the correct way to make a string sized array == to inputtext? - 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)
+--- Thread: Is this the correct way to make a string sized array == to inputtext? (/showthread.php?tid=538879)



Is this the correct way to make a string sized array == to inputtext? - Ox1gEN - 24.09.2014

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;
    }



Re: Is this the correct way to make a string sized array == to inputtext? - ranme15 - 24.09.2014

'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 [].


Re: Is this the correct way to make a string sized array == to inputtext? - Ox1gEN - 24.09.2014

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.