Eject Player If 'No' is selected, how do i ? -
English-Conceptz - 24.11.2011
Hi there guys/gals
ive got this case :
Код:
case DIALOG_VEHICLE_BUY:
{
new vehicleid = GetPVarInt(playerid, "DialogValue1");
new caption[32], info[256];
format(caption, sizeof(caption), "Vehicle ID %d", vehicleid);
format(info, sizeof(info), "This vehicle is for sale ($%d)\nWould you like to buy it?", VehicleValue[vehicleid]);
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, info, "Yes", "No");
}
i want to eject the player from the vehicle if 'No' is selected and wondered how i would go about doing so.
i have tried this
' RemovePlayerFromVehicle(playerid); ' which works ok but it makes the player get out of the vehicle before any dialog button has been pressed, it does however stop then from hijacking.
if you need any other code from my script just ask.
thanks guys
Re: Eject Player If 'No' is selected, how do i ? -
Michael_P - 24.11.2011
if (!response) return RemovePlayerFromVehicle(playerid);
Re: Eject Player If 'No' is selected, how do i ? -
English-Conceptz - 24.11.2011
Quote:
Originally Posted by Michael_P
if (!response) return RemovePlayerFromVehicle(playerid);
|
thanks for the reply however could you be more specific as im still learning to code
i get the concept but implementation is a whole nother thing lol.
Re: Eject Player If 'No' is selected, how do i ? -
[MG]Dimi - 24.11.2011
pawn Код:
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, info, "Yes", "No");
Can't go like that. You have to define dialogid as you did up there. Ex
PHP код:
//vv top of script
#define DIALOG_VEHICLE_SELL_OPTION 1478
//vv same it is now
ShowPlayerDialog(playerid, DIALOG_VEHICLE_SELL_OPTION, DIALOG_STYLE_MSGBOX, caption, info, "Yes", "No");
//vv OnDialogResponse
case DIALOG_VEHICLE_SELL_OPTION:
{
if(!response) return RemovePlayerFromVehicle(playerid);
}
//rest of code
Hope you understood
Re: Eject Player If 'No' is selected, how do i ? -
park4bmx - 24.11.2011
In every single dialog you have a dialog I'd
What that ID does is so you can like check what buttons have been pressed or what list item or input has been chosen for individual dialogs.
So where ever your dialog is that you want to remove the player from when he click No
U shood put an I'd like
8978
Then Under on DialogResponse
You would do what Michael said
pawn Код:
If(dialogid == 8970 && !response) return RemovePlayerFromVehicle(playerid);
As u can see the
if(dialogid == 8970) that's there so the script knows that we want to apply that action to that dialog