15.07.2011, 13:14
Is it possible that our function returns string? I think I saw that somewhere, but when I attempted to make one it sended me some message(Send Error Report, Dont Send) which stops compiling. So it isn't possible?
stock GetNumberName(number) {
new n[64];
switch(number) {
case 0: strcat(n, "zero");
case 1: strcat(n, "one");
case 2: strcat(n, "two");
default: strcat(n, "invalid");
}
return n;
}
ReturnString()
{
new string[1];
return string;
}
stock GetNumberName(number) {
switch(number) {
case 0: return "Zero";
case 1: return "one";
case 2: return "two";
default: return "invailid";
}
}
stock GetNumberName(number)
{
new string[25];
switch(number)
{
case 0: format(string, sizeof string, "Zero");
case 1: format(string, sizeof string, "One");
case 2: format(string, sizeof string, "Two");
default: format(string, sizeof string, "Invalid");
}
return string;
}
Code fixed:
PHP код:
|
stock GetNumberName(number)
{
new string[25];
switch(number)
{
case 0: format(string, sizeof string, "Zero");
case 1: format(string, sizeof string, "One");
case 2: format(string, sizeof string, "Two");
default: format(string, sizeof string, "Invalid");
}
return string;
}
enum Strings {
String1[50]
}
new stringSet[5][Strings];
stock stringtest() {
for(new s; s < 5; s++) {
stringSet[s][String1] = "abc";
}
}