SA-MP Forums Archive
i need help with error - 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: i need help with error (/showthread.php?tid=401728)



i need help with error - madh3r0 - 23.12.2012

Hey, i need some help with this error..
Код:
C:\Users\MAD\Desktop\Serverio failai\[+]SANFR\gamemodes\SANFR.pwn(16002) : error 033: array must be indexed (variable "-unknown-")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
and the line is

new Skaiciai = (inputtext);
if(Skaiciai == "&")


Re: i need help with error - [HiC]TheKiller - 23.12.2012

inputtext is a string, not a int. There is no point in making a new string if you're going to just assign another string to it and then check for something. If you want to check if the string just has an & then do this
pawn Код:
if(inputtext[0] = '&' & !inputtext[1])
That will check if there is a & for the first character and there is nothing for the second.


Re: i need help with error - madh3r0 - 23.12.2012

Код:
C:\Users\MAD\Desktop\Serverio failai\[+]SANFR\gamemodes\SANFR.pwn(16158) : warning 211: possibly unintended assignment
C:\Users\MAD\Desktop\Serverio failai\[+]SANFR\gamemodes\SANFR.pwn(16158) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           8892 bytes
Code size:          1706684 bytes
Data size:         18125068 bytes
Stack/heap size:      16384 bytes; estimated max. usage=5815 cells (23260 bytes)
Total requirements:19857028 bytes

2 Warnings.
I get this

Код:
if(inputtext[0] = '&' & !inputtext[1])



Re: i need help with error - [HiC]TheKiller - 23.12.2012

Quote:
Originally Posted by madh3r0
Посмотреть сообщение
Код:
C:\Users\MAD\Desktop\Serverio failai\[+]SANFR\gamemodes\SANFR.pwn(16158) : warning 211: possibly unintended assignment
C:\Users\MAD\Desktop\Serverio failai\[+]SANFR\gamemodes\SANFR.pwn(16158) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           8892 bytes
Code size:          1706684 bytes
Data size:         18125068 bytes
Stack/heap size:      16384 bytes; estimated max. usage=5815 cells (23260 bytes)
Total requirements:19857028 bytes

2 Warnings.
I get this

Код:
if(inputtext[0] = '&' & !inputtext[1])
Sorry about that, should be
Код:
if(inputtext[0] == '&' && !inputtext[1])
Happens sometimes when you use other coding languages heaps :P.


Re: i need help with error - madh3r0 - 23.12.2012

oh thank you...


Re: i need help with error - madh3r0 - 23.12.2012

UP..
How to do that cant use & symbol in inputtext?


Re: i need help with error - [HiC]TheKiller - 23.12.2012

You could use strfind and just look for the & in inputtext or you could do the following:
pawn Код:
for(new b; b<strlen(inputtext); b++)
{
    if(inputtext[b] == '&')
    {
        SendClientMessage(playerid, -1, "You cannot use '&' in your input");
        return 0;
    }
}



Re: i need help with error - madh3r0 - 23.12.2012

thanks again