SA-MP Forums Archive
How to convert strings to int? - 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: How to convert strings to int? (/showthread.php?tid=153816)



How to convert strings to int? - Nakash - 10.06.2010

I'm trying to create a dialog that will get the age when the player types it in the dialog.
The problem is that I don't know if it's possible to convert strings to int in pawn.

pawn Код:
if(IsNumeric(inputtext))
{
  PlayerInfo[playerid][pAge] = inputtext;
}
I don't want to change Age to a string.

Код:
error 033: array must be indexed (variable "inputtext")
error 006: must be assigned to an array



Re: How to convert strings to int? - Jefff - 10.06.2010

Код:
PlayerInfo[playerid][pAge] = strval(inputtext);
xD


Re: How to convert strings to int? - Nakash - 10.06.2010

Quote:
Originally Posted by Jefff
Код:
PlayerInfo[playerid][pAge] = strval(inputtext);
xD
Thanks, lol.
Sorry for the stupid questions