Vehicle spawning -help please
#1

I have this dialogmenu where i spawn cars.
As soon as i have removed a vehicle, and try to spawn a new one it just pops up and dissapears.
How come?
Spawn Code.
Код:
CarSpawner2(playerid,480);
Removal Code.
Код:
CarDeleter2(PlayerInfo[playerid][pCar2]);
Код:
forward CarSpawner2(playerid,model);
public CarSpawner2(playerid,model)
{
	if(PlayerInfo[playerid][pCar2] != -1) CarDeleter2(PlayerInfo[playerid][pCar2]);
    new vehicleid2=CreateVehicle(model, VehicleX, VehicleY, VehicleZ, VehicleAngle, -1, -1, -1);
	ChangeVehicleColor(vehicleid2,0,0);
	PlayerInfo[playerid][pCar2] = vehicleid2;
}

forward CarDeleter2(vehicleid);
public CarDeleter2(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
	{
	    SetVehicleParamsForPlayer(vehicleid,i,0,1);
	}
    SetTimerEx("VehRes2",500,0,"i",vehicleid);
}

forward VehRes2(vehicleid);
public VehRes2(vehicleid)
{
    DestroyVehicle(vehicleid);
}

public OnVehicleSpawn(vehicleid)
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
        if(vehicleid==PlayerInfo[i][pCar2])
		{
		    CarDeleter2(vehicleid);
	        PlayerInfo[i][pCar2]=-1;
        }
	}
	return 1;
}
Reply
#2

pawn Код:
new vehicleid2;
forward CarSpawner2(playerid,model);
public CarSpawner2(playerid,model)
{
    if(PlayerInfo[playerid][pCar2] != -1) CarDeleter2(PlayerInfo[playerid][pCar2]);
        vehicleid2 = CreateVehicle(model, VehicleX, VehicleY, VehicleZ, VehicleAngle, -1, -1, -1);
    ChangeVehicleColor(vehicleid2,0,0);
    PlayerInfo[playerid][pCar2] = vehicleid2;
}

forward CarDeleter2(vehicleid);
public CarDeleter2(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        SetVehicleParamsForPlayer(vehicleid,i,0,1);
    }
    SetTimerEx("VehRes2",500,0,"i",vehicleid);
}

forward VehRes2(vehicleid);
public VehRes2(vehicleid)
{
    DestroyVehicle(vehicleid);
}

public OnVehicleSpawn(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(vehicleid==PlayerInfo[i][pCar2])
        {
            CarDeleter2(vehicleid);
            PlayerInfo[i][pCar2]=-1;
        }
    }
    return 1;
}
Reply
#3

Can you tell me what you did?
Reply
#4

BUMP. Still the same.
EDIT: I figured it out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)