Is there a way to optimize this code?
#6

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Well, the plugin is quite fast for splitting data from a string.

However, I did a mistake myself. The code I provided will take space as default delimiter. To set the delimiter, use "p<delimiter_here>rest_here". In your case:
pawn Код:
sscanf(_money, "p<.>dd", cash, coin);
Thank you, I haven't known about this. It works right now!

Quote:
Originally Posted by AmigaBlizzard
Посмотреть сообщение
A silly question, but why are you storing a float in a string to begin with?
String manipulations are always slower than processing the same value in a float or integer.
Because you cannot split it if it's not a string.
I want to make a function which is similar to GivePlayerMoney(playerid, money); but in this case, I want 'money' as a float. Like I said, I will convert Float:money to string with format %f and then split it. The number before the dot is the cash and the rest is the coin (like 0.99$, 1.99$).
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)