Eject Player If 'No' is selected, how do i ?
#1

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
Reply
#2

if (!response) return RemovePlayerFromVehicle(playerid);
Reply
#3

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.
Reply
#4

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(playeridDIALOG_VEHICLE_SELL_OPTIONDIALOG_STYLE_MSGBOXcaptioninfo"Yes""No");
//vv OnDialogResponse
case DIALOG_VEHICLE_SELL_OPTION:
{
     if(!
response) return RemovePlayerFromVehicle(playerid);
}
//rest of code 
Hope you understood
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)