GetConsoleVarAs "stream_distance" Server Crash
#1

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?
Reply
#2

You've found a bug: using GetConsoleVarAsString on anything other than string (integers, floats), causes segfault. Please report it, and nice find!
Reply
#3

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.
Reply
#4

GetServerVarAsString function had the same behavior: http://forum.sa-mp.com/showpost.php?...postcount=4147
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
GetServerVarAsString function had the same behavior: http://forum.sa-mp.com/showpost.php?...postcount=4147
I'll make a reference to your post in the Bug Reports thread.
Reply
#6

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


Forum Jump:


Users browsing this thread: