Strange behaviour car system
#1

Okay so i had a system wich worked before and i dont think i changed anything to it and now it says This vehicle is owned by: (NO ONE HERE), Also the vehicle of someone else gets assigned to me. Anyone sees anything wrong in here?
pawn Код:
House_AddVehicle(HouseID, cModel, Float:cx, Float:cy, Float:cz, Float:crot, Col1, Col2, CarID)
{
    new vid, CarSlot;//, string2[128];

    CarSlot = House_GetFreeCarSlot(HouseID);
    printf("House_AddVehicle::CarSlot = %d", CarSlot);
    if (CarSlot != -1)
    {
        vid = Vehicle_Create(cModel, cx, cy, cz, crot, Col1, Col2, 600);
        printf("House_AddVehicle::vid= %d", vid);
        AHouseData[HouseID][VehicleIDs][CarSlot] = vid;
        printf("House_AddVehicle::AHouseData[%d][VehicleIDs][%d]= %d", HouseID, CarSlot, AHouseData[HouseID][VehicleIDs][CarSlot]);
        AVehicleData[vid][CarModel] = cModel;
        AVehicleData[AHouseData[HouseID][VehicleIDs][CarSlot]][SaveID] = CarID;
        // Save the spawn-data of the vehicle
        AVehicleData[vid][SpawnX] = cx;
        AVehicleData[vid][SpawnY] = cy;
        AVehicleData[vid][SpawnZ] = cz;
        AVehicleData[vid][SpawnRot] = crot;
        // Also set the fuel to maximum
        AVehicleData[vid][FuelData] = MaxFuel;
        // Also set the owner
        AVehicleData[vid][Owned] = true;
        format(AVehicleData[vid][Owner], 24, AHouseData[HouseID][Owner]);
        // Save the HouseID for the vehicle
        AVehicleData[vid][BelongsToHouse] = HouseID;
        print("Vehicle loaded");
    }
    else
    {
        print ("No free carslot");// No free carslot was found, return 0
        return 0;
    }

    // Exit the function and return the vehicle-id
    return vid;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)