how count corectly - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how count corectly (
/showthread.php?tid=415758)
how count corectly -
speed258 - 14.02.2013
hi guys i wanna ask how to count correctly, if i wrote in my dialog as example 2514 number so every 1000 i add + 45 but if player write 2001 so he got counted result 2091 so how to make that i got no idea
Re: how count corectly -
MP2 - 14.02.2013
You should define dialog IDs. NEVER use literal constant numbers (I think they're called that).
Generally, the dialogs in a gamemode start at 0 and filterscripts/includes should use 1000 or 5000 etc. It's hard to do really without conflicts.
Re: how count corectly -
speed258 - 14.02.2013
not dialog id, i talking about string(integer) i wrote in dialog if in dialog i wrote 2001 so specific count system she will count that method every 1000 she will add 45 so if i wrote 2001 so that she makes 2091 (2001+((45+45)because result got 2000)) = 2091 so how make that system?
Re: how count corectly -
MP2 - 14.02.2013
Not entirely sure what you mean. From what I understand you want to get the value of what was entered and add 45 per 1000?
value = strval(inputtext);
value = value + (45*(value / 1000))
Tested it, works fine.
If you want to add it for every value (i.e. 500 will add 22.5 (half of 45)) then:
new value = strval(inputtext);
value = floatround(value + (0.045*(value)));
Re: how count corectly -
speed258 - 14.02.2013
MP2 thanks very much you help me save a lot of space. Thanks.