SA-MP Forums Archive
Creating a ship on command (struggling with ofsets) - 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)
+--- Thread: Creating a ship on command (struggling with ofsets) (/showthread.php?tid=416710)



Creating a ship on command (struggling with ofsets) - Kontrol - 18.02.2013

Hello i want to be able to create a ship on command for my boating server, i have worked out the ofsets from the hull but its still not working can anybody please help?

http://pastebin.com/GH3mnw29

Theres all the relative information needed, the first object is the hull hence the +0.00000

regards.


Re: Creating a ship on command (struggling with ofsets) - Kontrol - 18.02.2013

also to get the ofsets i used this code.

Код:
new Float:basePos[6] =
{
	594.0250240,
	-2507.9733890,
	16.2406880,
	0.0000000,
	0.0000000,
	0.0000000
};

public OnFilterScriptInit()
{
GetObjectOffset(9585,594.0250240,-2507.9733890,16.2406880,0.0000000,0.0000000,0.0000000); // HULL
GetObjectOffset(9586,591.7604370,-2507.9494630,26.3000410,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9584,518.7380980,-2507.9604490,35.3079640,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9761,592.4118650,-2507.9602050,36.1823350,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9590,600.2765500,-2507.9758300,17.9724040,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9698,530.2267460,-2509.1372070,38.1850890,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9821,529.4810180,-2505.6682130,33.9316790,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9820,529.1635740,-2507.7556150,42.2030830,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9818,533.5540770,-2508.0200200,43.0030250,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(9819,533.5652470,-2501.6997070,42.2127300,0.0000000,0.0000000,-0.0150000); //
GetObjectOffset(1215,528.8506470,-2504.7854000,63.6877820,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(1215,528.8312380,-2512.1298830,63.6787570,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(1215,535.3362430,-2592.6474610,34.5884860,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(1215,509.6763610,-2514.1162110,36.2597850,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(1215,509.6763610,-2501.8161620,36.2597850,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(2780,515.7564700,-2511.2878420,47.6079140,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(2780,515.7564700,-2504.7878420,47.6079140,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(2780,524.3037720,-2503.2248540,29.7355080,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(2780,560.0123290,-2498.2329100,10.0544360,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(2780,640.1273800,-2496.4858400,10.3768010,0.0000000,0.0000000,0.0000000); //
GetObjectOffset(1461,480.7582090,-2507.9753420,27.6434630,0.0000000,0.0000000,1.6500000); //object(30)
GetObjectOffset(1608,452.9637450,-2559.4094240,-0.9380720,0.0000000,0.0000000,0.0000000); //object(31)
GetObjectOffset(1533,500.2120060,-2507.0571290,25.5874900,0.0000000,0.0000000,-1.5750000); //object(32)
GetObjectOffset(1432,497.3385620,-2517.9724120,25.6751690,0.0000000,0.0000000,1.3500000); //object(34)
GetObjectOffset(1432,497.2881470,-2514.1311040,25.6501690,0.0000000,0.0000000,0.7500000); //object(35)
GetObjectOffset(1432,497.7135310,-2501.2243650,25.7328070,0.0000000,0.0000000,1.3500000); //object(37)
GetObjectOffset(1432,497.7020870,-2497.9916990,25.6578080,0.0000000,0.0000000,-1.5750000); //object(38)
GetObjectOffset(1670,497.6219180,-2498.0808110,26.3085990,0.0000000,0.0000000,0.0000000); //object(40)
GetObjectOffset(2801,497.7083130,-2501.1911620,25.9839040,0.0000000,0.0000000,0.0000000); //object(41)
GetObjectOffset(1670,497.2803040,-2514.0610350,26.2759610,0.0000000,0.0000000,0.0000000); //object(42)
GetObjectOffset(1775,499.7673340,-2509.6625980,26.6904030,0.0000000,0.0000000,-1.5750000); //object(43)
GetObjectOffset(2838,497.3239440,-2517.9846190,26.2885840,0.0000000,0.0000000,0.0000000); //object(44)
GetObjectOffset(2839,497.7852480,-2497.8146970,26.2774980,0.0000000,0.0000000,0.0000000); //object(45)
GetObjectOffset(1775,529.2348630,-2520.1535640,38.0321270,0.0000000,0.0000000,3.1500010); //object(46)
GetObjectOffset(1533,536.8386230,-2509.4975590,25.5874900,-0.1500000,0.0000000,1.5900000); //object(47)
GetObjectOffset(16767,581.2215580,-2510.3808590,31.5881390,0.0000000,0.0000000,3.1350010); //object(48)
GetObjectOffset(1522,564.2104490,-2503.3693850,25.5825180,0.0000000,0.0000000,-1.5750000); //object(49)
GetObjectOffset(1522,564.2319950,-2506.3854980,25.5825180,0.0000000,0.0000000,1.5750000); //object(50)
GetObjectOffset(4022,589.1602780,-2515.5205080,28.6853540,0.0000000,0.0000000,-3.1500010); //object(51)
GetObjectOffset(8068,622.2698970,-2513.4521480,32.3178900,0.0000000,0.0000000,-4.7250000); //object(57)
GetObjectOffset(1543,671.2168580,-2500.3845210,26.6219140,0.0000000,0.0000000,0.0000000); //object(61)
GetObjectOffset(14537,669.9298710,-2513.1440430,27.4776540,0.0000000,0.0000000,0.0000000); //object(66)
GetObjectOffset(14537,669.8961790,-2501.9450680,27.4776540,0.0000000,0.0000000,0.0000000); //object(67)
GetObjectOffset(13562,593.4946290,-2513.5207520,32.1089940,0.0000000,0.0000000,1.5750000); //object(68)
	return 1;
}


stock GetObjectOffset(model,Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz)
{
        printf("CreateObject(%d,PosX+%f,PosY+%f,PosZ+%f,RotX+%f,RotY+%f,RotZ+%f);",model,basePos[0]-x,basePos[1]-y,basePos[2]-z,basePos[3]-rx,basePos[4]-ry,basePos[5]-rz);
        return 1;
}



Re: Creating a ship on command (struggling with ofsets) - Kontrol - 18.02.2013

Bump.


Re: Creating a ship on command (struggling with ofsets) - HB - 18.02.2013

The reason this code fails is because each object in San Andreas has different boundaries.. Getting the position will refer to a different relative location of each boundary, thus not getting the right offsets for each object.


Re: Creating a ship on command (struggling with ofsets) - Jeffry - 19.02.2013

Hey, I couldn't find any wrong objects so far. Does it work fine, after the code I've sent you?
If yes, which objects?