11.02.2012, 18:55
Two methods:
1) Create ready-made slots for spawn x,y,z,za for all racers.
2) Automatic: (Note: Will be buggy if the surface isn't flat)
Appropriate offset for FRONT/BACK would be 8 and for LEFT/RIGHT is 5.
Usage:
Output:

And remember that you can enter custom direction angle (45) to make diagonal positions!
1) Create ready-made slots for spawn x,y,z,za for all racers.
2) Automatic: (Note: Will be buggy if the surface isn't flat)
pawn Код:
#define OPPONENT_FRONT 0
#define OPPONENT_BACK 180
#define OPPONENT_LEFT 90
#define OPPONENT_RIGHT 270
stock GetOpponentPositionFrom(vehicleid, direction, Float:offset, &Float:X, &Float:Y, &Float:Z, &Float:ZA)
{ //iPLEOMAX
GetVehiclePos(vehicleid, X, Y, Z);
GetVehicleZAngle(vehicleid, ZA);
X += offset * floatsin(-(ZA+direction), degrees);
Y += offset * floatcos(-(ZA+direction), degrees);
}
Usage:
pawn Код:
CMD:createracer(playerid, params[])
{
new Float:X, Float:Y, Float:Z, Float:ZA;
switch(strval(params))
{
case 0: GetOpponentPositionFrom(GetPlayerVehicleID(playerid), OPPONENT_FRONT, 5, X, Y, Z, ZA);
case 1: GetOpponentPositionFrom(GetPlayerVehicleID(playerid), OPPONENT_BACK, 5, X, Y, Z, ZA);
case 2: GetOpponentPositionFrom(GetPlayerVehicleID(playerid), OPPONENT_LEFT, 5, X, Y, Z, ZA);
case 3: GetOpponentPositionFrom(GetPlayerVehicleID(playerid), OPPONENT_RIGHT, 5, X, Y, Z, ZA);
}
CreateVehicle(400, X, Y, Z, ZA, -1, -1, 0);
return true;
}

And remember that you can enter custom direction angle (45) to make diagonal positions!
