SA-MP Forums Archive
How to save text in 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: How to save text in variable? (/showthread.php?tid=593621)



How to save text in variable? - Supermaxultraswag - 07.11.2015

Код:
new Text[4]={"Nice"};
How do I save text in same variable later?

if I do this

Код:
Text[4]={"Nice"};
I get

error 032: array index out of bounds


Re: How to save text in variable? - ThePhenix - 07.11.2015

Quote:
Originally Posted by Supermaxultraswag
Посмотреть сообщение
Код:
new Text[4]={"Nice"};
How do I save text in same variable later?

if I do this

Код:
Text[4]={"Nice"};
I get

error 032: array index out of bounds
You are not leaving a 'slot' for the NULL terminator.

It should be:

PHP код:
new Text[5] = "Nice"
Could also be written as:

PHP код:
new Text[5] = {'N''i''c''e''\0'}; 



Re: How to save text in variable? - Supermaxultraswag - 07.11.2015

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
You are not leaving a 'slot' for the NULL terminator.

It should be:

PHP код:
new Text[5] = "Nice"
Could also be written as:

PHP код:
new Text[5] = {'N''i''c''e''\0'}; 
I still get the same error


Re: How to save text in variable? - AbyssMorgan - 07.11.2015

PHP код:
new Text[5];
Text "Nice"



Re: How to save text in variable? - Supermaxultraswag - 07.11.2015

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
new Text[5];
Text "Nice"
tHANKS