PDA

View Full Version : Dialog response not Sending Message [Input Dialog]


Deal-or-die
08/05/2012, 12:28 PM
Hey,
Ugh.. been working on this for a while now and just can't seem to work out why my dialogs aren't sending the player a message after the valid input into the Input dialog, Here is what I have so far....


.
case 166: //How many rooms?
{
if(!response) return 1;
if(response)
{
new room;
sscanf(inputtext, "d", room);
if(room < 1 || room > MAX_ROOMS) return format(string, sizeof(string), "You selected %s Rooms", room);
else
{
format(string, sizeof(string), "Please select a value of rooms between 1 and %s", MAX_ROOMS);
}
}
}


Any Ideas...?

Cheers in advance.

TzAkS.
08/05/2012, 12:29 PM
format(string, sizeof(string), "You selected %s Rooms", room);
return SendClientMessage(playerid, -1, string);


format(string, sizeof(string), "Please select a value of rooms between 1 and %s", MAX_ROOMS);
SendClientMessage(playerid, -1, string);

Jonny5
08/05/2012, 12:30 PM
just guessing here

if(room < 1 || room > MAX_ROOMS) return format(string, sizeof(string), "You selected %s Rooms", room);

to

if(room > 0 || room < MAX_ROOMS) return format(string, sizeof(string), "You selected %s Rooms", room);




edit:

and yes your not useing SendClientMessage like stated above.

iggy1
08/05/2012, 12:39 PM
Make sure your scripts all return zero at the end of "OnDialogResponse". If for example your GM returns 1 at the end of the callback, your dialogs in your filterscripts wont execute correct.

In the new.pwn that comes with the server, OnDialogResponse should really look like this.

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 0;
}

It's OK to return other values if the dialog is found. Because all dialogids should be unique.
EG,
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0)
{
return 1;
}

return 0;
}

Not sure f this is your problem but it's a very common mistake. What usually happens is, when you respond to the dialog it closes the dialog and nothing else.

EDIT: I never read the whole thread nor did i look at your code, my bad. Ill not delete this because someone else might have this problem.

Deal-or-die
08/05/2012, 12:53 PM
format(string, sizeof(string), "You selected %s Rooms", room);
return SendClientMessage(playerid, -1, string);


format(string, sizeof(string), "Please select a value of rooms between 1 and %s", MAX_ROOMS);
SendClientMessage(playerid, -1, string);


Hmm.. okay i tried this and it worked... but the string isn't printing correctly as an example...
I typed "6" and it showed
http://www.vs-rp.com/sa-mp-119.png

Then i typed "666" and it showed
http://www.vs-rp.com/sa-mp-120.png

just guessing here

if(room < 1 || room > MAX_ROOMS) return format(string, sizeof(string), "You selected %s Rooms", room);

to

if(room > 1 || room < MAX_ROOMS) return format(string, sizeof(string), "You selected %s Rooms", room);




edit:

and yes your not useing SendClientMessage like stated above.

Ahh cheers for your help but it's kind of not what i am after :P

Make sure your scripts all return zero at the end of "OnDialogResponse". If for example your GM returns 1 at the end of the callback, your dialogs in your filterscripts wont execute correct.

In the new.pwn that comes with the server, OnDialogResponse should really look like this.

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 0;
}

It's OK to return other values if the dialog is found. Because all dialogids should be unique.
EG,
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0)
{
return 1;
}

return 0;
}

Not sure f this is your problem but it's a very common mistake. What usually happens is, when you respond to the dialog it closes the dialog and nothing else.

Yea, thanks for your help, but i am not using it as a filter script, but I will keep it in mind, Cheers

So basically it is not printing correctly
I type '6' and it shows
http://www.vs-rp.com/sa-mp-119.png

I type '666' and it shows
http://www.vs-rp.com/sa-mp-120.png

TzAkS.
08/05/2012, 12:55 PM
Use %d for numbers

Deal-or-die
08/05/2012, 01:00 PM
Use %d for numbers

Ahh true, thanks a lot.

Now for trying to get NPCs to connect -.- They connect just stay about 15 seconds then quit -.-


But thank you everyone that gave me support in this, greatly appreciated

iggy1
08/05/2012, 01:03 PM
Now for trying to get NPCs to connect -.- They connect just stay about 15 seconds then quit -.-


Have you done this at the top of all callbacks/funcs that might interfere with bots? Like register systems ect.

public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))return 1;


//blah blah rest of code

return 1;
}

Deal-or-die
08/05/2012, 01:10 PM
Have you done this at the top of all callbacks/funcs that might interfere with bots? Like register systems ect.

public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))return 1;


//blah blah rest of code

return 1;
}

Ehh... If these are the only ones that may interfere,
'OnPlayerConnect, OnPlayerRequestClass, OnPlayerSpawn and OnPlayerRequestSpawn'
Then Yes i have... :/
The rest of my dialogs i am pretty sure i have also covered :/