spawn menu
#1

hello i have 2 problems with my carspawn dialog menu.
1. As i spawn a car its around me. but i want that as i spawn the car that the player is in the car.

And

2. As the car explodes it will respawn at the place where the car is spawned. but i want as it explodes or something that the car is gone.

here is my OnDialogResponse code:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	GetPlayerPos(playerid, X, Y, Z);
	GetPlayerFacingAngle(playerid, Angle);
	pInt = GetPlayerInterior(playerid);
	if(dialogid == DIALOG_CAR_1)
	{
	    if(response)
	    {
			switch(listitem)
			{
		        case 0:   // Admiral
		        {
		            CreateVehicle(445, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
		            SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Admiral, look around as you don't see the car!");
				}
				case 1:   // Alpha
				{
				    CreateVehicle(602, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Alpha, look around as you don't see the car!");
				}
				case 2:   // Baggage
				{
				    CreateVehicle(485, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Baggage, look around as you don't see the car!");
				}
				case 3:   // Bandito
				{
				    CreateVehicle(568, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Bandito, look around as you don't see the car!");
				}
				case 4:   // Banshee
				{
				    CreateVehicle(429, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Banshee, look around as you don't see the car!");
				}
				case 5:   // Damaged Glendale
				{
				    CreateVehicle(604, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Damaged Glendale, look around as you don't see the car!");
				}
				case 6:   // Damaged Sadle
				{
				    CreateVehicle(605, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Damaged Sadle, look around as you don't see the car!");
				}
				case 7:   // BF Injection
				{
				    CreateVehicle(424, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a BF Injection, look around as you don't see the car!");
				}
				case 8:   // Blade
				{
				    CreateVehicle(536, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Blade, look around as you don't see the car!");
				}
				case 9:   // Blista Compact
				{
				    CreateVehicle(496, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Blista Compact, look around as you don't see the car!");
				}
				case 10:  // Bloodring Banger
				{
				    CreateVehicle(504, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Bloodring Banger, look around as you don't see the car!");
				}
				case 11:  //Bobcat
				{
				    CreateVehicle(422, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Bobcat, look around as you don't see the car!");
				}
				case 12:  // Bravura
				{
				    CreateVehicle(401, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Bravura, look around as you don't see the car!");
				}
				case 13:  // Broadway
				{
				    CreateVehicle(575, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Broadway, look around as you don't see the car!");
				}
				case 14:  // Buccaneer
				{
				    CreateVehicle(518, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Buccaneer, look around as you don't see the car!");
				}
				case 15:  // Buffalo
				{
				    CreateVehicle(402, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Buffalo, look around as you don't see the car!");
				}
				case 16:  // Bullet
				{
					CreateVehicle(541, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
					SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Bullet, look around as you don't see the car!");
				}
				case 17:  // Caddy
				{
				    CreateVehicle(457, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Caddy, look around as you don't see the car!");
				}
				case 18:  // Cadrona
				{
				    CreateVehicle(527, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Cadrona, look around as you don't see the car!");
				}
				case 19:  // Camper
				{
				    CreateVehicle(483, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Camper, look around as you don't see the car!");
				}
				case 20:  // Cheetah
				{
				    CreateVehicle(415, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
	                SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Cheetah, look around as you don't see the car!");
				}
				case 21:  // Clover
				{
				    CreateVehicle(542, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Clover, look around as you don't see the car!");
				}
				case 22:  // Club
				{
				    CreateVehicle(589, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Club, look around as you don't see the car!");
				}
				case 23:  // Comet
				{
				    CreateVehicle(480, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Comet, look around as you don't see the car!");
				}
				case 24:  // Elegant
				{
				    CreateVehicle(507, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Elegant, look around as you don't see the car!");
				}
				case 25:  // Elegy
				{
				    CreateVehicle(562, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Elegy, look around as you don't see the car!");
				}
				case 26:  // Emperor
				{
				    CreateVehicle(585, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Emperor, look around as you don't see the car!");
				}
				case 27:  // Esperanto
				{
					CreateVehicle(419, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
					SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Esperanto, look around as you don't see the car!");
				}
				case 28:  // Euros
				{
				    CreateVehicle(587, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Euros, look around as you don't see the car!");
				}
				case 29:  // Feltzer
				{
				    CreateVehicle(533, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Feltzer, look around as you don't see the car!");
				}
				case 30:  // Flash
				{
				    CreateVehicle(565, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Flash, look around as you don't see the car!");
				}
				case 31:  // Fortune
				{
				    CreateVehicle(526, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Fortune, look around as you don't see the car!");
				}
			}
		}
		else SendClientMessage(playerid,0xff0000FF,"Cancelled");
	}
	GetPlayerPos(playerid, X, Y, Z);
	GetPlayerFacingAngle(playerid, Angle);
	pInt = GetPlayerInterior(playerid);
	if(dialogid == DIALOG_CAR_2)
	{
	    if(response)
	    {
			switch(listitem)
			{
		        case 0:   // Glendale
		        {
		            CreateVehicle(466, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
		            SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Glendale, look around as you don't see the car!");
				}
				case 1:   // Greenwood
				{
				    CreateVehicle(492, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Greenwood, look around as you don't see the car!");
				}
				case 2:   // Hermes
				{
				    CreateVehicle(474, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Hermes, look around as you don't see the car!");
				}
				case 3:   // Hotknife
				{
				    CreateVehicle(434, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Hotknife, look around as you don't see the car!");
				}
				case 4:   // Hotring Racer
				{
				    CreateVehicle(502, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Hotring Racer, look around as you don't see the car!");
    			}
				case 5:   // Huntley
				{
				    CreateVehicle(579, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Huntley, look around as you don't see the car!");
				}
				case 6:   // Hustler
				{
				    CreateVehicle(545, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Hustler, look around as you don't see the car!");
				}
				case 7:   // Infernus
				{
				    CreateVehicle(411, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Infernus, look around as you don't see the car!");
				}
				case 8:   // Intruder
				{
				    CreateVehicle(546, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Intruder, look around as you don't see the car!");
				}
				case 9:   // Jester
				{
				    CreateVehicle(559, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Jester, look around as you don't see the car!");
				}
				case 10:  // Kart
				{
				    CreateVehicle(571, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Kart, look around as you don't see the car!");
				}
				case 11:  // Bulletfree Walton
				{
				    CreateVehicle(478, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Bulletfree Walton, look around as you don't see the car!");
				}
				case 12:  // Landstalker
				{
				    CreateVehicle(400, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Landstalker, look around as you don't see the car!");
				}
				case 13:  // Rancher
				{
				    CreateVehicle(489, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Rancher, look around as you don't see the car!");
				}
				case 14:  // Majestic
				{
				    CreateVehicle(517, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Majestic, look around as you don't see the car!");
				}
				case 15:  // Manana
				{
				    CreateVehicle(410, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Manana, look around as you don't see the car!");
				}
				case 16:  // Merit
				{
					CreateVehicle(551, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
					SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Merit, look around as you don't see the car!");
				}
				case 17:  // Mesa
				{
				    CreateVehicle(500, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Mesa, look around as you don't see the car!");
				}
				case 18:  // Monster
				{
				    CreateVehicle(444, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Monster, look around as you don't see the car!");
				}
				case 19:  // Monster A
				{
				    CreateVehicle(556, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Monster A, look around as you don't see the car!");
				}
				case 20:  // Monster B
				{
				    CreateVehicle(557, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
	                SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Monster B, look around as you don't see the car!");
				}
				case 21:  // Nebula
				{
				    CreateVehicle(516, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Nebula, look around as you don't see the car!");
				}
				case 22:  // Oceanic
				{
				    CreateVehicle(467, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned an Oceanic, look around as you don't see the car!");
				}
				case 23:  // Perennial
				{
				    CreateVehicle(404, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Perennial, look around as you don't see the car!");
				}
				case 24:  // Phoenix
				{
				    CreateVehicle(603, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Phoenix, look around as you don't see the car!");
				}
				case 25:  // Picador
				{
				    CreateVehicle(600, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Picador, look around as you don't see the car!");
				}
				case 26:  // Premier
				{
				    CreateVehicle(426, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Premier, look around as you don't see the car!");
				}
				case 27:  // Previon
				{
					CreateVehicle(436, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
					SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Previon, look around as you don't see the car!");
				}
				case 28:  // Primo
				{
				    CreateVehicle(547, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Primo, look around as you don't see the car!");
				}
				case 29:  // Regina
				{
				    CreateVehicle(479, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Regina, look around as you don't see the car!");
				}
				case 30:  // Remmington
				{
				    CreateVehicle(534, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Remmington, look around as you don't see the car!");
				}
				case 31:  // Romero
				{
				    CreateVehicle(442, X+5, Y, Z, Angle, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
				    SendClientMessage(playerid, 0xFFFFFFFF, "You spawned a Romero, look around as you don't see the car!");
				}
			}
		}
	 	else SendClientMessage(playerid,0xff0000FF,"Cancelled");
	}
	return 1;
}
Please help me!!!!
Reply
#2

can anyone help me please i am a noob in pawno scripting!
Reply
#3

Quote:
Originally Posted by jpboy1
Посмотреть сообщение
can anyone help me please i am a noob in pawno scripting!
1. putting player in seat

pawn Код:
new temp_veh;
temp_veh = AddStaticVehicle(etc...)
PutPlayerInVehicle(playerid,temp_veh,0); //temp_veh is the vehicle ID, and 0 is the driver's seat
2. saving the car ID when its created, and destroy when the player steps out

Add this on declarations:
pawn Код:
IsVehicleCreatedForPlayer[MAX_PLAYERS];
Add this onplayerspawn:
pawn Код:
IsVehicleCreatedForPlayer[playerid] = -1; //setting the value standard on -1 (so not created for player)
This on the dialog when the player gets an vehicle:
pawn Код:
IsVehicleCreatedForPlayer[playerid] = temp_veh; //assigning the car ID
And finally... this on OnPlayerStateChange (not on playerkeystatechange!)
pawn Код:
if (IsVehicleCreatedForPlayer[playerid] >-1) //if its not -1, so an spawned vehicle (assigned with the id)
    {
        if (oldstate == PLAYER_STATE_DRIVER)
        {
            DestroyVehicle(IsVehicleCreatedForPlayer[playerid]); //destroying the car
                              IsVehicleCreatedForPlayer[playerid] = -1; //resetting state
        }
    }
Reply
#4

Thnx it works Great!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)