[Include] GetPlayerDialogID + Anti-DialogHack
#1

GetPlayerDialogID v2

Also, with Anti-DialogHack

Quote:
Originally Posted by wups
View Post
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>
pawn Code:
#include <GPDID>
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.
Reply
#2

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?
Reply
#3

Quote:
Originally Posted by Wesley221
View Post
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
Reply
#4

pawn Code:
static
        bool:GPD_OPC,
        bool:GPD_ODR;
What is this code for?
https://sampwiki.blast.hk/wiki/Funcidx
Reply
#5

Quote:
Originally Posted by varthshenon
View Post
pawn Code:
static
        bool:GPD_OPC,
        bool:GPD_ODR;
What is this code for?
https://sampwiki.blast.hk/wiki/Funcidx
It appears to be used multiple times in the code, so it must be important.
Reply
#6

Quote:
Originally Posted by skullmuncher1337
View Post
It appears to be used multiple times in the code, so it must be important.
What do you mean?
Reply
#7

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.
Reply
#8

Quote:
Originally Posted by wups
View Post
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.
Reply
#9

Can I see some screenshots please?
Reply
#10

Quote:
Originally Posted by RockandRol123 [PH]
View Post
Can I see some screenshots please?
No. You Can't see screenshots of a function.
Reply
#11

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 .
Reply
#12

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".
Reply
#13

What this include do?
Reply
#14

Nice idea, even though I don't realize how would it be useful.
Reply
#15

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.
Reply
#16

Very useful indeed.

"Anti-DialogHack"

What does this mean?
Reply
#17

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).
Reply
#18

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...
Reply
#19

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.
Reply
#20

wtf is dialog hack? Im asking because title is "... + anti dialog hack"
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)