Detecting if a player has a dialog open
#1

Some of you may know about the dialog exploit (I just recently learned of its existence thanks to a friend) where one can press F6 to open the chat whilst a dialog is still open. This causes lots of problems, for example, players being able to chat before they've logged in thus being able to pose as an administrator.

Is there any way to detect when a dialog is open, or do I just need to go through every ShowPlayerDialog in my gamemode and add something like DialogOpen[playerid] = 1 (and then DialogOpen = 0 when they respond to the dialog)? Thanks.
Reply
#2

The only way I know of doing it is with a declared global variable, aka the DialogOpen[playerid] = 1 variable, its fairly simple though, you'd just add it as you need it, and OnPlayerText you'd return 0 if DialogOpen[playerid] = 1, its how mute and anti-caps systems work really.
Reply
#3

You can just check if the player is logged in or not when they type a command/something in main chat.

For the dialog:
pawn Код:
ShowPlayerDialogEx(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[])
{
    ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
    DialogOpen[playerid] = 1;
}
(!) Reset "DialogOpen" at the "OnDialogResponse" callback.
And do it on the very top of that callback. ( Dialog[playerid] = 0; )
Should work
Reply
#4

Alright, seems there's no shorter way. Thanks guys.
Reply
#5

Whenever my own players login and need to enter their password, the LoggedIn variable for that player (APlayerData[playerid][LoggedIn]) is still false.

It's only set to true after they input the correct password.

This variable is used everywhere, including chat and commands.

This blocks players to chat or use any command until they have logged in properly.
Also, all of my commands are blocked when they're still in class-selection.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)