Possible Bug: OnDialogResponse
#1

I've tried almost everything to try to get a response from this script from a list dialog, with no luck. Is there a problem with my script, or is this a bug?

Код:
//Bait-Car prototype

#define FILTERSCRIPT

#include <a_samp>

new BC1;
new BC2;
new BC3;
new BC4;
new BC5;
new BC6;

#define DIALOG_BCLIST 750

public OnVehicleDeath(vehicleid, killerid)
{
    DestroyVehicle(BC1);
    DestroyVehicle(BC2);
    DestroyVehicle(BC3);
    DestroyVehicle(BC4);
    DestroyVehicle(BC5);
    DestroyVehicle(BC6);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(IsPlayerAdmin(playerid))
    {
        if (strcmp("/BC", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Commands: Huntley = /BC1 | Turismo = /BC2 | Sultan = /BC3");
            SendClientMessage(playerid, 0x00FFFFFF, "Commands: Buffalo = /BC4 | Patriot = /BC5 | Jetmax (boat) = /BC6 ");
            SendClientMessage(playerid, 0x00FFFFFF, "Commands: /DIS -Disable the Bait-Car's motor, bringing the car to a stop.");
            return 1;
        }
        if (!strcmp("/BCL", cmdtext, true))
        {
            ShowPlayerDialog(playerid,750, DIALOG_STYLE_LIST, "Available Bait-Cars", "Huntley", "Select", "Cancel");
            return 1;
        }
        //I want all this info to be put into the dialog, but I only need the first one fixed as a demo
        /*if (strcmp("/BC1", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car 1 Initiated, find a spot to park it.");
            DestroyVehicle(BC1);
            DestroyVehicle(BC2);
            DestroyVehicle(BC3);
            DestroyVehicle(BC4);
            DestroyVehicle(BC5);
            DestroyVehicle(BC6);
            new Float:x,Float:y,Float:z,Float:a;
            GetPlayerFacingAngle(playerid,a);
            GetPlayerPos(playerid,x,y,z);
            BC1=CreateVehicle(579, x, y, z,a, -1, -1, -1);
            PutPlayerInVehicle(playerid, BC1, 0);
            return 1;
        }
        if (strcmp("/BC2", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car 2 Initiated, find a spot to park it.");
            DestroyVehicle(BC1);
            DestroyVehicle(BC2);
            DestroyVehicle(BC3);
            DestroyVehicle(BC4);
            DestroyVehicle(BC5);
            DestroyVehicle(BC6);
            new Float:x,Float:y,Float:z,Float:a;
            GetPlayerFacingAngle(playerid,a);
            GetPlayerPos(playerid,x,y,z);
            BC2=CreateVehicle(451, x, y, z,a, -1, -1, -1);
            PutPlayerInVehicle(playerid, BC2, 0);
            return 1;
        }
        if (strcmp("/BC3", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car 3 Initiated, find a spot to park it.");
            DestroyVehicle(BC1);
            DestroyVehicle(BC2);
            DestroyVehicle(BC3);
            DestroyVehicle(BC4);
            DestroyVehicle(BC5);
            DestroyVehicle(BC6);
            new Float:x,Float:y,Float:z,Float:a;
            GetPlayerPos(playerid,x,y,z);
            GetPlayerFacingAngle(playerid,a);
            BC3=CreateVehicle(560, x, y, z,a, -1, -1, -1);
            PutPlayerInVehicle(playerid, BC3, 0);
            return 1;
        }
        if  (strcmp("/BC4", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car 4 Initiated, find a spot to park it.");
            DestroyVehicle(BC1);
            DestroyVehicle(BC2);
            DestroyVehicle(BC3);
            DestroyVehicle(BC4);
            DestroyVehicle(BC5);
            DestroyVehicle(BC6);
            new Float:x,Float:y,Float:z,Float:a;
            GetPlayerPos(playerid,x,y,z);
            GetPlayerFacingAngle(playerid,a);
            BC4=CreateVehicle(402, x, y, z,a, -1, -1, -1);
            PutPlayerInVehicle(playerid, BC4, 0);
            return 1;
        }
        if  (strcmp("/BC5", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car 5 Initiated, find a spot to park it.");
            DestroyVehicle(BC1);
            DestroyVehicle(BC2);
            DestroyVehicle(BC3);
            DestroyVehicle(BC4);
            DestroyVehicle(BC5);
            DestroyVehicle(BC6);
            new Float:x,Float:y,Float:z,Float:a;
            GetPlayerPos(playerid,x,y,z);
            GetPlayerFacingAngle(playerid,a);
            BC5=CreateVehicle(470, x, y, z,a, -1, -1, -1);
            PutPlayerInVehicle(playerid, BC5, 0);
            return 1;
        }
        if  (strcmp("/BC6", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car 6 Initiated, find a spot to park it.");
            DestroyVehicle(BC1);
            DestroyVehicle(BC2);
            DestroyVehicle(BC3);
            DestroyVehicle(BC4);
            DestroyVehicle(BC5);
            DestroyVehicle(BC6);
            new Float:x,Float:y,Float:z,Float:a;
            GetPlayerPos(playerid,x,y,z);
            GetPlayerFacingAngle(playerid,a);
            BC6=CreateVehicle(493, x, y, z,a, -1, -1, -1);
            PutPlayerInVehicle(playerid, BC6, 0);
            return 1;
        }
        if (strcmp("/DIS", cmdtext, true)==0)
        {
            SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car Disabled.");
            SetVehicleParamsEx(BC1, 0, 1, 0, 1, 0, 0, 0);
            SetVehicleParamsEx(BC2, 0, 1, 0, 1, 0, 0, 0);
            SetVehicleParamsEx(BC3, 0, 1, 0, 1, 0, 0, 0);
            SetVehicleParamsEx(BC4, 0, 1, 0, 1, 0, 0, 0);
            SetVehicleParamsEx(BC5, 0, 1, 0, 1, 0, 0, 0);
            SetVehicleParamsEx(BC6, 0, 1, 0, 1, 0, 0, 0);
            return 1;
        }*/
    }
    else
    {
        SendClientMessage(playerid, 0x00FFFF, "You must be an admin/police.");
        return 1;
    }
    return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_BCLIST)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid, 0x00FFFFFF, "Bait-Car 1 Initiated, find a spot to park it.");
                    DestroyVehicle(BC1);
                    DestroyVehicle(BC2);
                    DestroyVehicle(BC3);
                    DestroyVehicle(BC4);
                    DestroyVehicle(BC5);
                    DestroyVehicle(BC6);
                    new Float:x,Float:y,Float:z,Float:a;
                    GetPlayerFacingAngle(playerid,a);
                    GetPlayerPos(playerid,x,y,z);
                    BC1=CreateVehicle(579, x, y, z,a, -1, -1, -1);
                    PutPlayerInVehicle(playerid, BC1, 0);
                    return 1;
                }
            }
        }
    }
    return 0;
}
Reply
#2

You are probably already using the same dialog ID in another script (perhaps your gamemode) and thus most likely not returning 0, or you are not returning 0 in the callback in your other script(s) at all (even when no matching code was found).

Quote from wiki:
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.

If the same callback in another script does not return 0, it will never reach this filterscript.
Reply
#3

Quote:
Originally Posted by Thomas.
Посмотреть сообщение
You are probably already using the same dialog ID in another script (perhaps your gamemode) and thus most likely not returning 0, or you are not returning 0 in the callback in your other script(s) at all (even when no matching code was found).

Quote from wiki:


If the same callback in another script does not return 0, it will never reach this filterscript.
Yeah, I was thinking something like that, so I ended up just moving the script to my gamemode.
Reply
#4

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Yeah, I was thinking something like that, so I ended up just moving the script to my gamemode.
Try running your gamemode with no filterscripts on. And check if there is no dialogid 750 in yout gamemode.
Reply
#5

This script seems ok, but maybe once you edited GameMode from GrandLenarc to something elves after you placed some filescripts, I think that's the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)