Vehicle spawn help
#1

I made a vehicle dialog but when i sapwn a car and the i spawn it again i spawns two cars.I want when i spawn a car and spawn it again the first car desapiar and spanw the second car.
Reply
#2

Quote:
Originally Posted by IvancheBG
Посмотреть сообщение
I made a vehicle dialog but when i sapwn a car and the i spawn it again i spawns two cars.I want when i spawn a car and spawn it again the first car desapiar and spanw the second car.
Can we see the code ? We're not mind readers.
Reply
#3

the dialog respone or something else
Reply
#4

And the code is...?
Listen,you need to give us the code of the dialog so we can help you solve your issue
Reply
#5

OK here it is

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, Angle);
    GetPlayerInterior(playerid);
    
    if(dialogid == vmenu)
    {
        if(response)
		{
            if(listitem == 0) // INFERNUS
            {
                new CurrentVeh = CreateVehicle(411, X, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
            if(listitem == 1) // NRG-500
			{
                new CurrentVeh = CreateVehicle(522, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
			}
			if(listitem == 2) // BF Injection
			{
                new CurrentVeh = CreateVehicle(424, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
            if(listitem == 3) // Turismo
            {
                new CurrentVeh = CreateVehicle(451, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
            if(listitem == 4) // Maverick
            {
                new CurrentVeh = CreateVehicle(487, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
            if(listitem == 5) // Phoenix
            {
                new CurrentVeh = CreateVehicle(603, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
            if(listitem == 6) // Kart
            {
                new CurrentVeh = CreateVehicle(571, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
            if(listitem == 7) // Elegy
            {
                new CurrentVeh = CreateVehicle(562, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
            if(listitem == 8) // Sultan
            {
                new CurrentVeh = CreateVehicle(560, X+5, Y, Z+1, Angle, random(100), random(100), -1);
				PutPlayerInVehicle(playerid,veh,0);
				LinkVehicleToInterior(veh, pInt);
            }
        }
        return 1;
    }
    return 0;
Reply
#6

pawn Код:
new bool:IsVehicleCreated = false;

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, Angle);
    GetPlayerInterior(playerid);
   
    if(dialogid == vmenu)
    {
        if(response)
        {
            if(listitem == 0) // INFERNUS
            {
                if(IsVehicleCreated == true) { DestroyVehicle(CurrentVeh); IsVehicleCreated = false; }
                new CurrentVeh = CreateVehicle(411, X, Y, Z+1, Angle, random(100), random(100), -1);
                PutPlayerInVehicle(playerid,veh,0);
                LinkVehicleToInterior(veh, pInt);
                IsVehicleCreated = true;
            }
        }
        return 1;
    }
    return 0;
Reply
#7

Can't promise anything,and I am only a beginner,but I will try to help as much as I can:

Edit: Someone was faster lol
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
SpawnedCar[MAX_PLAYERS] = 0;
    
GetPlayerPos(playeridXYZ);
    
GetPlayerFacingAngle(playeridAngle);
    
GetPlayerInterior(playerid);
    if(
dialogid == vmenu)
    {
        if(
response)
        {
            if(
listitem == 0// INFERNUS
            
{
                new 
CurrentVeh CreateVehicle(411XYZ+1Anglerandom(100), random(100), -1);
                if(
SpawnedCar[playerid] = 1) {
                
DestroyVehicle(CurrectVeh);
                
SpawnedCar[playerid] = 0);
                }
                else {
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
                }
            }
            if(
listitem == 1// NRG-500
            
{
                new 
CurrentVeh CreateVehicle(522X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
            if(
listitem == 2// BF Injection
            
{
                new 
CurrentVeh CreateVehicle(424X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
            if(
listitem == 3// Turismo
            
{
                new 
CurrentVeh CreateVehicle(451X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
            if(
listitem == 4// Maverick
            
{
                new 
CurrentVeh CreateVehicle(487X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
            if(
listitem == 5// Phoenix
            
{
                new 
CurrentVeh CreateVehicle(603X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
            if(
listitem == 6// Kart
            
{
                new 
CurrentVeh CreateVehicle(571X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
            if(
listitem == 7// Elegy
            
{
                new 
CurrentVeh CreateVehicle(562X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
            if(
listitem == 8// Sultan
            
{
                new 
CurrentVeh CreateVehicle(560X+5YZ+1Anglerandom(100), random(100), -1);
                
PutPlayerInVehicle(playerid,veh,0);
                
LinkVehicleToInterior(vehpInt);
            }
        }
        return 
1;
    }
    return 
0;

Reply
#8

search in the forum carspawner
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)