AttachObjectToVehicle Not Work?.
#3

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
This:
PHP код:
new vehicleid GetPlayerVehicleID(playerid); 
Requires the player to be inside a vehicle, otherwise it will return 0. Looking at the screenshots and the code, it doesn't look like the player would be in a vehicle after using /xyzz.

If you want the object to get attached to the created vehicle, assign vehicleid to CreateVehicle:
PHP код:
new vehicleid CreateVehicle(4111869.9429, -1760.531313.243170.7358119, -1); //Infernus 
The reason that works is because CreateVehicle returns the ID of the vehicle created.
I succeeded in experimentation mode . but putting it in my mode rpg , it does not work?



code:
PHP код:
forward OnPlayerVehicleSpawn(playerid);
public 
OnPlayerVehicleSpawn(playerid)
{
    new 
plate[10], query[128], string[128],
        
model cache_get_row_int(02),
        
color1 cache_get_row_int(03),
        
color2 cache_get_row_int(04),
        
Float:cache_get_row_float(05),
        
Float:cache_get_row_float(06),
        
Float:cache_get_row_float(07),
        
Float:cache_get_row_float(08),
        
fuel cache_get_row_int(09),
        
Float:health cache_get_row_float(010),
        
insured cache_get_row_int(036),
        
scrapped cache_get_row_int(037),
        
locktype cache_get_row_int(038);
    new 
OBJ[1];
    new 
vehicle CreateVehicle(modelXYZAcolor1color2, -1);
    if(
GetVehicleModel(vehicleid) == 411)
    {
        
OBJ[0] = CreateObject(12711519.2829, -1704.879013.49260.00000.00000.0000); //gunbox
        
AddVehicleComponent(vehicle1010);
        
AddVehicleComponent(vehicle1074);
        
AddVehicleComponent(vehicle1087);
        
AttachObjectToVehicle(OBJ[0], vehicle, -0.0099, -1.89090.52700.60000.00002.7000);
    }
    return 
1;

I changed " OnPlayerVehicleSpawn(playerid) " to " OnPlayerVehicleSpawn(playerid, vehicleid) "
- OnPlayerVehicleSpawn(playerid) - Not Work
- OnPlayerVehicleSpawn(playerid, vehicleid) - Not Work
Reply


Messages In This Thread
AttachObjectToVehicle Not Work?. - by quochuy - 05.08.2016, 06:16
Re: AttachObjectToVehicle Not Work?. - by AndySedeyn - 05.08.2016, 06:36
Re: AttachObjectToVehicle Not Work?. - by quochuy - 05.08.2016, 08:00
Re: AttachObjectToVehicle Not Work?. - by quochuy - 05.08.2016, 13:34
Re: AttachObjectToVehicle Not Work?. - by quochuy - 05.08.2016, 14:54
Re: AttachObjectToVehicle Not Work?. - by JuzDoiT - 05.08.2016, 16:36
Re: AttachObjectToVehicle Not Work?. - by quochuy - 06.08.2016, 03:48
Re: AttachObjectToVehicle Not Work?. - by Crayder - 06.08.2016, 04:19

Forum Jump:


Users browsing this thread: 3 Guest(s)