GetServerVarAsInt with float variables
#1

This code returns 0...
pawn Code:
GetServerVarAsInt("stream_distance");
(the same as this one, of course)
pawn Code:
float(GetServerVarAsInt("stream_distance"));
Reply
#2

Your best bet is to retrieve it with GetServerVarAsString and parsing it with floatstr.
Reply
#3

Thanks for answers
But.. when I suggested (in the relevant thread) function "GetServerVarAsFloat", people replied to me:

Quote:

float(GetPVarInt(playerid, "hello"))

Either it does not work exactly with the "stream_distance", either the wrong way for all server vars (float)
Reply
#4

Well, then they are wrong.

As Y_Less said something such as this should work:

pawn Code:
stock GetServerVarAsFloat(var[])
{
     new string[30];
     GetServerVarAsString(var, string, sizeof(string));
     return floatstr(string);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)