13.07.2016, 15:23
(
Последний раз редактировалось TracerX; 13.07.2016 в 22:31.
)
removed
new weaponid; if (sscanf(inputtext, "i", weaponid)) return // Inputtext is not a number
switch (weaponid)
{
case 0..5: // If weaponid = 0 or 1 or 2 to 5
{
}
}
|
strval will return 0 if the text doesn't contain only numbers. Checking if the index 0 and 1 are equal to '0' and '\0' respectively is not something people would do and sscanf is really much easier to use.
|