Array sizes don't match
#1

I've started makingur password, a registeration system, if you select "password" or "Password" as your pass, it returns a client message.
pawn Код:
if(dialogid == DIALOG_NEWACC)
    {
        new
            pass[8];
        pass = inputtext;
        if(pass == "password" || pass == "Password") return SendClientMessage(playerid, GREY, "Please choose a more original password.");
    }
pawn Код:
C:\Users\Jack\Desktop\Server\Lf-Rp.pwn(257) : error 047: array sizes do not match, or destination array is too small
C:\Users\Jack\Desktop\Server\Lf-Rp.pwn(258) : error 001: expected token: "-string end-", but found "-identifier-"
And I get those.

Help, please?
Reply
#2

new pass[9];
Reply
#3

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
new pass[9];
Nope.. :c
Reply
#4

You don't compare strings like that. You can only compare single values. To compare strings, use strcmp.
Reply
#5

Quote:
Originally Posted by Slice
Посмотреть сообщение
You don't compare strings like that. You can only compare single values. To compare strings, use strcmp.
How would I use it, though? I use zcmd so it won't be compatible? Plus it's a dialog?
Reply
#6

pawn Код:
//password == PasWoRD
if(!strcmp(pass,"password",true)
pawn Код:
//password != PasWoRD
if(!strcmp(pass,"password"),false))
Seems you don't need to create 'password' .

You can use inputtext directly.
pawn Код:
//password == PasWoRD
if(!strcmp(inputtext,"password",true))
Reply
#7

pawn Код:
if(strcmp(inputtext,"password"),true) return SendClientMessage(playerid, GREY, "Please choose a more original password.");
And I get
C:\Users\Jack\Desktop\Server\Lf-Rp.pwn(264) : warning 206: redundant test: constant expression is non-zero
Reply
#8

pawn Код:
if(strcmp(inputtext,"password",true)) return SendClientMessage(playerid, GREY, "Please choose a more original password.");
Reply
#9

Thanks so much!
I've repped you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)