One error while compiling
#1

When I try to compile my gamemode, Pawno show me this error:
Код:
C:\Users\Dani\Desktop\OriginalHZ\HZRP1.pwn(21906) : error 033: array must be indexed (variable "kakale")
Here is a part from de code:
pawn Код:
case DLOGIN:
        {
        new kakale[24];
            if(response == 1)
            {
            format(kakale, sizeof(kakale), "%s", inputtext);
                if(kakale == Info[playerid][pKey]) //       if(udb_hash(inputtext) == Info[playerid][pKey])
                {
                    InsideMainMenu[playerid] = false;
                    INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                    KillTimer(LoginTimer[playerid]);
                    OnPlayerLogin(playerid);
                }
                else
                {
                    new ip[32];
                    new titlestring[64];
                    GetPlayerIp(playerid, ip, 32);
                    format(titlestring, sizeof(titlestring), "{FF8000}Login: {FFFFFF}%s", GetPlayerNameEx(playerid));
                    format(string, sizeof(string), "{FFFFFF}Direccion IP: %s\nBienvenido de nuevo!\nIngresa tu contraseсa para conectarte al servidor.\n\n{FF8000}Contraseсa:", ip);
                    SafeDialogEx(playerid,DLOGIN,DIALOG_STYLE_PASSWORD ,titlestring,string,"Entrar","Salir");
                    SetPlayerVirtualWorld(playerid, 20);
                    return 1;
                }
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GENERAL, "Fuiste expulsado del servidor automбticamente.");
                Kick(playerid);
            }
            return 1;
        }
How can I fix it? What am I doing wrong? Thanks
Reply
#2

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

Quote:
Originally Posted by Jefff
Посмотреть сообщение
It worked, thank you. Now I've another problem.
When I register with my account, I type the password. When I see my user file, the password isn't stored. The password is 0, don't matter what I type, it continues being 0.

Parts of code:
pawn Код:
case DREGISTER:
        {
            if (response == 1)
            {
                if(strlen(inputtext) > 24)
                {
                    new ip[32];
                    new titlestring[64];
                    GetPlayerIp(playerid, ip, 32);
                    format(titlestring, sizeof(titlestring), "{FF8000}Error: {FFFFFF}%s", GetPlayerNameEx(playerid));
                    format(string, sizeof(string), "{FFFFFF}Contraseсa con un mбximo de 24 carбcteres!\n\n%s Ingresa una contraseсa valida para registrarte en el servidor:\n\n{FF8000}Contraseсa:", GetPlayerNameEx(playerid));
                    SafeDialogEx(playerid,DREGISTER,DIALOG_STYLE_PASSWORD ,titlestring,string,"Registrar","Salir");
                    SetPlayerVirtualWorld(playerid, 20);
                    return 1;
                }
                if(isnull(inputtext))
                {
                    new ip[32];
                    new titlestring[64];
                    GetPlayerIp(playerid, ip, 32);
                    format(titlestring, sizeof(titlestring), "{FF8000}Registro: {FFFFFF}%s", GetPlayerNameEx(playerid));
                    format(string, sizeof(string), "Bienvenido a CZ Roleplay, para registrarte, ingresa\nuna contraseсa (segura):");
                    SafeDialogEx(playerid,DREGISTER,DIALOG_STYLE_PASSWORD,titlestring,string,"Registrar","Salir");
                    return 1;
                }
                InsideMainMenu[playerid] = false;
                OnPlayerRegister(playerid, inputtext);
                KillTimer(LoginTimer[playerid]);
                return 1;
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GENERAL, "Fuiste expulsado del servidor automбticamente.");
                Kick(playerid);
            }
            return 1;
        }
And this one:
pawn Код:
function OnPlayerRegister(playerid, inputtext[])
{
    if(IsPlayerConnected(playerid))
    {
        new passita[24];
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
     /* Here can be the bug*/   format(passita, sizeof(passita), "%s", inputtext);
        /* I belive here is the bug */INI_WriteString(File,"Password", passita); //udb INI_WriteInt(File,"Password",udb_hash(password));
        INI_Close(File);
        TotalRegister++;
        SendClientMessageEx(playerid, COLOR_YELLOW, "Cuenta registrada, se ha iniciado sesiуn automбticamente.");
        OnPlayerLogin(playerid);
    }
    return 1;
}
I think the bug is in the second.

Thank you. Where is the bug?
Reply
#4

Ever heard about debugging? Use printf() to see if the password is printing.
Reply
#5

Quote:
Originally Posted by iZN
Посмотреть сообщение
Ever heard about debugging? Use printf() to see if the password is printing.
I've tried it. But in the console the password is printed, but not in the user file


The problem is in
Код:
INI_WriteString(File,"Password", passita); //udb INI_WriteInt(File,"Password",udb_hash(password));
:S

Can anyone tell me why?
pawn Код:
function OnPlayerRegister(playerid, inputtext[])
{
    if(IsPlayerConnected(playerid))
    {
        new passita[24];
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
        format(passita, sizeof(passita), "%s", inputtext);
        printf(passita);
        INI_WriteString(File,"Password", passita); //udb INI_WriteInt(File,"Password",udb_hash(password));
        INI_Close(File);
        TotalRegister++;
        SendClientMessageEx(playerid, COLOR_YELLOW, "Cuenta registrada, se ha iniciado sesiуn automбticamente.");
        OnPlayerLogin(playerid);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)