View Single Post
JoinedSenses
Senior Member
Join Date: Sep 2013
Old 12-02-2019 , 08:46   Re: [L4D2] Masses of compiling error 010 without detectable cause?
Reply With Quote #2

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.
__________________

Last edited by JoinedSenses; 12-02-2019 at 09:05.
JoinedSenses is offline