IsNumeric and Gender problem
#1

I have problem with IsNumeric and Gender Problem

i follow SuperS82's tutorial called "Using OnPlayerText to make Questions"
it works fine until i get error from here

pawn Код:
if((strcmp("male", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("male")))
Error

Код:
error 017: undefined symbol "tmp"
and how to check if the in put in this code

pawn Код:
if(pInfo[playerid][TutStep] == 1)
    {
        if(!strlen(text))
        {
            SendClientMessage(playerid, COLOR_RED, "What is your Age?");
            SendClientMessage(playerid, COLOR_WHITE, "HINT: Allowed age 10 to 35");
            return 0;
        }
        if(strlen(text) != 2)
        {
            SendClientMessage(playerid, COLOR_RED,"2 Characters Digit only!!!");
            return 0;
        }
        format(string, sizeof(string), "Ok, so you are %d years old", strval(text));
        SendClientMessage(playerid, COLOR_YELLOW, string);
        dini_IntSet(file, "Age", strval(text));
        for(new i = 0; i < 100; i++)
        SendClientMessageToAll(COLOR_WHITE," ");
        SendClientMessage(playerid, COLOR_RED, "What is your Gender?");
        SendClientMessage(playerid, COLOR_WHITE, "HINT: Allowed Gender: male and female");
        pInfo[playerid][TutStep] = 2;
        return 0;
    }
was a alphabetical letter. i tired

pawn Код:
if(!IsNumeric(strlen(text)))
but i get this error

Код:
error 035: argument type mismatch (argument 1)
Reply
#2

pawn Код:
new tmp[32];
paste the line for error 035
Reply
#3

now when i type male it didn't respond to my function, it compiles good
pawn code

pawn Код:
if((strcmp("male", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("male")))
        {
            dini_Set(file, "Gender", "Male");
            SendClientMessage(playerid, COLOR_YELLOW, "Ok, so you are a male");
            return 0;
        }
        else if((strcmp("female", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("female")))
        {
            dini_Set(file, "Gender", "Female");
            SendClientMessage(playerid, COLOR_YELLOW, "Ok, so you are a female");
            return 0;
        }
Reply
#4

i think you want to use
pawn Код:
!strcmp("male", tmp, true, strlen(tmp)) == 0)
Returns -1 if string1 comes before string2
1 if string1 comes after string2
0 if the strings are the same (for the matched length).
Reply
#5

if(!IsNumeric(strlen(text)))
replace strlen(text) with text, pawn shows the error cause the function is IsNumeric(const string[]).
Reply
#6

Jonny didn't work.

i did this

pawn Код:
if(strcmp("male", tmp, true, strlen(tmp)) == 0)
and it work.

now i need help about IsNumeric
Reply
#7

Quote:
Originally Posted by peugeot
Посмотреть сообщение
if(!IsNumeric(strlen(text)))
replace strlen(text) with text, pawn shows the error cause the function is IsNumeric(const string[]).
have you tried this?
i overlooked that sorry.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)