GetPlayerDialogID + Anti-DialogHack -
wups - 16.09.2011
GetPlayerDialogID v2
Also, with Anti-DialogHack
Quote:
Originally Posted by wups
Without this, clients can change their DIALOGID with some specific programs(and for example evade login).
|
I was scripting, and I thought this function would be very useful in some specific cases.
ChangeLog:
Quote:
Version 2:
-Bug fixes.
-Anti DialogHack.
-Using PVars, so filterscript support.
Version 1:
-Initial release.
|
Usage:
Firstly, copy both include files into /pawno/includes
Insert this code on top of your game mode after #include <a_samp>
That's it! You're ready to go. No script modifications are needed, since the script is
Plug&Play.
How to use the function?
pawn Code:
public OnPlayerCommandText(playerid,cmdtext[])
{
new ID = GetPlayerDialogID(playerid);
if(ID != -1) // in case a player sees the dialog
{
SendClientMessage(playerid,-1,"No dialog evading!");
return 0;
}
return 1;
}
Installing:
Download and save to pawn/includes folder!
Download:
Version 2.2
Version 1.0
Feel free to do anything you want with it.
Re: GetPlayerDialogID -
Wesley221 - 16.09.2011
So thsi checks if a player has a dialog opened?
And do you have to use a different function to check if he has a dialog open, or is it just with the normal ShowPlayerDialog?
Re: GetPlayerDialogID -
Raimis_R - 16.09.2011
Quote:
Originally Posted by Wesley221
So thsi checks if a player has a dialog opened?
And do you have to use a different function to check if he has a dialog open, or is it just with the normal ShowPlayerDialog?
|
You need to use:
pawn Code:
GPD_ShowPlayerDialog(playerid,dialogid,style,caption[],info[],button1[],button2[])
Edit: I didnt saw #define ShowPlayerDialog GPD_ShowPlayerDialog
You can use ShowPlayerDialog
Re: GetPlayerDialogID -
=WoR=Varth - 16.09.2011
pawn Code:
static
bool:GPD_OPC,
bool:GPD_ODR;
What is this code for?
https://sampwiki.blast.hk/wiki/Funcidx
Re: GetPlayerDialogID -
skullmuncher1337 - 16.09.2011
Quote:
Originally Posted by varthshenon
|
It appears to be used multiple times in the code, so it must be important.
Re: GetPlayerDialogID -
=WoR=Varth - 16.09.2011
Quote:
Originally Posted by skullmuncher1337
It appears to be used multiple times in the code, so it must be important.
|
What do you mean?
Re: GetPlayerDialogID -
wups - 16.09.2011
Thanks for the responses, It's
Plug&Play. You just use ShowPlayerDialog(no changes in the script are necessary).
pawn Code:
GPD_ODR = (funcidx("GPD_OnDialogResponse") != -1);
About that, I don't have much time to explain, search for some tutorials, i'm pretty sure ****** made at least one about this.
Re: GetPlayerDialogID -
=WoR=Varth - 16.09.2011
Quote:
Originally Posted by wups
Thanks for the responses, It's Plug&Play. You just use ShowPlayerDialog(no changes in the script are necessary).
pawn Code:
GPD_ODR = (funcidx("GPD_OnDialogResponse") != -1);
About that, I don't have much time to explain, search for some tutorials, i'm pretty sure ****** made at least one about this.
|
I got the point now.
Re: GetPlayerDialogID -
RockandRol123 [PH] - 17.09.2011
Can I see some screenshots please?
Re: GetPlayerDialogID -
wups - 17.09.2011
Quote:
Originally Posted by RockandRol123 [PH]
Can I see some screenshots please?
|
No. You Can't see screenshots of a function.
Re: GetPlayerDialogID -
Hiddos - 17.09.2011
Quote:
Originally Posted by CyNiC
A plug and play script, it's good.
|
Most includes are built that way, people are just too ignorant to notice it.
OT: Another great include from you wups, it'll help a lot of people
.
Re: GetPlayerDialogID -
KoczkaHUN - 20.09.2011
If you would use the stored dialogid instead of the passed value, it can be used for anti-dialog hack aswell:
pawn Код:
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
{
new GPD_retval=(GPD_ODR)?CallLocalFunction("GPD_OnDialogResponse","iii",playerid,GPD_pdialog[playerid],response,listitem,inputtext):0;
GPD_pdialog[playerid]=-1;
return GPD_retval;
}
also returning 0 in the callback is assumed in an include like this - you can pass the dialog to other scripts aswell:
Quote:
Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback.
|
also, a friendly idea: if you use PVar (which is slower than static variable) for storing dialog ID, the script will be cross compatible, e.g. in FilterScript1 there is a ShowPlayerDialog with id 1435, you can use GetPlayerDialog in FilterScript2 or in GameMode and it will return 1435.
BTW, good idea.
Edit: also you're doing it wrong with CallLocalFunction. You only pass the first 3 integers, change "iii" to "iiiis".
Re: GetPlayerDialogID -
Edvin - 20.09.2011
What this include do?
Re: GetPlayerDialogID -
[MWR]Blood - 20.09.2011
Nice idea, even though I don't realize how would it be useful.
Re: GetPlayerDialogID -
wups - 21.09.2011
Quote:
Originally Posted by KoczkaHUN
If you would use the stored dialogid instead of the passed value, it can be used for anti-dialog hack aswell:
pawn Код:
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[]) { new GPD_retval=(GPD_ODR)?CallLocalFunction("GPD_OnDialogResponse","iii",playerid,GPD_pdialog[playerid],response,listitem,inputtext):0; GPD_pdialog[playerid]=-1; return GPD_retval; }
also returning 0 in the callback is assumed in an include like this - you can pass the dialog to other scripts aswell:
also, a friendly idea: if you use PVar (which is slower than static variable) for storing dialog ID, the script will be cross compatible, e.g. in FilterScript1 there is a ShowPlayerDialog with id 1435, you can use GetPlayerDialog in FilterScript2 or in GameMode and it will return 1435.
BTW, good idea.
Edit: also you're doing it wrong with CallLocalFunction. You only pass the first 3 integers, change "iii" to "iiiis".
|
Thanks for the reports, fixed the bugs and added your suggestions!
Quote:
Originally Posted by Edvin
What this include do?
|
It returns the dialogid, of the currently showed dialog for the player.
Quote:
Originally Posted by [MWR]Blood
Nice idea, even though I don't realize how would it be useful.
|
I wrote an example in the first page.
Re: GetPlayerDialogID -
Lorenc_ - 21.09.2011
Very useful indeed.
"Anti-DialogHack"
What does this mean?
Re: GetPlayerDialogID -
wups - 21.09.2011
Quote:
Originally Posted by Lorenc_
Very useful indeed.
"Anti-DialogHack"
What does this mean?
|
Client's can change their DIALOGID with some specific programs(and for example evade login).
Re: GetPlayerDialogID -
Edvin - 21.09.2011
Quote:
Originally Posted by wups
Thanks for the reports, fixed the bugs and added your suggestions!
It returns the dialogid, of the currently showed dialog for the player.
I wrote an example in the first page.
|
Very nice...
Re: GetPlayerDialogID -
Y_Less - 21.09.2011
Quote:
Originally Posted by wups
Thanks for the responses, It's Plug&Play. You just use ShowPlayerDialog(no changes in the script are necessary).
pawn Код:
GPD_ODR = (funcidx("GPD_OnDialogResponse") != -1);
About that, I don't have much time to explain, search for some tutorials, i'm pretty sure Y_Less made at least one about this.
|
For other people's reference, it's a standard system called "ALS" which was designed a while ago and has pretty good support from library writers* to allow for compatibility and transparency in libraries (so you can use this, command processors, streamers etc together without them conflicting (in some ways) and without modifying existing modes.
*Now anyway, took a while to get noticed and picked up more.
Re: GetPlayerDialogID + Anti-DialogHack -
BaubaS - 21.09.2011
wtf is dialog hack? Im asking because title is "... + anti dialog hack"