Value still setting to 100. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Value still setting to 100. (
/showthread.php?tid=263823)
Value still setting to 100. -
Lynn - 23.06.2011
If I type 100 in the input box, it sets it to 100. When it should set it to 99.
pawn Код:
if(strlen(inputtext) > 98)// If the Input = Greater than 98, it Auto sets it to 99.
{
DuelArmor = 99;
}
else
{
new Float:armor = strval(inputtext);
DuelArmor = armor;
}
Re: Value still setting to 100. -
gimini - 23.06.2011
strlen returns the number of characters, you need to use
strval
pawn Код:
if(strval(inputtext) > 98) DuelArmor = 99;
else DuelArmor = strval(inputtext);
Re: Value still setting to 100. -
Lynn - 23.06.2011
So would I use;
giveplayerid = strval(inputtext);
as-well?
Re: Value still setting to 100. -
gimini - 23.06.2011
Quote:
Originally Posted by Lynn
So would I use;
giveplayerid = strval(inputtext);
as-well?
|
Yes,
strval converts a string to an integer
Re: Value still setting to 100. -
Lynn - 23.06.2011
Alright, thanks!