if(inputtext == "hi") doesnt work
#1

Код:
if(dialogid == 283) // Admin verify
    {
        if(!response)
        {
            SendClientMessage(playerid, -1, "Nice try idiot!");
            Kick(playerid);
        }
        else // login
        {
            if(inputtext == "password")
            {
                SendClientMessage(playerid, -1, "{00EEFF}Welcome back! /help for admin cmds!");
            }
            else
            {
                SendClientMessage(playerid, -1, "Nice try idiot!");
				Kick(playerid);
            }
        }
        return 1; 
    }
Reply
#2

pawn Код:
if(dialogid == 283) // Admin verify
    {
        if(!response)
        {
            SendClientMessage(playerid, -1, "Nice try idiot!");
            Kick(playerid);
        }
        else // login
        {
            if(strcmp(inputtext, "password", true) == 0)
            {
                SendClientMessage(playerid, -1, "{00EEFF}Welcome back! /help for admin cmds!");
            }
            else
            {
                SendClientMessage(playerid, -1, "Nice try idiot!");
                Kick(playerid);
            }
        }
        return 1;
    }
Reply
#3

pawn Код:
if(!strcmp(inputtext, "password", false))
https://sampwiki.blast.hk/wiki/Strcmp


EDIT: Just noticed you created another thread on the same type of thing. When comparing strings you need (well, not need) to use strcmp.
Reply
#4

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
pawn Код:
if(!strcmp(inputtext, "password", false))
https://sampwiki.blast.hk/wiki/Strcmp
That checks if its NOT "password", Try mine
Reply
#5

Use strcmp instead:

Код:
 if(strcmp(inputtext, "password", true) == 0)
Reply
#6

Quote:
Originally Posted by Stefand
Посмотреть сообщение
That checks if its NOT "password", Try mine
Uhh? What's the difference? Aside from you don't check case sensitivity.
Reply
#7

Quote:
Originally Posted by Stefand
Посмотреть сообщение
That checks if its NOT "password", Try mine
Wrong! That checks if it's the same and the case matters.

!strcmp is equal to 0 which is returned if the two strings are the same. The false is about "password" is not same string as "PassWord".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)