SA-MP Forums Archive
pinlogin - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: pinlogin (/showthread.php?tid=201566)



pinlogin - razvanel - 21.12.2010

How can I do, when I type /pinlogin to check if the pin code is true?
pawn Код:
if (strcmp(cmd, "/pinlogin", true) ==0 )
    {
        if(IsPlayerConnected(playerid))
        {
            new tmppass[64];
            if(Loggedpin[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "You are already logged in your bank account.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD5, "USAGE: /pinlogin [PINCODE]");
                return 1;
            }
            Loggedpin[playerid] = 1;
            SendClientMessage(playerid, COLOR_GRAD5, "You have logged in !");
            return 1;
        }
        return 1;
    }



Re: pinlogin - akis_tze - 21.12.2010

You have many pin codes or one??


Re: pinlogin - razvanel - 21.12.2010

just one.. do you need the registerpin command?


Re: pinlogin - akis_tze - 21.12.2010

Do something like that
pawn Код:
if(PinCode == HereSetYourPinCode)
{
    Loggedpin[playerid] = 1;
    SendClientMessage(playerid, COLOR_GRAD5, "You have logged in !");
    return 1;
}
else
{
    SendClientMessage(playerid, COLOR_GRAD5, "Wrong PIN !");
    return 1;
}



Re: pinlogin - razvanel - 21.12.2010

error 033: array must be indexed (variable "tmp")
pawn Код:
if (strcmp(cmd, "/pinlogin", true) ==0 )
    {
        if(IsPlayerConnected(playerid))
        {
            new tmppass[64];
            if(Loggedpin[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "You are already logged in your bank account.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD5, "USAGE: /pinlogin [PINCODE]");
                return 1;
            }
            if(tmp == PlayerInfo[playerid][pCode])
            {
                Loggedpin[playerid] = 1;
                SendClientMessage(playerid, COLOR_GRAD5, "You have logged in !");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD5, "Wrong PIN !");
                return 1;
            }
        }
        return 1;
    }



Re: pinlogin - Larsey123IsMe - 21.12.2010

pawn Код:
new tmppass[64];
to

pawn Код:
new tmp[64];



Re: pinlogin - silver9600 - 21.12.2010

It's just my noob sight of view, but what if you change

pawn Код:
if(tmp == PlayerInfo[playerid][pCode])
in

pawn Код:
if(strval(tmp) == PlayerInfo[playerid][pCode])
?