3DTextLabel problem (Attaching to vehicle)
#1

I've really got no clue to why this isn't working correctly, but its pretty much the same code as I've used before.

Note: The lable is being created just not attached.
pawn Код:
switch(threadid)
    {
        case THREAD_SPAWNPLAYER_VEHICLES:
        {
            new fields, rows, fetch[256];
            cache_get_data(rows, fields, MySQL_Connection);

            for(new i = 0; i < rows; i++)
            {
                new slot = GetFreeVehicleSlot();

                printf("Slot Returned: %d");
                if(slot > -1)
                {
                    VehicleInformation[slot][VehicleSlotUsed] = 1;
                    VehicleInformation[slot][VehicleUID] = cache_get_field_int(i, "VehicleUID");
                    VehicleInformation[slot][VehicleOwner] = cache_get_field_int(i, "VehicleOwner");
                    VehicleInformation[slot][VehicleCompany] = cache_get_field_int(i, "VehicleCompany");
                    VehicleInformation[slot][VehicleAirline] = cache_get_field_int(i, "VehicleAirline");
                    VehicleInformation[slot][VehicleType] = cache_get_field_int(i, "VehicleType");
                    VehicleInformation[slot][VehicleFuelAmount] = cache_get_field_int(i, "VehicleFuelAmount");
                    cache_fetch_float(i, "VehiclePOS_X", VehicleInformation[slot][vPOS][0]);
                    cache_fetch_float(i, "VehiclePOS_Y", VehicleInformation[slot][vPOS][1]);
                    cache_fetch_float(i, "VehiclePOS_Z", VehicleInformation[slot][vPOS][2]);
                    cache_fetch_float(i, "VehiclePOS_R", VehicleInformation[slot][vPOS][3]);
                    VehicleInformation[slot][vColor1] = cache_get_field_int(0, "VehicleColor1");
                    VehicleInformation[slot][vColor2] = cache_get_field_int(0, "VehicleColor2");

                    for(new s = 0; s < 213; s ++)
                    {
                        if(VehicleStatsInformation[s][VehicleType] == VehicleInformation[slot][VehicleType])
                        {
                            if(VehicleInformation[slot][VehicleFuelAmount] > VehicleStatsInformation[s][VehicleMaxFuel])
                            {
                                VehicleInformation[slot][VehicleFuelAmount] = VehicleStatsInformation[s][VehicleMaxFuel];
                                print("[ERROR]: This planes fuel is over the limit, automatically setting it to the max limit");
                            }
                        }
                    }

                    if(VehicleInformation[slot][VehicleSlotUsed] == 1)
                    {
                        VehicleInformation[slot][SpawnedVehicle] = CreateVehicle(VehicleInformation[slot][VehicleType],  VehicleInformation[slot][vPOS][0], VehicleInformation[slot][vPOS][1],  VehicleInformation[slot][vPOS][2],  VehicleInformation[slot][vPOS][3], 3,3, 60);
                       
                        new string[128];
                        format(string,sizeof(string), "Vehicle: %s\nOwner: %s", "PLANE", "Droid");
                        VehicleInformation[slot][vLabel] = CreateDynamic3DTextLabel(string, 0xFFFFFFFF, 0,0,0, 10);
                        Attach3DTextLabelToVehicle(VehicleInformation[slot][vLabel], VehicleInformation[slot][SpawnedVehicle], 0,0,0+0.2);
                        printf("Creating Player Vehicle.....");
                    }
                } else print("ERROR NO ID RETURNED");
            }        
        }
    }
Reply
#2

Because you can't use CreateDynamic3DTextLabel with Attach3DTextLabelToVehicle
if you want use Attach3DTextLabelToVehicle then you must do Create3DTextLabel

Use
Код:
new Float:pos[3];
GetVehiclePos(VehicleInformation[slot][SpawnedVehicle], pos[0], pos[1], pos[2]);
CreateDynamic3DTextLabel("your text", -1, pos[0], pos[1], pos[2]+1, 50.0, -1, VehicleInformation[slot][SpawnedVehicle], 0, -1, -1, -1, 100.0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)