SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/09/2017, 01:26 AM   #1
SetPlayerNameTag
Big Clucker
 
SetPlayerNameTag's Avatar
 
Join Date: Jan 2015
Location: Killerchina
Posts: 168
Reputation: 3
Default Check if the player is using Dialog

is there a native function to do this?
SetPlayerNameTag is offline   Reply With Quote
Old 13/09/2017, 01:28 AM   #2
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,772
Reputation: 854
Default Re: Check if the player is using Dialog

Create a boolean variable and set it to "true" whenever you show the player dialog, and set "false" under OnDialogResponse.

So this way, when the value is true, the player is using dialog.
__________________

Follow me on Github: Follow me on Spotify: Donate on Paypal:

Gammix is offline   Reply With Quote
Old 13/09/2017, 01:45 AM   #3
Kane
Gangsta
 
Kane's Avatar
 
Join Date: Sep 2012
Posts: 814
Reputation: 125
Default Re: Check if the player is using Dialog

You could do something like:
PHP Code:
stock ShowPlayerDialogEx(playeriddialogidstylecaption[], info[], button1[], button2[]);
{
    
p_ActiveDialog[playerid] = true;
    
    
ShowPlayerDialog(playeriddialogidstylecaptioninfobutton1button2); 
    return 
1

So you don't have to set their variable during every instance of a dialog being shown.
__________________
Los Santos Roleplay - Developer
@ls-rp.com

Former Beta Tester

Last edited by Kane; 13/09/2017 at 05:05 AM.
Kane is online now   Reply With Quote
Old 13/09/2017, 03:39 AM   #4
SetPlayerNameTag
Big Clucker
 
SetPlayerNameTag's Avatar
 
Join Date: Jan 2015
Location: Killerchina
Posts: 168
Reputation: 3
Default Re: Check if the player is using Dialog

Okay.. no native function, thanks though I'll take this.
SetPlayerNameTag is offline   Reply With Quote
Old 13/09/2017, 04:12 AM   #5
Paulice
Huge Clucker
 
Join Date: Jul 2017
Posts: 424
Reputation: 44
Default Re: Check if the player is using Dialog

Quote:
Originally Posted by Gammix View Post
Create a boolean variable and set it to "true" whenever you show the player dialog, and set "false" under OnDialogResponse.

So this way, when the value is true, the player is using dialog.
Also note that command can be used while a dialog is shown, so whatever you are going to do with this detection you can take that in account.

OFF TOPIC: You're finally out of the game! Took you long enough. So much time wasted in those releases of yours
Paulice is offline   Reply With Quote
Old 13/09/2017, 09:36 AM   #6
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,083
Reputation: 2655
Default Re: Check if the player is using Dialog

You can use this: https://pastebin.com/MG7sgr8V
It's not advanced at all, so I don't mind. I wrote this in 5 minutes a few days ago when I needed something similar. It basically the same idea that Arthur Kane suggested. Provides two API functions:
PHP Code:
IsPlayerDialogOpen(playeriddialogid)
IsAnyPlayerDialogOpen(playerid
__________________
Vince is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check if the player wrote something in dialog ? a1m[z0r] Scripting Help 5 10/04/2017 04:47 PM
Check if player is standing behind other player Riddick94 Scripting Help 3 15/08/2015 08:28 PM
How to check what a player wrote in a dialog Ox1gEN Scripting Help 14 15/08/2014 02:02 PM
Check this (Dialog) OssiBaba Scripting Help 5 25/12/2013 12:38 PM
[DIALOG]How i Create A dialog Whent Player Login To Enter in Dialog The Password donhu789 Scripting Help 8 29/09/2013 08:15 AM


All times are GMT. The time now is 01:12 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.