SA-MP Forums Archive
[HELP] Save a string from inputtext to a variable - 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: [HELP] Save a string from inputtext to a variable (/showthread.php?tid=593881)



[HELP] Save a string from inputtext to a variable - Hayden_Almeida - 10.11.2015

Hello guys, iam trying to do something here but i cant:

i Have one variable created in top of GM:
Код:
VariavelString[30];
And i want to get the string from inputtext (from Dialog Input) and store in it.

Actually i am doing this, but it is not working:
Код:
VariavelString[29] = inputtext[29];
Someone?


Re: [HELP] Save a string from inputtext to a variable - 7days7 - 10.11.2015

Try with it:
Код:
format(VariavelString, sizeof(VariavelString), "%s", inputtext);
If your variable can be change, before format use VariavelString[0] = EOS;
[0] - first char of your string and EOS - End Of String. Thanks to the fact You're making VariavelString empty before insert string into another string.

Also there's a one more function called strins:
Код:
strins(VariavelString, inputtext, 0);