PDA

View Full Version : Eject Player If 'No' is selected, how do i ?


English-Conceptz
24/11/2011, 03:16 AM
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 :)

Michael_P
24/11/2011, 04:02 AM
if (!response) return RemovePlayerFromVehicle(playerid);

English-Conceptz
24/11/2011, 05:10 AM
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.

[MG]Dimi
24/11/2011, 06:30 AM
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 //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

park4bmx
24/11/2011, 06:32 AM
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

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 ;)