SA-MP Forums Archive
Attach Objects to Vehicles - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Attach Objects to Vehicles (/showthread.php?tid=194118)



Attach Objects to Vehicles - Stefan_Toretto - 28.11.2010

I've created this command, using ZCMD & SSCANF
Код:
cmd(atachobject, playerid, parmas[])
{
	new objid;
	if(sscanf(parmas, "i", objid))return SendClientMessage(playerid, COLOR_WHITE, "/atachobject [ObjectID]");
	AttachObjectToVehicle(objid,GetPlayerVehicleID(playerid),0.0,0.0,0.3,0.0,0.0,0.0);
	return 1;
}
in game... nothing happens... what's wrong?


Re: Attach Objects to Vehicles - [03]Garsino - 28.11.2010

Make sure the object you're attaching is actually created (:


Re: Attach Objects to Vehicles - Stefan_Toretto - 28.11.2010

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
Make sure the object you're attaching is actually created (:
Something like this?
Код:
cmd(atachobject, playerid, parmas[])
{
	new objid = CreateObject(objid,0.0,0.0,0.0,0.0,0.0,0.0);
	if(sscanf(parmas, "i", objid))return SendClientMessage(playerid, COLOR_WHITE, "/atachobject [ObjectID]");
	AttachObjectToVehicle(objid,GetPlayerVehicleID(playerid),0.0,0.0,0.3,0.0,0.0,0.0);
	return 1;
}



Re: Attach Objects to Vehicles - boelie - 28.11.2010

i tested it this way

Код:
	if (strcmp("/attach", cmdtext, true, 10) == 0)	{
	GetVehiclePos(testcar,xt,yt,zt);
	AttachObjectToVehicle(testobject,testcar,xt,yt,zt,20,20,20);
	return 1;
	}
the object (testobject) is created and also nothing happens. I know it should work.. i saw the pictures


Re: Attach Objects to Vehicles - [03]Garsino - 28.11.2010

If you did it that way you wouldn't need the sscanf line


Re: Attach Objects to Vehicles - Stefan_Toretto - 28.11.2010

Quote:
Originally Posted by [03]Garsino
Посмотреть сообщение
If you did it that way you wouldn't need the sscanf line
you're right...


Re: Attach Objects to Vehicles - boelie - 28.11.2010

[quote]If you did it that way you wouldn't need the sscanf line [/code]

LOL i didnt post that im just another scripter facing the same problem..nothing happens


Re: Attach Objects to Vehicles - d0 - 28.11.2010

pawn Код:
cmd(atachobject, playerid, parmas[])
{
new model;
if(sscanf(parmas, "i", model))return SendClientMessage(playerid, COLOR_WHITE, "/atachobject [ObjectID]");
AttachObjectToVehicle(CreateObject(model,0.0,0.0,0.0,0.0,0.0,0.0),GetPlayerVehicleID(playerid),0.0,0.0,0.3,0.0,0.0,0.0);
return 1;
}



Re: Attach Objects to Vehicles - Stefan_Toretto - 28.11.2010

Quote:
Originally Posted by D0erfler
Посмотреть сообщение
pawn Код:
cmd(atachobject, playerid, parmas[])
{
new model;
if(sscanf(parmas, "i", model))return SendClientMessage(playerid, COLOR_WHITE, "/atachobject [ObjectID]");
AttachObjectToVehicle(CreateObject(model,0.0,0.0,0.0,0.0,0.0,0.0),GetPlayerVehicleID(playerid),0.0,0.0,0.3,0.0,0.0,0.0);
return 1;
}
It says SERVER: UNKNOWN COMMAND ...


Re: Attach Objects to Vehicles - [03]Garsino - 28.11.2010

You need zcmd ofc