Giter Club home page Giter Club logo

Comments (17)

PT-Player avatar PT-Player commented on July 18, 2024

I think is connected with this: https://github.com/Misiur/YSI-Includes/issues/45

the "response" stop works right?

from ysi-includes.

 avatar commented on July 18, 2024

In my case the function is not being called correctly when I restart my server is orm_select_inline.

I made a simple debug to see where the problem was. When I turn on my server and I make the record all debugs are called, but when I restart the server, only (debug 1) is called.

See an example of the code.

enum E_PLAYER {
    ORM:ormID,
    name[MAX_PLAYER_NAME]
} new Player[MAX_PLAYERS][E_PLAYER];

LoadPlayer(playerid) {

    new ORM:ormid = Player[playerid][ormID] = orm_create("exemple");
    orm_addvar_string(ormid, Player[playerid][name], MAX_PLAYER_NAME, "name");
    orm_setkey(ormid, "name");

    print("debug 1 OK!");
    inline InformationLoad(pid) {

        switch(orm_errno(Player[pid][ormID])) {

            // user does not exist
            case ERROR_NO_DATA: {
                print("debug 2 OK!");
            }

            // user exists
            case ERROR_OK: {
                print("debug 3 OK!");
            }
        }
    }
    // This function isn't called when the server is restarted
    orm_select_inline(ormid, using inline InformationLoad, "d", playerid);
}

from ysi-includes.

PatrickGTR avatar PatrickGTR commented on July 18, 2024

I am experiencing this problem as well after GMX, inline functions doesn't respond right. Dialogs aqre shown but the dialogs aren't functioning properly.

''RetrievePlayerData(playerid)
{
new
SQLRow:rowid = yoursql_get_row(serverDB, TABLE_ACCOUNTS, ""COLUMN_NAME" = %s", PlayerName(playerid)), string[128];

if(rowid != SQL_INVALID_ROW)
{
    inline dialogLogin(pid, dialogid, response, listitem, string:inputtext[])
    {
        #pragma unused pid, dialogid, response, listitem, inputtext

        if(!response)
        {
            Kick(playerid);
            return 1;
        }

        yoursql_get_field(serverDB, ""TABLE_ACCOUNTS"/"COLUMN_PASS"", rowid, playerData[playerid][pPassword], MAX_PASSWORD);

        new password[MAX_PASSWORD];
        SHA256_PassHash(inputtext, PASSWORD_HASH, password, sizeof(password));

        if(!inputtext[0] || strcmp(password, playerData[playerid][pPassword]))
        {
            MsgTag(playerid, TYPE_ERROR, "The password doesn't match with the account's password.");
            goto showRDIALOG;
            return 1;
        }

        yoursql_multiget_fields(serverDB, TABLE_ACCOUNTS, rowid, "iiii", 
            COLUMN_ADM, playerData[playerid][pAdmin], COLUMN_CLASS, playerData[playerid][pJob], COLUMN_KILLS, playerData[playerid][pKills], COLUMN_DEATHS, playerData[playerid][pDeaths]);

        rowid = yoursql_get_row(serverDB, TABLE_ITEMS, ""COLUMN_NAME" = %s", PlayerName(playerid));

        #if defined ACCOUNT_DEBUG   
            printf("[LOADING %s's DATA] - TABLE: %s - ACC ID: %i, ", PlayerName(playerid), TABLE_ACCOUNTS, _:rowid);
            printf("COLUMN_%s: %i - COLUMN_%s: %i", COLUMN_ADM, playerData[playerid][pAdmin], COLUMN_ADM, GetPlayerJob(playerid));
            printf("COLUMN_%s: %i - COLUMN_%s: %i", COLUMN_KILLS, playerData[playerid][pKills], COLUMN_DEATHS, playerData[playerid][pDeaths]);
        #endif

        yoursql_multiget_fields(serverDB, TABLE_ITEMS, rowid, "iiiii", 
            COLUMN_WEED, playerItems[playerid][pWeed], COLUMN_CRACK, playerItems[playerid][pCrack], COLUMN_ROPE, playerItems[playerid][pRope], COLUMN_PICKLOCK, playerItems[playerid][pPickLock], COLUMN_SCISSORS, playerItems[playerid][pScissors]);

        #if defined ACCOUNT_DEBUG
            printf("[LOADING %s's DATA] - TABLE: %s - ACC ID: %i, ", PlayerName(playerid), TABLE_ITEMS, _:rowid);
            printf("COLUMN_%s: %i - COLUMN_%s: %i", COLUMN_WEED, GetPlayerWeed(playerid), COLUMN_CRACK, GetPlayerCrack(playerid));
            printf("COLUMN_%s: %i - COLUMN_%s: %i", COLUMN_ROPE, GetPlayerRope(playerid), COLUMN_PICKLOCK, GetPlayerPickLock(playerid));
            printf("COLUMN_%s: %i", COLUMN_SCISSORS, GetPlayerScissors(playerid));
        #endif
        MessageBoxF(playerid, TYPE_MSGBOX, "~g~Welcome back!", "You have successfully logged in your account, enjoy playing!");



        playerData[playerid][pLoggedIn] = true;
    }

    showRDIALOG:
    format(string, sizeof(string), "Welcome back %p!\nPlease insert your password to continue:", playerid);
    Dialog_ShowCallback(playerid, using inline dialogLogin, DIALOG_STYLE_PASSWORD, "User Account", string, "Login", "Cancel");

}
else
{
    inline dialogRegister(pid, dialogid, response, listitem, string:inputtext[])
    {
        #pragma unused pid, dialogid, response, listitem, inputtext


        if(!response)
        {
            Kick(playerid);
            return 1;
        }
        if(!inputtext[0] || strlen(inputtext) < 4 || strlen(inputtext) > 50)
        {
            MsgTag(playerid, TYPE_ERROR, "Your password must be between 4 - 50 characters.");
            goto showLDIALOG;
            return 1;
        }

        yoursql_set_row(serverDB, TABLE_ACCOUNTS, ""COLUMN_NAME" = %s", PlayerName(playerid));
        yoursql_set_row(serverDB, TABLE_ITEMS, ""COLUMN_NAME" = %s", PlayerName(playerid)); 

        rowid = yoursql_get_row(serverDB, TABLE_ACCOUNTS, ""COLUMN_NAME" = %s", PlayerName(playerid));

        new password[MAX_PASSWORD];
        SHA256_PassHash(inputtext, PASSWORD_HASH, password, sizeof(password));

        yoursql_set_field(serverDB, ""TABLE_ACCOUNTS"/"COLUMN_PASS"", rowid, password);

        #if defined ACCOUNT_DEBUG
            printf("Account Created. Account ID: %i - Account Name: %s", _:rowid, PlayerName(playerid));
        #endif

        MessageBoxF(playerid, TYPE_MSGBOX, "~g~Welcome!", "You have successfully registered your account in the server.");

        playerData[playerid][pLoggedIn] = true;
    }

    showLDIALOG:
    format(string, sizeof(string), "Welcome %p!\nYou are not recognized on our database, please insert a password to sing-in and continue:", playerid);
    Dialog_ShowCallback(playerid, using inline dialogRegister, DIALOG_STYLE_PASSWORD, "User Account", string, "Register", "Cancel");
}
return 1;

}''

from ysi-includes.

Crayder avatar Crayder commented on July 18, 2024

You are getting malloc errors in the log right? After GMX?

from ysi-includes.

PatrickGTR avatar PatrickGTR commented on July 18, 2024

I am not getting any malloc errors after gmx. No errors at all, it just doesn't act right.

from ysi-includes.

Crayder avatar Crayder commented on July 18, 2024

Well, I get a bunch of y_malloc errors, then it doesn't work right.

Y_Less told me the errors shouldn't really affect me in my situation, but I think they are related to this because I did happen to notice this happening.

from ysi-includes.

 avatar commented on July 18, 2024

I'm using the old version (YSI 3.1) and is working perfectly.
If you are having the same problem use this version (https://github.com/Misiur/YSI) until the bugs are fixed.

from ysi-includes.

Misiur avatar Misiur commented on July 18, 2024

YSI 4 is really different from YSI 3, there's much runtime AMX rewriting involved. It's much faster, but yeah, the problem after GMX is often sighted. I didn't have time to track down what exactly happens during mode restart adn why stuff doesn't work well

from ysi-includes.

 avatar commented on July 18, 2024

Hello, I have the same problem, like PT-Player (https://github.com/Misiur/YSI-Includes/issues/45)
I use only normal dialogs, but I use lot of YSI functions/librairies (hooks, iterate, timers ..etc)

I looked and debug operation of y_dialogs.

line 301 : hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

dialogid is correct when debug is set.

But dialogid is overload dialogid = Dialog_Get(playerid); and equals "-1".
So hook OnDialogResponse return false and stop processus about normal dialog.

It's works for the first normal dialog (logic compared to what is above) but not for others.

I'm not sure it will help you. I use a lot this library so if I can give information and help ..

from ysi-includes.

Y-Less avatar Y-Less commented on July 18, 2024

Add "const" to all "hook" parameters - that's much closer to what they really are.

from ysi-includes.

HxTheDash avatar HxTheDash commented on July 18, 2024

@Y-Less Have any idea of how can fix this bug?

from ysi-includes.

Y-Less avatar Y-Less commented on July 18, 2024

What bug? Given that that is your first time posting in a thread with multiple issues discussed at various points, as well as multiple versions of YSI mentioned. I can't just guess your specific problem.

from ysi-includes.

 avatar commented on July 18, 2024

A bug about ShowPlayerDialog and Dialog_ShowCallback (combined with y_inline). There is a conflict.

from ysi-includes.

PT-Player avatar PT-Player commented on July 18, 2024

@Y-Less we are all talking about YSI 4.0 now..

from ysi-includes.

HxTheDash avatar HxTheDash commented on July 18, 2024

YSI 4.0

After restart my server(GMX) not work anymore

public OnPlayerConnect(playerid) {
    test_bug_inline(playerid);
    return 1;
}

stock test_bug_inline(playerid) {

    inline testInline(pid, dialogid, response, listtiem, string:inputtext[]) {
        #pragma unused dialogid, response, listtiem, inputtext
        SendClientMessage(pid, -1, "CALLED, OK!");
    }

    Dialog_ShowCallback(playerid, using inline testInline, DIALOG_STYLE_MSGBOX, "Test", "Test One", "OK", "OK");
}

from ysi-includes.

HxTheDash avatar HxTheDash commented on July 18, 2024

UP

from ysi-includes.

Y-Less avatar Y-Less commented on July 18, 2024

Hopefully fixed by #101 when using YSI_NO_HEAP_MALLOC as a compile-time setting. This reverts y_malloc to the old style of using a huge array instead of the heap, but will increase compile times and file sizes.

from ysi-includes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.