sina alex Posted November 29, 2022 Posted November 29, 2022 (edited) there i have test a FS to make an interior list with dialog style listitem every thing worked correctly but one part of FS will switch and changed with the main game mode code FS code work and dialogs showed to player this part work correctly - cmd->inlist-> ShowPlayerDialog(playerid, D_IM, DIALOG_STYLE_LIST, "List Interior ha","Manazel", "Entekhab", "Khorooj"); this part work correctly - if dialog id = D_IMand select item 0 and response > ShowPlayerDialog(playerid, D_MANAZEL, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nmamuli\nkuchik", "Entekhab", "Khorooj"); this part is problem!!! - - if dialog id = D_MANAZEL and select item 0 and response > ShowPlayerDialog(playerid, D_MANEMARAT, DIALOG_STYLE_LIST, "List Interior ha","maddog", "Entekhab", "Khorooj"); "exit"); after player choose Emarat on D_MANAZEL dialog,then D_MANEMARAT must showed to player but it wont run and the login wrong password of main GM showed.! there is enum and ondialog response of main GM: enum { DIALOG_UNUSED, DIALOG_LOGIN, DIALOG_REGISTER, }; public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { // Useful for dialogs that contain only information and we do nothing depending on whether they responded or not case DIALOG_LOGIN: { if (!response) return Kick(playerid); new hashed_pass[65]; SHA256_PassHash(inputtext, Player[playerid][Salt], hashed_pass, 65); if (strcmp(hashed_pass, Player[playerid][Password]) == 0) { //correct password, spawn the player ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Login", "You have been successfully logged in.", "Okay", ""); KillTimer(Player[playerid][LoginTimer]); Player[playerid][LoginTimer] = 0; Player[playerid][IsLoggedIn] = true; // spawn the player to their last saved position after login SetSpawnInfo(playerid, NO_TEAM, 0, Player[playerid][X_Pos], Player[playerid][Y_Pos], Player[playerid][Z_Pos], Player[playerid][A_Pos], 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } else { Player[playerid][LoginAttempts]++; if (Player[playerid][LoginAttempts] >= 3) { ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Login", "You have mistyped your password too often (3 times).", "Okay", ""); DelayedKick(playerid); } else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Wrong password!\nPlease enter your password in the field below:", "Login", "Abort"); } } case DIALOG_REGISTER: { if (!response) return Kick(playerid); if (strlen(inputtext) <= 5) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Your password must be longer than 5 characters!\nPlease enter your password in the field below:", "Register", "Abort"); // 16 random characters from 33 to 126 (in ASCII) for the salt for (new i = 0; i < 16; i++) Player[playerid][Salt][i] = random(94) + 33; SHA256_PassHash(inputtext, Player[playerid][Salt], Player[playerid][Password], 65); // sends an INSERT query orm_save(Player[playerid][ORM_ID], "OnPlayerRegister", "d", playerid); } default: return 0; // dialog ID was not found, search in other scripts } return 1; } and there is my target FS code: enum { D_IM, D_MANAZEL, D_MANEMARAT }; public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch (dialogid) { case D_IM: { if(response) { switch(listitem) { case 0 : ShowPlayerDialog(playerid, D_MANAZEL, DIALOG_STYLE_LIST, "List Interior ha","Emarat\nmamuli\nkuchik", "Entekhab", "Khorooj"); } } } case D_MANAZEL: { if(response) { switch(listitem) { case 0 : ShowPlayerDialog(playerid, D_MANEMARAT, DIALOG_STYLE_LIST, "List Interior ha","maddog", "Entekhab", "Khorooj"); } } } case D_MANEMARAT: { if(response) { switch(listitem) { case 0 : Playertptoint(playerid, 1267.663208, -781.323242, 1091.906250, 5); } } } } return 0; } Edited November 29, 2022 by sina alex
Pa4enka Posted November 29, 2022 Posted November 29, 2022 try replace that return 1 in your FS to return 0
sina alex Posted November 29, 2022 Author Posted November 29, 2022 30 minutes ago, Pa4enka said: try replace that return 1 in your FS to return 0 i just re type all codes,first post updated read it please
sina alex Posted November 29, 2022 Author Posted November 29, 2022 i think register system have a problem
Sancky Posted February 15, 2023 Posted February 15, 2023 Most probably is because IDs u are using for dialogs from your mode are same with those in your filterscript, because 'enum' is starting from 0 in both files. I would recommend you to use a dialog processor like y_dialog (from YSI) or easyDialog, will improve your code readability because u will not create a thousand of branches in OnDialogResponse and not risking mix-up of IDs because those dialog handlers are working with public functions to execute the code for dialogs. 1
sina alex Posted February 15, 2023 Author Posted February 15, 2023 On 2/15/2023 at 10:30 PM, Sancky said: Most probably is because IDs u are using for dialogs from your mode are same with those in your filterscript, because 'enum' is starting from 0 in both files. I would recommend you to use a dialog processor like y_dialog (from YSI) or easyDialog, will improve your code readability because u will not create a thousand of branches in OnDialogResponse and not risking mix-up of IDs because those dialog handlers are working with public functions to execute the code for dialogs. thank you for this important tip i will test
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now