GetConsoleVarAs "stream_distance" Server Crash -
Freaksken - 29.07.2016
So I wanted the get the stream_distance set in server.cfg, which is a float value.
Since there is no GetConsoleVarAsFloat function, I've tried the approach found in this thread:
click.
Код:
stock Float:GetConsoleVarAsFloat(var[]) {
new string[30];
GetConsoleVarAsString(var, string, sizeof(string)); //Crash happens here
return floatstr(string);
}
But whenever I execute
GetConsoleVarAsFloat("stream_distance"); the server crashes immediately.
GetConsoleVarAsInt and GetConsoleVarAsBool don't return the correct value obviously.
I have this line in my server.cfg file:
Код:
stream_distance 300.0
Does anyone know a solution?
Re: GetConsoleVarAs "stream_distance" Server Crash -
Misiur - 29.07.2016
You've found a bug: using GetConsoleVarAsString on anything other than string (integers, floats), causes segfault. Please report it, and nice find!
Re: GetConsoleVarAs "stream_distance" Server Crash -
Freaksken - 29.07.2016
Quote:
Originally Posted by Misiur
You've found a bug: using GetConsoleVarAsString on anything other than string (integers, floats), causes segfault. Please report it, and nice find!
|
Oh? Well that wasn't the answer I was expecting
. Good to know the fault isn't on my end then
.
EDIT:
The newly created thread in the Bug Reports forums can be found
here.
Re: GetConsoleVarAs "stream_distance" Server Crash -
Konstantinos - 29.07.2016
GetServerVarAsString function had the same behavior:
http://forum.sa-mp.com/showpost.php?...postcount=4147
Re: GetConsoleVarAs "stream_distance" Server Crash -
Freaksken - 29.07.2016
Quote:
Originally Posted by Konstantinos
|
I'll make a reference to your post in the Bug Reports thread.
Re: GetConsoleVarAs "stream_distance" Server Crash -
Misiur - 29.07.2016
It crashes for anything which is not a string, so lanmode, maxplayers, port, query, maxnpc, etc. etc. It's probably naive implementation returning reference to string-array and creates wonky stuff when value is concrete.