View Single Post
Old 04/02/2017, 06:21 PM   #12
Lordzy's Avatar
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,698
Reputation: 1177
Default Re: safeDialogs - Complete protection against spoofed dialog data!

Originally Posted by PrO.GameR View Post
Ah, one of my half-way finished projects. Great to see one released as I never got around finishing mine.

Here's a suggestion for you, thats a huge array sitting somewhere unused until they use dialogs, so use PVars instead.
I didn't consider using PVars because of their slow performance and also I saw no use of having dialog-string over other scripts. I know there are bulk of data unused which is why I've considered using packed strings. I'll be running few benchmarks and switch over PVars if needed. Thanks for suggesting!

Originally Posted by Swedky View Post
Another amazing release! Good job over there Lordz
I'll be looking at the code and tell you if find some bug :P
I'd really be grateful if you find and report them because I haven't tested this include VERY well.

Originally Posted by GoldenLion View Post
The bug is still there. I think it's not possible to fix it as it's impossible to get the whole inputtext.
It'd be really helpful if you're pointing out how or what code brings in the false call of OnDialogSpoof. Because I haven't really worked with dialogs since the release of SA-MP 0.3.7. I've noticed now that false calls would be given only if a header type dialog is shown as empty. I really don't know why'd anyone show an empty header dialog but I assume in situations to show an empty inventory, that might be used. ()

A minor update has been done to this include to prevent false alarms on empty header dialog. This is the code I used right now for testing:
pawn Code:
//testing safeDialogs

#include <a_samp>
#include <safeDialogs>
#include <zcmd>

static const dialogSpoofReasons[][] = {

    {"spoofing dialog ID"},
    {"spoofing list-item"},
    {"spoofing input-text"}

public OnDialogSpoof(playerid, spooftype) {

        tempName[MAX_PLAYER_NAME + 1]

    GetPlayerName(playerid, tempName, sizeof(tempName));
    format(tempString, sizeof(tempString), "%s (ID:%d) has been caught for %s",
        tempName, playerid, dialogSpoofReasons[spooftype]);
    SendClientMessageToAll(-1, tempString);
    print("\a"); //Beep sound.
    return 0;

CMD:showdialog(playerid, params[]) {

        return SendClientMessage(playerid, 0xFF0000FF, "USAGE : /showdialog [type]");
    if(!strcmp(params, "list", true)) {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "DIALOG_STYLE_LIST",
        "Item1\nItem2\nItem3\nItem4", "Select", "Close");
    else if(!strcmp(params, "msgbox", true)) {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "DIALOG_STYLE_MSGBOX",
        "Item1\nItem2\nItem3\nItem4", "Select", "Close");
    else if(!strcmp(params, "header", true)) {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_TABLIST_HEADERS,
, "Select", "Close");
        /*ShowPlayerDialog(playerid, 1, DIALOG_STYLE_TABLIST_HEADERS,
        "Item\tIndex\n", "Select", "Close");*/

    else if(!strcmp(params, "tablist", true)) {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_TABLIST,
, "Select", "Close");
    else if(!strcmp(params, "input", true)) {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "DIALOG_STYLE_INPUT",
        "Input some stuff", "Select", "Close");
    return 1;

Please re-download the latest commit if you're facing issue with empty header dialogs.
Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote