ShowPlayerDialog Server closed the connection upon "ESC"..
#1

Hi, here's the command under OnPlayerCommandText

pawn Код:
if (strcmp(cmd, "/factions", true) == 0)
    {
        ShowPlayerDialog(playerid, 2580, DIALOG_STYLE_MSGBOX, "Factions", "1. Politia Romana\n2. F.B.I\n3. Garda Nationala\n4. Medicii\n5. Clanul Dragonu\n6. Clanul Camataru\n7. Guvern\n8. Hitman Agency\n9. Reporterii OG\n10. Speed Taxi\n11. Instructorii\n12. Clanul Macelarilor\n13. Clanul Smecherilor\n14. Clanul Capone\n15. Clanul Corsicanu\n16. V.I.P's", "Done", "");
    }
What it's suppose to do is show a list of factions, and then you can press "Done", but some people don't do that and press "ESC", and it shows Server closed the connection.. as if they got kicked.

Any ideas / help?
Reply
#2

We need to see OnDialogResponse for ID 2580. The reason it's doing that is because under if(!response) or an else statement, it's kicking them. Just have to simply remove it.
Reply
#3

pawn Код:
if(dialogid == 2580)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid,-1,DIALOG_STYLE_MSGBOX, "Caption", "Info", "Button1", "Button2");
        }
        if(response)
        {
            ShowPlayerDialog(playerid,-1,DIALOG_STYLE_MSGBOX, "Caption", "Info", "Button1", "Button2");
        }
    }
Reply
#4

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
pawn Код:
if(dialogid == 2580)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid,-1,DIALOG_STYLE_MSGBOX, "Caption", "Info", "Button1", "Button2");
        }
        if(response)
        {
            ShowPlayerDialog(playerid,-1,DIALOG_STYLE_MSGBOX, "Caption", "Info", "Button1", "Button2");
        }
    }
Showing a dialog with the ID of -1 just closes all open dialogs. It could be triggering something inside of the SA:MP client that causes them to be kicked, I've seen that happen before, and I believe there was some anti dialog hacking code implemented last release. I'd recommend just taking out the -1, if they hit the other button (or esc in this case), the dialog is already closed, so there's no worries.
Reply
#5

Ah, thanks very much for the information 2KY, it helped me find the error. One of the else's on the bottom of OnDialogResponse had the coding to kick the player, removing that fixed my problem. I wouldn't have found out without your help to be honest . +1 rep'd.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)