Problem With inputtext
#1

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
Reply
#2

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

Reply
#3

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
Reply
#4

Also how to check inputtext is integer ?
Reply
#5

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
Reply
#6

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

Thanks
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)