Login / Register cant retrive data - dini
#1

C:\Users\Mathew\Desktop\freeroam.pwn(919) : error 033: array must be indexed (variable "ppassword")
C:\Users\Mathew\Desktop\freeroam.pwn(925) : error 033: array must be indexed (variable "ppassword")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

dcmd_login(playerid, params[])
{
new pass;
if(sscanf(params, "s", pass)) SendClientMessage(playerid, COLOR_RED, "Usage: /login <password>");
else
{
new name[MAX_PLAYER_NAME], file[100];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),PlayerFile,name);
ppassword == dini_Get(file, "password");
// strcat(ppassword, dini_Get(file,"password"));
if(!dini_Exists(file))
{
SendClientMessage(playerid, COLOR_RED, "This name is not registered! register it with /register!");
}else{
if(pass == ppassword)
{
regged[playerid] = 1;
logged[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "Your now logged in!");
}else{
SendClientMessage(playerid, COLOR_RED, "Your password is incorrect!");
}
}
}
return 1;
}
wut do i do D:
Reply
#2

How did you declare ppassword?
Reply
#3

Код:
ppassword == dini_Get(file, "password");
== is used to check if one value is equal to another. = is used to set one value to another. I would say you need to use =, but that probably won't work. Presuming dini_Get returns a string, you need to format the ppassword variable into that string (providing ppassword is a string too that is).

Код:
new ppassword[256];
format(ppassword, 256, "%s", dini_Get(file, "password"));
Additionally, it would be more efficient to check if the username is registered before getting the password.
Reply
#4

Hmm.
dini_Get is used for strings, and here "if(pass == ppassword)" you checking if interger equal to string.
This is the main source of your problem.
Reply
#5

Quote:
Originally Posted by _Jay_
Код:
ppassword == dini_Get(file, "password");
== is used to check if one value is equal to another. = is used to set one value to another. I would say you need to use =, but that probably won't work. Presuming dini_Get returns a string, you need to format the ppassword variable into that string (providing ppassword is a string too that is).

Код:
new ppassword[256];
format(ppassword, 256, "%s", dini_Get(file, "password"));
Additionally, it would be more efficient to check if the username is registered before getting the password.
il give urs a try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)