Array sizes don't match - 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: Array sizes don't match (
/showthread.php?tid=333535)
Array sizes don't match -
...: 1 :... - 11.04.2012
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?
Re: Array sizes don't match -
ViniBorn - 11.04.2012
new pass[9];
Re: Array sizes don't match -
...: 1 :... - 11.04.2012
Quote:
Originally Posted by Viniborn
new pass[9];
|
Nope.. :c
Re: Array sizes don't match -
Slice - 11.04.2012
You don't compare strings like that. You can only compare single values. To compare strings, use
strcmp.
Re: Array sizes don't match -
...: 1 :... - 11.04.2012
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?
Re: Array sizes don't match -
ViniBorn - 11.04.2012
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))
Re: Array sizes don't match -
...: 1 :... - 11.04.2012
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
Re: Array sizes don't match -
ViniBorn - 11.04.2012
pawn Код:
if(strcmp(inputtext,"password",true)) return SendClientMessage(playerid, GREY, "Please choose a more original password.");
Re: Array sizes don't match -
...: 1 :... - 11.04.2012
Thanks so much!
I've repped you.