GetServerVarAsInt with float variables - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP (
https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (
https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: GetServerVarAsInt with float variables (
/showthread.php?tid=567272)
GetServerVarAsInt with float variables -
OstGot - 12.03.2015
This code returns 0...
pawn Code:
GetServerVarAsInt("stream_distance");
(the same as this one, of course)
pawn Code:
float(GetServerVarAsInt("stream_distance"));
Re: GetServerVarAsInt with float variables -
Vince - 12.03.2015
Your best bet is to retrieve it with GetServerVarAsString and parsing it with floatstr.
Re: GetServerVarAsInt with float variables -
OstGot - 13.03.2015
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)
Re: GetServerVarAsInt with float variables -
Abagail - 14.03.2015
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);
}