#1

heres the code i made

dcmd_login(playerid, params[])
{
if(logged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You are already logged in! why are you trying to login again?");
}else{
new name[MAX_PLAYER_NAME];
new pass1[256];
new file[128];
GetPlayerName(playerid, name, sizeof(name));
if (sscanf(params, "s", pass1)) SendClientMessage(playerid, COLOR_RED, "Usage: /login [PASSWORD]");
format(file,sizeof(file),"\\users\%s.ini",name);
if(dini_Exists(file))
{
if(dini_Get(file, "password") != pass1)
SendClientMessage(playerid, COLOR_RED, "Incorrect password, try again!");
else if(pass1 == dini_Get(file, "password"))
SendClientMessage(playerid, COLOR_GREEN, "You are now logged in!");
logged[playerid] = 1;
}else{
SendClientMessage(playerid, COLOR_RED, "You can register this account!");
}
}
}

heres the errors

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


2 Errors.

how do i fix it
Reply
#2

new realpassword[256];
realpassword = dini_Get(file, "password");

if(dini_Get(file, "password") != pass1)
should be
if(strcmp(pass1, realpassword, false))

else if(pass1 == dini_Get(file, "password"))
should be
else if(!strcmp(pass1, realpassword, false))
Reply
#3

Quote:
Originally Posted by cessil
if(dini_Get(file, "password") != pass1)
should be
if(strcmp(pass, Pass, false))

else if(pass1 == dini_Get(file, "password"))
should be
else if(!strcmp(pass, Pass, false))
that works with dmc an sscanf! :O THANK YOU I FUCKING LOVE YOU THIS I MY FIRST ADMIN SYSTEM EVER!
Reply
#4

Quote:
Originally Posted by cessil
new realpassword[256];
realpassword = dini_Get(file, "password");

if(dini_Get(file, "password") != pass1)
should be
if(strcmp(pass1, realpassword, false))

else if(pass1 == dini_Get(file, "password"))
should be
else if(!strcmp(pass1, realpassword, false))
I LOVE YOU
Reply
#5

Quote:
Originally Posted by cessil
new realpassword[256];
realpassword = dini_Get(file, "password");

if(dini_Get(file, "password") != pass1)
should be
if(strcmp(pass1, realpassword, false))

else if(pass1 == dini_Get(file, "password"))
should be
else if(!strcmp(pass1, realpassword, false))
now i hate u as it dosent work PERIOD
Reply
#6

what errors you getting?

Код:
dcmd_login(playerid, params[])
{
  if(logged[playerid] == 1)
  {
  SendClientMessage(playerid, COLOR_RED, "You are already logged in! why are you trying to login again?");
  new name[MAX_PLAYER_NAME];
  new pass1[256];
  new rpass[100];
  new file[128];
  if (sscanf(params, "s[100]", rpass)) SendClientMessage(playerid, COLOR_RED, "Usage: /login [PASSWORD]");
  format(file,sizeof(file),"/users/%s.ini",name);
  if(dini_Exists(file))
  {
  rpass = dini_Get(file, "password");
  if(strcmp(pass1, rpass, true))
  SendClientMessage(playerid, COLOR_RED, "Incorrect password, try again!");
  else if(!strcmp(pass1, rpass, true))
  SendClientMessage(playerid, COLOR_GREEN, "You are now logged in!");
  logged[playerid] = 1;
  }else{
  SendClientMessage(playerid, COLOR_RED, "You can register this account!");
   }
  }
}
try this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)