strtobool
#1

Anyone haves this function (it would convert string to a boolean (true/false) ? Tried to use search, nothing.
Reply
#2

What are your intentions with this function? Explain better, maybe we can help ...
Reply
#3

sscanf.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
sscanf.
Yes ^.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
sscanf.
Example?
Reply
#6

pawn Код:
if(sscanf(params, "ll", "true false", bool1, bool2))
Note: lowercase L (stands for logical).
Reply
#7

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
if(sscanf(params, "ll", "true false", bool1, bool2))
Note: lowercase L (stands for logical).
I need this function a bit in other way.

I've did it like this:

pawn Код:
pData[playerid][HiddenTrailers][i] = strval(szResult);
But I get tag mistach, because statsHiddenTrailers is a bool.
Reply
#8

Append !! before it!

I haven't tested, but it should work.
pawn Код:
pData[playerid][HiddenTrailers][i] = !!strval(szResult);
And it is quite damn clever!
Reply
#9

ty u so much :]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)