help with "password" definition
#1

Hello.
I cannot find what's wrong in this command, Here is the compiler, And down the command + new passwordET;

HTML Code:
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(1523) : error 006: must be assigned to an array
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(6527) : error 033: array must be indexed (variable "password")
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(6548) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
PHP Code:
-- In the top of the script..
new 
passwordET "playboy123"
PHP Code:
CMD:open(playerid,params[])
{
    new 
password[50];
    
     if(
sscanf(params"s[128]"password)) return SendClientMessage(playerid,COLOR_WHITE""COL_USAGE"[SYNTAX] {FFFFFF}/open [PASSWORD]");
     if(
passwordET == password)
     {
    new 
Float:xFloat:yFloat:z;
    
GetObjectPos(cKGatexyz);
    if(
== -2079.33032 && == 1564.73865 && == 19.41173)
    {
    if(
IsPlayerInRangeOfPoint(playerid30, -2079.330321564.7386519.41173))
    {
    
MoveObject(cKGate, -2079.330321564.7386513.82182ETSpeed0.000000.000000.00000);
    
SendClientMessage(playeridCOLOR_WHITE"{AFAFAF}[SERVER]{FFFFFF} You have opened [ET] gate.");
    
SetTimer("ckhq",3000,0);
    return 
1;
    }
    else if(!
IsPlayerInRangeOfPoint(playerid30, -2079.330321564.7386519.41173))
    {
    
SendClientMessage(playeridCOLOR_WHITE"{FF0000}[ERROR]{FFFFFF} You are not near the gate.");
    return 
1;
    }
    }
    else return 
SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR]{FFFFFF} The gate is already used, Please wait ..");
    }
        return 
1;

Reply
#2

You'll have to create it as a string like this:
pawn Code:
new passwordET[7] = "gpqggq";
But yes.
Reply
#3

Quote:
Originally Posted by CalvinC
View Post
You'll have to create it as a string like this:
pawn Code:
new passwordET[7] = "gpqggq";
But yes.
Okay, Ty.
But i got another error -.-

HTML Code:
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(6527) : error 033: array must be indexed (variable "passwordET")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 6527:
PHP Code:
if(passwordET == password
Reply
#4

You need to do the same, put [stringlength] at the end of the passwordET.
Reply
#5

Quote:
Originally Posted by CalvinC
View Post
You need to do the same, put [stringlength] at the end of the passwordET.
same error -__-
HTML Code:
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(6527) : error 032: array index out of bounds (variable "passwordET")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
This is the command:
PHP Code:
CMD:open(playerid,params[])
{
    new 
password[50];
    new 
passwordET[20] = "heell511";
    
     if(
sscanf(params"s[128]"password)) return SendClientMessage(playerid,COLOR_WHITE""COL_USAGE"[SYNTAX] {FFFFFF}/open [PASSWORD]");
     if(
passwordET == password[50]) // this is line 6527 - error line
     
{
    new 
Float:xFloat:yFloat:z;
    
GetObjectPos(cKGatexyz);
    if(
== -2079.33032 && == 1564.73865 && == 19.41173)
    {
        if(
IsPlayerInRangeOfPoint(playerid30, -2079.330321564.7386519.41173))
        {
        
MoveObject(cKGate, -2079.330321564.7386513.82182ETSpeed0.000000.000000.00000);
        
SendClientMessage(playeridCOLOR_WHITE"{AFAFAF}[SERVER]{FFFFFF} You have opened [ET] gate.");
        
SetTimer("ckhq",3000,0);
        return 
1;
        }
        else if(!
IsPlayerInRangeOfPoint(playerid30, -2079.330321564.7386519.41173))
        {
        
SendClientMessage(playeridCOLOR_WHITE"{FF0000}[ERROR]{FFFFFF} You are not near the gate.");
        return 
1;
        }
    }
    else return 
SCM(playerid,COLOR_WHITE,"{FF0000}[ERROR]{FFFFFF} The gate is already used, Please wait ..");
    }
    return 
1;

Reply
#6

please someone help see my reply above.
Reply
#7

https://sampwiki.blast.hk/wiki/Strcmp
Reply
#8

Removed.
Reply
#9

Quote:
Originally Posted by Vince
View Post
Oh yeah sorry i didn't think.

You need to use Strcmp to compare 2 strings.
pawn Code:
if(!strcmp(password, "passwordET", true))
Reply
#10

Quote:
Originally Posted by CalvinC
View Post
Oh yeah sorry i didn't think.

You need to use Strcmp to compare 2 strings.
pawn Code:
if(!strcmp(password, "passwordET", true))
Ye, I replaced if(passwordET == password) with the one you gave me.
But when i compile, It gives me a warning: "passwordET" is never used.

HTML Code:
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(21885) : warning 203: symbol is never used: "passwordET"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)