SA-MP Forums Archive
GetRearOfVehicle - 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: GetRearOfVehicle (/showthread.php?tid=195372)



GetRearOfVehicle - cepiokas - 02.12.2010

Hey, i can't find this function anywhere. Maybe someone has it?


Re: GetRearOfVehicle - Ash. - 02.12.2010

Ive never heard of it... - What is it supposed to do??


Re: GetRearOfVehicle - cepiokas - 02.12.2010

Well, i know that it's isn't exists, i don't know what is such a function name, but this one, i guess is explaining self by the name.


Re: GetRearOfVehicle - cepiokas - 02.12.2010

I want to get rear of the vehicle to attach 3D text label to a number plate position.


Re: GetRearOfVehicle - cepiokas - 02.12.2010

You see, not all cars are the same of their lenghts, so, offset's needs to be difference. I didn't ask you to give me a function, which gets X,Y,Z of plate, i JUST need to get rear of vehicle, and that's all. Once time i have already found that, but now didn't remember.


Re: GetRearOfVehicle - Ash. - 02.12.2010

Can't you just use GetVehiclePos?


Re: GetRearOfVehicle - cepiokas - 02.12.2010

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Can't you just use GetVehiclePos?
Then i get center of vehicle.


Re: GetRearOfVehicle - armyoftwo - 02.12.2010

Quote:
Originally Posted by cepiokas
Посмотреть сообщение
Then i get center of vehicle.
then you can experiment with it and then get the rear


Re: GetRearOfVehicle - cepiokas - 02.12.2010

God damn, guys, i have asked you a function, why i need now to test, spend hours to get right function, wouldn't be easier to post a function, of course, if you have it, you will save me from a stupid work. Is it so hard?


Re: GetRearOfVehicle - Ash. - 02.12.2010

Yes it is so hard, because we dont have it and probably dont want it. + If you want help, dont come on thinking everyone will help you, because they wont if you talk like that to them.

Just get an average from vehicle legnths and use that? Is that so hard?


Re: GetRearOfVehicle - armyoftwo - 02.12.2010

for me personally, it would take less than 10 mins to make the function with experimenting with attachobjecttovehicle function! or you're lazy or you don't know how to script?

Код:
CMD:attachtovehicle(playerid, params[])
{
	new modelID, Float:offset[3], Float:rot[3];
	if(sscanf(params, "dF(0)F(0)F(0)F(0)F(0)F(0)", modelID, offset[0], offset[1], offset[2], rot[0], rot[1], rot[2]))
		return SendClientMessage(playerid, COLOR_GREY, "{FF0000}ERROR: {C1BEC0}Bad parameters!");
	
	if(GetPVarType(playerid, "playerVehicleAttachObject") == PLAYER_VARTYPE_INT)
	{
		DestroyObject(GetPVarInt(playerid, "playerVehicleAttachObject"));
	}
	new objectID = CreateObject(modelID, 0, 0, 0, 0, 0, 0);
	SetPVarInt(playerid, "playerVehicleAttachObject", objectID);
	AttachObjectToVehicle(objectID, GetPlayerVehicleID(playerid), offset[0], offset[1], offset[2], rot[0], rot[1], rot[2]);
	return true;
}
credits to andre


Re: GetRearOfVehicle - Rac3r - 02.12.2010

You need to get the vehicleid of the vehicle, then use this code.
Код:
new Float:x, Float:y, Float:z, Float:a, Float:x2, Float:y2;
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
x2 = x + (-6 * floatsin(-a, degrees));
y2 = y + (-6 * floatcos(-a, degrees));
SetPlayerCheckpoint(playerid, x2, y2, z, 1.5);
Clear to understand, this will place a checkpoint at the back of the vehicle.

I think the floatsin and floatcos part of the code is by Y-Less.


Re: GetRearOfVehicle - cepiokas - 02.12.2010

Alright, thank you all.