need help with OnVehicleDeath
#1

Alright I am have Issues with On Vehicle Death were if the car is a dealership car from my filter script the car won't respawn in the last place it was parked it won't appear anywere

also I have a command /vget that teleports a vehicle to me and when I use it the vehicle catches on fire. It started happening when I added this code.


my code
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    SetTimer("OnVehicleDeathDelay",15000,false);//this is for a delay so The car does not disappear right away
    return 1;
}
//jbcarid is a id of a car that is purchase able of for sale
public OnVehicleDeathDelay(vehicleid)
{
    if((carstate[jbcarid[vehicleid]])==1)//This checks if the car exist
    {
        if((cartype[jbcarid[vehicleid]])==2)//this checks if it is a dealership car[2] or an owned car[1]
        {
            new string[256];
            new carid = jbcarid[vehicleid];
            jbcarid[vehicleid] = 0;
            DestroyVehicle(vehicleid);
            Delete3DTextLabel(carlabel[carid]);
            format(string,sizeof(string),"%sDealership vehicle\nThis vehicle cost $%i",cardealershipid[carid],carcost[carid]);
            carlabel[carid] = Create3DTextLabel(string,YELLOW,carx[carid],cary[carid],carz[carid],DISTANCELABEL,0,0);
            car[carid] = CreateVehicle(carmodelid[carid],carx[carid],cary[carid],carz[carid],carrot[carid],carcolor1[carid],carcolor2[carid],-1);
            jbcarid[car[carid]] = carid;
            Attach3DTextLabelToVehicle(carlabel[carid],car[carid],0,0,0);
            fuel[car[carid]] = carfuel[carid];
            SaveCarData(carid);
        }//have not yet made is for owning vehicles
    }
    else//if the car is a regular and not owned
    {
        DestroyVehicle(vehicleid);
        fuel[vehicleid] = 100.0;
    }
    return 1;
}
Reply


Messages In This Thread
need help with OnVehicleDeath - by horsemeat - 08.01.2014, 02:53
Re: need help with OnVehicleDeath - by CutX - 08.01.2014, 06:52
Re: need help with OnVehicleDeath - by horsemeat - 09.01.2014, 01:21

Forum Jump:


Users browsing this thread: 1 Guest(s)