View Single Post
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 12-02-2019 , 09:21   Re: [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #3

Quote:
Originally Posted by JoinedSenses View Post
On mobile right now, so my help is limited.

One thing I noticed is the char functions need to be char[]. They must return a variable, not a const, meaning anything with quotes or brackets. You also cant initialize arrays with a non constant. It must first be declared, then set. Here is a working example:

Code:
#include <sourcemod>

public void OnPluginStart() {
	char w[32];
	w = f();
	PrintToServer(w);
}

char[] f() {
	char w[] = "whatever";
	return w;
}
Might be better to instead pass the string as a function parameter by ref instead of returning it. Example:
Code:
#include <sourcemod>

public void OnPluginStart() {
	char w[32]
	f(w, sizeof(w));
	PrintToServer(w);
}

void f(char[] w, int size) {
	strcopy(w, size, "whatever");
}
Sourcepawn also does not allow string comparisons with ==. Use StrEqual or do someString[0] == '\0' to check if string is empty.
Thanks for those suggestions as well as reminding me not to compare strings using == (I had an obscure feeling that something was wrong when I did that)

Unfortunately the main problem still exists - the compiling is screwed over after the else part.
I don't know why, but the compiler's failing and I do not know why or how. One of the lines it reports is:
else if (StrEqual(cl_survname, "producer", false))
when there was another line before that used the EXACT same function:
if (StrEqual(cl_survname, "gambler", false))

It could be the else that is broken, but I don't know why...?

Last edited by Shadowysn; 12-02-2019 at 09:27.
Shadowysn is offline