Attach Object
#8

Quote:
Originally Posted by blewert
Посмотреть сообщение
First off, AttachObjectToVehicle's first argument takes an instance of an object, not the id used to create it. You need to make an instance of that object (i.e. create it), then attach the instance of the object to the vehicle. An example:

PHP код:
//Make a new variable to assign the object's instance ID to.
new obj;
//Create a wheelie bin at 0.0, 0.0, 0.0 and assign it's instance id to obj.
obj CreateObject(13370.00.00.00.00.00.0); 
Secondly, I don't know why, but it seems like the second argument of AttachObjectToVehicle is using a vehicle's model id, not the specified vehicle ID? Try this code:

PHP код:
if(strcmp(cmdtext"/test"true) == 0)
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    if(
GetPlayerMoney(playerid) >= 0)
    {
        new 
mnrg[MAX_PLAYERS];
        
GivePlayerMoney(playerid, -0);
        
mnrg[playerid] = CreateVehicle(560XY190.0, -1, -1100000000);
        
PutPlayerInVehicle(playeridmnrg[playerid], 0);
        
AddVehicleComponent(mnrg[playerid], 1079);
        
//New variable to assign object instance id to.
        
new lpObj;
        
//Create specified object at players pos.
        
lpObj CreateObject19076XYZ0.00.00.0 );
        
        
//Attach the object's instance id to the vehicle.
        
AttachObjectToVehiclelpObjmnrg[playerid], 0.00.01.00.00.00.0);
    }
    return 
1;


Not Attaching !!! Atfer Your tutorial !!!!! H E L P
Reply


Messages In This Thread
Attach Object - by K4P3L_KUM4R - 19.11.2011, 05:34
Re: Attach Object - by K4P3L_KUM4R - 19.11.2011, 06:06
Re: Attach Object - by KosmasRego - 19.11.2011, 06:07
Re: Attach Object - by K4P3L_KUM4R - 19.11.2011, 06:13
Re: Attach Object - by GangsTa_ - 19.11.2011, 06:16
Re: Attach Object - by K4P3L_KUM4R - 19.11.2011, 06:24
Re: Attach Object - by blewert - 19.11.2011, 06:27
Re: Attach Object - by K4P3L_KUM4R - 19.11.2011, 06:40
Re: Attach Object - by blewert - 19.11.2011, 06:47
Re: Attach Object - by K4P3L_KUM4R - 19.11.2011, 06:50

Forum Jump:


Users browsing this thread: 1 Guest(s)