25.08.2015, 19:13
(
Последний раз редактировалось Nixtren; 28.08.2015 в 14:07.
)
SpooflessDialogs
Here is an include that I had originally made for personal use, and I can also say that it is my first include. His job is to prevent cheaters to do dialog spoofing.
What is dialog spoofing?
Dialog spoofing is the name given to the act of responding to dialogs that the server didn't send.
Example of a case of dialog spoofing
Imagine you have a dialog (ID 30) with the message "Press OK to get $100 for free", and you only show that dialog once for that player (for example, during the registration). A cheater could answer to that dialog as many times he wished. Here's what would happen:
- Cheater receives dialog ID 30 (during registration)
- Cheater answers to dialog ID 30 (during registration)
- Cheater answers to dialog ID 30
- Cheater answers to dialog ID 30
- Cheater answers to dialog ID 30
It's not normal for someone to do dialog spoofing, since rare are the times you can actually take advantage of it, it largely depends on your script. However, it's possible.
This include works by hooking OnDialogResponse and the function ShowPlayerDialog. He saves the ID you use in ShowPlayerDialog and compares it in OnDialogResponse.
Optional callbacks (to put in your GameMode)
Код:
public OnDialogSpoof(playerid, dialogid, SpooflessDialogs_dialogid) { // What do you want to do with the cheater? Ban? Kick? return 0; // Prevent dialog spoof }
In your GameMode:
Код:
#include <YSI\y_hooks> #include <nhooks> #include <SpooflessDialogs> // Put this line before any includes that make use of dialogs
Код:
#define FILTERSCRIPT #include <YSI\y_hooks> #include <nhooks> #include <SpooflessDialogs> // Put this line before any includes that make use of dialogs

Edit: Dialog spoofing is not completly patched in SA-MP, see this post for more details.