STRING* arrays

Posted By: Quad

STRING* arrays - 01/19/08 11:51

i want to declare a string array to use with half-life console-like thingy.

STRING* console_strs[20] = {"#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60","#60"};

didnt work.

any ideas?
Posted By: Futurulus

Re: STRING* arrays - 01/20/08 00:16

You could make a loop in a startup function that fills your array.
Code:
STRING* console_strs[20];
function fillstrs_startup()
{
var s;
for(s = 0; s < 20; s++)
console_strs[s] = str_create("#60");
}

You wouldn't be able to use console_strs in other startup functions, though.

How, exactly, didn't it work? Did you get an error, or did the strings show up empty somewhere in the script?
Posted By: Quad

Re: STRING* arrays - 01/21/08 23:21

Quote:

You could make a loop in a startup function that fills your array.
Code:
STRING* console_strs[20];
function fillstrs_startup()
{
var s;
for(s = 0; s < 20; s++)
console_strs[s] = str_create("#60");
}

You wouldn't be able to use console_strs in other startup functions, though.

How, exactly, didn't it work? Did you get an error, or did the strings show up empty somewhere in the script?




Actually i use only one STRING* for console strings and appending it after actions but thank you for your reply.

I dont remember exactly but it was like a syntax error or something. I mean it doesnt even start, it throws an error.
© 2024 lite-C Forums