SA-MP Forums Archive
Problem With inputtext - 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: Problem With inputtext (/showthread.php?tid=587179)



Problem With inputtext - khRamin78 - 28.08.2015

Hey guys another problem with inputtext i will never learn how to use it

for something like

new prizewinner;

how can i get inputtext as numbers from a dialog(style 1 i know how to set) and put it in prizewinner

also

how can i get inputtext as string like Yes,No And Also Check if its Yes or no (strcmp i think ye s?)


Thanks For Help

i think i will never learn how to use inputtext


Re: Problem With inputtext - Sjn - 28.08.2015

Use strval to convert the inputtext's string into integer.

Something like

PHP код:
new
    
prizewinner;
    
    
prizewinner strval(inputtext); 
And for yes/no;

PHP код:
if (strcmp(inputtext"Yes") == 0)
{
    
// Code here




Re: Problem With inputtext - khRamin78 - 28.08.2015

Quote:
Originally Posted by Sjn
Посмотреть сообщение
Use strval to convert the inputtext's string into integer.

Something like

PHP код:
new
    
prizewinner;
    
    
prizewinner strval(inputtext); 
And for yes/no;

PHP код:
if (strcmp(inputtext"Yes") == 0)
{
    
// Code here

oh ye thanks my bad Repped


Re: Problem With inputtext - khRamin78 - 28.08.2015

Also how to check inputtext is integer ?


AW: Re: Problem With inputtext - Kaliber - 28.08.2015

Quote:
Originally Posted by khRamin78
Посмотреть сообщение
Also how to check inputtext is integer ?
Like this:

PHP код:
//to check:
if(!IsNumeric(inputtext)) return SendClientMessage(playerid,-1,"Not a number!");
//The function:
stock IsNumeric(const string[])
{
    for (new 
strlen(string); != -1i--) if (string[i] > '9' || string[i] < '0') return 0;
    return 
1;

Greekz


Re: Problem With inputtext - Sjn - 28.08.2015

Or you can simply print the inputtext's text to give you the output of it.


Re: Problem With inputtext - khRamin78 - 29.08.2015

Thanks