PDA

View Full Version : help with "password" definition


aCloudy
02/02/2015, 07:28 PM
Hello.
I cannot find what's wrong in this command, Here is the compiler, And down the command + new passwordET;

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 (c) 1997-2006, ITB CompuPhase


2 Errors.
-- In the top of the script..
new passwordET = "playboy123";

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:x, Float:y, Float:z;
GetObjectPos(cKGate, x, y, z);
if(x == -2079.33032 && y == 1564.73865 && z == 19.41173)
{
if(IsPlayerInRangeOfPoint(playerid, 30, -2079.33032, 1564.73865, 19.41173))
{
MoveObject(cKGate, -2079.33032, 1564.73865, 13.82182, ETSpeed, 0.00000, 0.00000, 0.00000);
SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}[SERVER]{FFFFFF} You have opened [ET] gate.");
SetTimer("ckhq",3000,0);
return 1;
}
else if(!IsPlayerInRangeOfPoint(playerid, 30, -2079.33032, 1564.73865, 19.41173))
{
SendClientMessage(playerid, COLOR_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;
}

CalvinC
02/02/2015, 07:34 PM
You'll have to create it as a string like this:
new passwordET[7] = "gpqggq";
But yes.

aCloudy
02/02/2015, 07:42 PM
You'll have to create it as a string like this:
new passwordET[7] = "gpqggq";
But yes.

Okay, Ty.
But i got another error -.-

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


1 Error.

Line 6527:
if(passwordET == password)

CalvinC
02/02/2015, 08:01 PM
You need to do the same, put [stringlength] at the end of the passwordET.

aCloudy
03/02/2015, 10:55 AM
You need to do the same, put [stringlength] at the end of the passwordET.

same error -__-
C:\Program Files\lvcnrr\gamemodes\SFCNR1.pwn(6527) : error 032: array index out of bounds (variable "passwordET")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

This is the command:

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:x, Float:y, Float:z;
GetObjectPos(cKGate, x, y, z);
if(x == -2079.33032 && y == 1564.73865 && z == 19.41173)
{
if(IsPlayerInRangeOfPoint(playerid, 30, -2079.33032, 1564.73865, 19.41173))
{
MoveObject(cKGate, -2079.33032, 1564.73865, 13.82182, ETSpeed, 0.00000, 0.00000, 0.00000);
SendClientMessage(playerid, COLOR_WHITE, "{AFAFAF}[SERVER]{FFFFFF} You have opened [ET] gate.");
SetTimer("ckhq",3000,0);
return 1;
}
else if(!IsPlayerInRangeOfPoint(playerid, 30, -2079.33032, 1564.73865, 19.41173))
{
SendClientMessage(playerid, COLOR_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;
}

aCloudy
03/02/2015, 11:18 AM
please someone help :( see my reply above.

Vince
03/02/2015, 12:39 PM
http://wiki.sa-mp.com/wiki/Strcmp

CrazyChoco
03/02/2015, 12:42 PM
Removed.

CalvinC
03/02/2015, 02:22 PM
http://wiki.sa-mp.com/wiki/Strcmp

Oh yeah sorry i didn't think.

You need to use Strcmp to compare 2 strings.
if(!strcmp(password, "passwordET", true))

aCloudy
03/02/2015, 07:08 PM
Oh yeah sorry i didn't think.

You need to use Strcmp to compare 2 strings.
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.

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


1 Warning.