PDA

View Full Version : rescue dialog help


[LHT]Bally
03/09/2011, 07:41 AM
i have this rescue filterscript obviously, but when i type /rescue the dialog comes up but when i click the place i want to go it dont do anything ? i have tried lots of random numbers{AS I WAS TOLD TO DO} any help ???


#include <a_samp>
#include <sscanf2>

#define PoliceRescueDialog 2354
#define TruckersRescueDialog 2356
#define AssistanceRescueDialog 2376
#define BusRescueDialog 2365
#define LIST DIALOG_STYLE_LIST

new teamid;

public OnPlayerCommandText(playerid, cmdtext[])
{
teamid = GetPlayerTeam(playerid);
new command[130], params[130];
if(sscanf(cmdtext, "s[128]s[128]", command, params) != 0)
{
sscanf(cmdtext, "s[128]", command);
}
if(!strcmp("/rescue", command, true, 7))
{
switch(teamid)
{
case 1: // \r\n Adds a new item to the list
{
ShowPlayerDialog(playerid,PoliceRescueDialog,DIALO G_STYLE_LIST,"Choose rescue point","LVPD\r\nSFPD","Rescue","Cancel");
}
case 2:
{
ShowPlayerDialog(playerid,TruckersRescueDialog,DIA LOG_STYLE_LIST,"Choose rescue point","LV TRUCK\r\nWillowfield","Rescue","Cancel");
}

case 3:
{
ShowPlayerDialog(playerid,AssistanceRescueDialog,D IALOG_STYLE_LIST,"Choose rescue point","BlueBerry Garage","Rescue","Cancel");
}
case 4:
{
ShowPlayerDialog(playerid,BusRescueDialog,DIALOG_S TYLE_LIST,"Choose rescue point","LS Bus Depot\r\nLV Bus Terminal","Rescue","Cancel");
}
}
return 1;
}
return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response == 1)
{
if(dialogid == PoliceRescueDialog)
{
switch(listitem)
{
case 0: //Add another 'case' but with +1 id and change the cords/name
{
SetPlayerPos(playerid,2296.7986,2450.9976,10.8203) ;
SetPlayerFacingAngle(playerid,94.1423);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LVPD HQ");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,2296.79885674216534165326,24 50.9976,10.8203);
SetPlayerFacingAngle(playerid,94.1423);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to SFPD HQ");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}

}
}
if(dialogid == TruckersRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,2810.7017,934.2364,10.9766);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LV truckdepot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,1752.7346,-2054.6328,14.0441);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to Willowfield Truck depot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}


}
}
if(dialogid == BusRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,1046.0646,1305.6222,11.0412) ;
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LV Bus Terminal");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,1957.7957,-2214.2544,16.1250);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LS Bus Depot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}


}
}
if(dialogid == AssistanceRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,56.0339,-186.9275,1.8145);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0x00B82EFF,"You have been rescued to BlueBerry Garage");
SendClientMessage(playerid,0x00B82EFF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
return 1;
}
}
}
}
return 0;
}

=WoR=Varth
03/09/2011, 07:43 AM
Do you have any other FS?
Did you return their OnDialogResponse at the end to 0?

[LHT]Bally
03/09/2011, 07:46 AM
no other filterscripts have dialogs, the only other dialogs i have are message boxes for like /rules,/cmds,and there in the gamemode

=WoR=Varth
03/09/2011, 08:01 AM
Debug your code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response == 1)
{
SendClientMesage(playerid,0,"ASD");//Put this

[LHT]Bally
03/09/2011, 08:06 AM
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response == 1)
{
SendClientMesage(playerid,0,"ASD");//Put this <<-- what is the asd for ? and where do i put this ? sorry if im being noobish im new to scripting

iggy1
03/09/2011, 08:09 AM
Return one at the end of OnDialogResponse. Make sure your co-ords are right and that you set the players interior - if that is needed.

EDIT: You add the messages every line (or few) then when you run the code you can see what gets executed, because the message will tell you.

[LHT]Bally
03/09/2011, 08:10 AM
ic hanged it to like this and now the police rescue dont work lol i think i done it totally wrong

#include <a_samp>
#include <sscanf2>

#define PoliceRescueDialog 1000
#define TruckersRescueDialog 1001
#define AssistanceRescueDialog 1003
#define BusRescueDialog 1002
#define LIST DIALOG_STYLE_LIST

new teamid;

public OnPlayerCommandText(playerid, cmdtext[])
{
teamid = GetPlayerTeam(playerid);
new command[130], params[130];
if(sscanf(cmdtext, "s[128]s[128]", command, params) != 0)
{
sscanf(cmdtext, "s[128]", command);
}
if(!strcmp("/rescue", command, true, 7))
{
switch(teamid)
{
case 1: // \r\n Adds a new item to the list
{
ShowPlayerDialog(playerid,PoliceRescueDialog,DIALO G_STYLE_LIST,"Choose rescue point","LVPD\r\nSFPD","Rescue","Cancel");
}
case 2:
{
ShowPlayerDialog(playerid,TruckersRescueDialog,DIA LOG_STYLE_LIST,"Choose rescue point","LV TRUCK\r\nWillowfield\nRock Shore Depot","Rescue","Cancel");
}

case 3:
{
ShowPlayerDialog(playerid,AssistanceRescueDialog,D IALOG_STYLE_LIST,"Choose rescue point","BlueBerry Garage\r\nRock Shore Depot","Rescue","Cancel");
}
case 4:
{
ShowPlayerDialog(playerid,BusRescueDialog,DIALOG_S TYLE_LIST,"Choose rescue point","LS Bus Depot\r\nLV Bus Terminal","Rescue","Cancel");
}
}
return 1;
}
return 0;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response == 1)
{
SendClientMessage(playerid,0,"ASD");//Put this
if(dialogid == PoliceRescueDialog)
{
switch(listitem)
{
case 0: //Add another 'case' but with +1 id and change the cords/name
{
SetPlayerPos(playerid,2296.7986,2450.9976,10.8203) ;
SetPlayerFacingAngle(playerid,94.1423);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LVPD HQ");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,2296.79885674216534165326,24 50.9976,10.8203);
SetPlayerFacingAngle(playerid,94.1423);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to SFPD HQ");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}

}
}
if(dialogid == TruckersRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,2810.7017,934.2364,10.9766);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LV truckdepot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,1752.7346,-2054.6328,14.0441);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to Willowfield Truck depot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 2:
{
SetPlayerPos(playerid,2817.3284,972.9627,10.7500,2 08);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0x00B82EFF,"You have been rescued to Rock Shore Depot");
SendClientMessage(playerid,0x00B82EFF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
return 1;
}


}
}
if(dialogid == BusRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,1046.0646,1305.6222,11.0412) ;
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LV Bus Terminal");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,1957.7957,-2214.2544,16.1250);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LS Bus Depot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}


}
}
if(dialogid == AssistanceRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,56.0339,-186.9275,1.8145);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0x00B82EFF,"You have been rescued to BlueBerry Garage");
SendClientMessage(playerid,0x00B82EFF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
return 1;
}
case 1:
{
SetPlayerPos(playerid,2817.3284,972.9627,10.7500,2 08);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0x00B82EFF,"You have been rescued to Rock Shore Depot");
SendClientMessage(playerid,0x00B82EFF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
return 1;
}
}
}
}
return 0;
}

[LHT]Bally
03/09/2011, 08:12 AM
so at the end of the script instead of it saying return 0; have it saying return 1;

iggy1
03/09/2011, 08:13 AM
Can you see that "return 0" at the end of OnDialogResponse?? Remove it!! (the very last return in he code you posted) I'm sure you should be returning one there. Whether that will help fix the prob IDK.

EDIT: Also the \r is not needed when displaying listitems (since the text aligns to the left auto), try removing that to.

[LHT]Bally
03/09/2011, 08:14 AM
the return 1 dont work and the coords are right and no interior is needed

EDIT* just seen what you said i will try

[LHT]Bally
03/09/2011, 08:17 AM
still didnt work for me

=WoR=Varth
03/09/2011, 08:19 AM
Can you see that "return 0" at the end of OnDialogResponse?? Remove it!! (the very last return in he code you posted) I'm sure you should be returning one there. Whether that will help fix the prob IDK.


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response == 1)
{
SendClientMessage(playerid,0,"ASD");//Put this
if(dialogid == PoliceRescueDialog)
{
switch(listitem)
{
case 0: //Add another 'case' but with +1 id and change the cords/name
{
SetPlayerPos(playerid,2296.7986,2450.9976,10.8203) ;
SetPlayerFacingAngle(playerid,94.1423);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LVPD HQ");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,2296.79885674216534165326,24 50.9976,10.8203);
SetPlayerFacingAngle(playerid,94.1423);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to SFPD HQ");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}

}
}
if(dialogid == TruckersRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,2810.7017,934.2364,10.9766);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LV truckdepot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,1752.7346,-2054.6328,14.0441);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to Willowfield Truck depot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 2:
{
SetPlayerPos(playerid,2817.3284,972.9627,10.7500,2 08);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0x00B82EFF,"You have been rescued to Rock Shore Depot");
SendClientMessage(playerid,0x00B82EFF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
return 1;
}


}
}
if(dialogid == BusRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,1046.0646,1305.6222,11.0412) ;
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LV Bus Terminal");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}
case 1:
{
SetPlayerPos(playerid,1957.7957,-2214.2544,16.1250);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0xFFFF00FF,"You have been rescued to LS Bus Depot");
SendClientMessage(playerid,0xFFFF00FF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
}


}
}
if(dialogid == AssistanceRescueDialog)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,56.0339,-186.9275,1.8145);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0x00B82EFF,"You have been rescued to BlueBerry Garage");
SendClientMessage(playerid,0x00B82EFF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
return 1;
}
case 1:
{
SetPlayerPos(playerid,2817.3284,972.9627,10.7500,2 08);
SetPlayerFacingAngle(playerid,96.8919);
SendClientMessage(playerid,0x00B82EFF,"You have been rescued to Rock Shore Depot");
SendClientMessage(playerid,0x00B82EFF,"Rescue fee: $200");
GivePlayerMoney(playerid, -200);
return 1;
}
}
}
return 1;
}
return 0;
}

He need to return 0 at the end of OnDialogResponse.
http://wiki.sa-mp.com/wiki/OnDialogResponse

[LHT]Bally
03/09/2011, 08:22 AM
it still dont work anything i do :(

iggy1
03/09/2011, 08:23 AM
He need to return 0 at the end of OnDialogResponse.
http://wiki.sa-mp.com/wiki/OnDialogResponse
return 0; // If you put return 1 here the callback will not continue to be called in other scripts
Bloody hell i've never noticed that. The default "new" program should probably return zero there too then.

=WoR=Varth
03/09/2011, 08:26 AM
Can you see that "return 0" at the end of OnDialogResponse?? Remove it!! (the very last return in he code you posted) I'm sure you should be returning one there. Whether that will help fix the prob IDK.

EDIT: Also the \r is not needed when displaying listitems (since the text aligns to the left auto), try removing that to.

Bally;1381780']it still dont work anything i do :(

Do you get "ASD" message?

[LHT]Bally
03/09/2011, 08:28 AM
nope... no message nothing :S really is a wierd thing.

[LHT]Bally
03/09/2011, 08:49 AM
i also get these messages

C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\rescue.pwn(97) : warning 202: number of arguments does not match definition
C:\Documents and Settings\BaLLy\Desktop\LONG HAUL TRUCKING\filterscripts\rescue.pwn(147) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.

[LHT]Bally
03/09/2011, 11:41 AM
ive tried everything everyone has said and more but still no luck , im willing to try anything or even put it into a menu style instead of dialogs, just need some help

Zonoya
03/09/2011, 01:01 PM
Send Me everthing dude the command and the responce ill try again and see wat i can do :)