Comparing value of a string with another number
#1

Hello. I need to compare a string I get (player Z position) with number from text file. How can i do that ? I know how to get Z distance and too how to get number from the file but i don't know how to compare them. Thanks for help
Reply
#2

Since when is a Z position saved in a String? You can just compare them with if(val1==val2) (unless it really is a String. Then just use floatval() or strval() I can't remember. In PHP it is floatval())
Reply
#3

Adding to the above post, it's floatstr()

pawn Код:
new string[7] = "345.534"

printf("%f", floatstr(string));
prints out
Код:
345.534
Reply
#4

After many tries I always can't do it so I exacly explain what i want to do. I want to get value of player altitude. I use iparachute include found here: https://sampforum.blast.hk/showthread.php?tid=356826
So to get altitude i use
Код:
GetPlayerAltitude(playerid)
Then I need to compare it with value from my file and to get info from my file i use
Код:
dUserINT(Name(playerid)).("Lowest");
Values in my file is just integers. And after that all if the condition is met I want to type it to the file. For that I use this
Код:
dUserSetINT(Name(playerid)).("Lowest", VALUE HERE);
I want to compare it like, if is altitude smaller than value from the file, then write it to the file. If somebody care about include i use to read and write, tell me. Thanks for your reply
Reply
#5

aha, now im absolutly lost. Is another way to do it ?
Reply
#6

nobody ? :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)