Help here please
#1

How to create vehicles with this useful function?

GetXYGridPos https://sampforum.blast.hk/showthread.php?tid=38965&page=446
Reply
#2

?...
Reply
#3

PHP код:
stock GetXYGridPos(Float:xsFloat:ys, &Float:x, &Float:yFloat:AngleIndex Columns,  Float:xOffsetFloat:yOffset)
{
//the values saved in x and y are the values saved into the variable you use in the function call param 3 and 4.
//the "Index" is defining which of the positions in the grid you want to calculate and get returned. 
//if we had two columns this would mean: 0 = front left, 1 = front right, 2 = row two left, 3 = row two right.. and so on.
 
    
new Index%Columns//modulus
    
new floatround(Indexfloatround_floor) / Columns//normal division, rounding to nearest even number below the value.
    
Calc_Point(xsysResultxResultyxOffsetyOffsetAngle ij);
    
Resultx//x Position
    
Resulty;//Y position
    

You insert all the params. XY and R are centered. Index stands for the vehicle number you want to spawn. Columns stand for the amount of side-by-side lines. Offsets are individual distances between vehicles.

Let's say you want to make a boat race.
PHP код:
new pos[2];
for(new 
i;i<10;i++) //spawns 9 boats
{
GetXYGridPos(2000.0,2000.0pos[0], pos[1], i0,  5.010.0);
CreateVehicle(490,pos[0], pos[1],1.0,0.0,0,0,1000);

Reply
#4

thank you very much
Reply
#5

Код:
undefined symbol "Resultx" & undefined symbol "Resulty"

in:

stock Calc_Point(Float:xs, Float:ys, &Float:x, &Float:y, Float:xOffset, Float:yOffset, Float:Angle, i, j)
{
	//do further calculations with the params in last operation, find the next x and y values in the grid
	//x and yOffset is basically the space between the coordinates you calculate. Bigger value, bigger grid.
	x = xs +i * xOffset * floatcos(Angle,degrees) +j * yOffset * floatsin(Angle,degrees);
	y = ys + i * xOffset * floatsin(Angle,degrees) - j * yOffset * floatcos(Angle,degrees); //the two here is having + & + and + & - because of the coordinate system in samp.
} 

Help?
Reply
#6

Help - me ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)