Attach Object -
K4P3L_KUM4R - 19.11.2011
I Have an problem on my command
object not attaching ? to vechile
Ther is cmd
Код:
if(strcmp(cmdtext, "/test", true) == 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(GetPlayerMoney(playerid) >= 0)
{
new mnrg[MAX_PLAYERS];
GivePlayerMoney(playerid, -0);
mnrg[playerid] = CreateVehicle(560, X, Y, Z + 1, 90.0, -1, -1, 100000000);
PutPlayerInVehicle(playerid, mnrg[playerid], 0);
AddVehicleComponent(mnrg[playerid], 1079);
AttachObjectToVehicle(19076, 560, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
}
return 1;
}
Can anyone tell me what i miss ? in cmd
Re: Attach Object -
K4P3L_KUM4R - 19.11.2011
Double Post Sorry
Help Please Urgent
Re: Attach Object -
KosmasRego - 19.11.2011
is it complying fine?
Re: Attach Object -
K4P3L_KUM4R - 19.11.2011
yes complying fine
Re: Attach Object -
GangsTa_ - 19.11.2011
pawn Код:
AttachObjectToVehicle(19076, mnrg[playerid], 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
Change it to this one^.
Re: Attach Object -
K4P3L_KUM4R - 19.11.2011
Change but Object Not Attaching To Car ?
Re: Attach Object -
blewert - 19.11.2011
Quote:
Originally Posted by K4P3L_KUM4R
Код:
if(strcmp(cmdtext, "/test", true) == 0)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(GetPlayerMoney(playerid) >= 0)
{
new mnrg[MAX_PLAYERS];
GivePlayerMoney(playerid, -0);
mnrg[playerid] = CreateVehicle(560, X, Y, Z + 1, 90.0, -1, -1, 100000000);
PutPlayerInVehicle(playerid, mnrg[playerid], 0);
AddVehicleComponent(mnrg[playerid], 1079);
AttachObjectToVehicle(19076, 560, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
}
return 1;
}
|
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(1337, 0.0, 0.0, 0.0, 0.0, 0.0, 0.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:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(GetPlayerMoney(playerid) >= 0)
{
new mnrg[MAX_PLAYERS];
GivePlayerMoney(playerid, -0);
mnrg[playerid] = CreateVehicle(560, X, Y, Z + 1, 90.0, -1, -1, 100000000);
PutPlayerInVehicle(playerid, mnrg[playerid], 0);
AddVehicleComponent(mnrg[playerid], 1079);
//New variable to assign object instance id to.
new lpObj;
//Create specified object at players pos.
lpObj = CreateObject( 19076, X, Y, Z, 0.0, 0.0, 0.0 );
//Attach the object's instance id to the vehicle.
AttachObjectToVehicle( lpObj, mnrg[playerid], 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
}
return 1;
}
Re: Attach Object -
K4P3L_KUM4R - 19.11.2011
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(1337, 0.0, 0.0, 0.0, 0.0, 0.0, 0.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:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(GetPlayerMoney(playerid) >= 0)
{
new mnrg[MAX_PLAYERS];
GivePlayerMoney(playerid, -0);
mnrg[playerid] = CreateVehicle(560, X, Y, Z + 1, 90.0, -1, -1, 100000000);
PutPlayerInVehicle(playerid, mnrg[playerid], 0);
AddVehicleComponent(mnrg[playerid], 1079);
//New variable to assign object instance id to.
new lpObj;
//Create specified object at players pos.
lpObj = CreateObject( 19076, X, Y, Z, 0.0, 0.0, 0.0 );
//Attach the object's instance id to the vehicle.
AttachObjectToVehicle( lpObj, mnrg[playerid], 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
}
return 1;
}
|
Not Attaching !!! Atfer Your tutorial !!!!!
H E L P
Re: Attach Object -
blewert - 19.11.2011
Quote:
Originally Posted by K4P3L_KUM4R
Not Attaching !!! Atfer Your tutorial !!!!! H E L P
|
Well it must be something you're doing on your end (Which please note, is not my fault). I compiled & tested and it works fine for me:
Re: Attach Object -
K4P3L_KUM4R - 19.11.2011
I Miss ? Some think Or What Is Tha Problem Can U Tell ME ?