Jump to content

Recommended Posts

Posted

Salut. Am facut un sistem de pin si nu se introduce in baza de date. 
Aici aveti code-ul.

case DIALOG_SETPIN: {
            if(!response) return 1;
            if(!IsNumeric(inputtext)) return SCM(playerid, COLOR_LIGHTBLUE, "Codul tau pin trebuie sa fie format numai din cifre.");
            if(strlen(inputtext) < 4 || strlen(inputtext) > 4) return SCM(playerid, COLOR_LIGHTBLUE, "Codul tau pin trebuie sa fie format din 4 cifre.");
            new pin = strval(inputtext);
            PlayerInfo[playerid][pPin] = pin;
            PlayerInfo[playerid][pPinLogged] = 1;
            format(string, sizeof(string), "Codul tau pin este : %d", pin);
            SCM(playerid, COLOR_LIGHTBLUE, string);
            new query[100];
            format(query, sizeof(query), "UPDATE `users` SET `Pin`=`%d` WHERE `ID`=`%d`", pin, PlayerInfo[playerid][pSQLID]);
            mysql_query(SQL, query);

        }
        case DIALOG_LOGINPIN: {
            if(!response) return 1;
            new pin = strval(inputtext);
            if(PlayerInfo[playerid][pPin] != pin) return SCM(playerid, COLOR_RED, "Cod pin invalid.");
            PlayerInfo[playerid][pPinLogged] = 1;
            SCM(playerid, COLOR_GREEN, "Ai introdus codul pin cu succes.");
        }
        case DIALOG_CHANGEPIN: {
            if(!response) return 1;
            new pin = strval(inputtext);
            if(PlayerInfo[playerid][pPin] != pin) return SCM(playerid, COLOR_RED, "Cod pin invalid.");
            ShowPlayerDialog(playerid, DIALOG_CHANGEPIN+1, DIALOG_STYLE_INPUT, "Changepin", "Scrie mai jos noul tau cod pin.", "Ok", "Cancel");
        }
        case DIALOG_CHANGEPIN+1: {
            if(!response) return 1;
            if(strlen(inputtext) < 4 || strlen(inputtext) > 4) return SCM(playerid, COLOR_LIGHTBLUE, "Codul pin trebuie sa fie format din 4 cifre.");
            if(!IsNumeric(inputtext)) return SCM(playerid, COLOR_LIGHTBLUE, "Codul pin trebuie sa contina doar cifre.");
            new pin = strval(inputtext);
            PlayerInfo[playerid][pPin] = pin;
            format(string, sizeof(string), "Noul tau cod pin este: %d", PlayerInfo[playerid][pPin]);
            SCM(playerid, COLOR_LIGHTBLUE, string);
            new query[100];
            format(query, sizeof(query), "UPDATE `users` SET `Pin`=`%d` WHERE `ID`=`%d`", pin, PlayerInfo[playerid][pSQLID]);
            mysql_query(SQL, query);
        }

Posted

Este sistemul de pin al lui Edison Tuts, incearca sa te mai uiti o data la tutorial.

Daca nu tii se introduce in baza de date, inseamna ca nu ai setat introdus in baza de date Pin, ori nu ai facut la OnPlayerLogin sau WherePlayerLogin sa ia din baza de date si tu ai impriesia ca nu se salveaza.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.