Advertisement
DraKiNs

[FS] SetVehicleAfterVehicle

Aug 25th, 2011
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.70 KB | None | 0 0
  1. public OnPlayerCommandText(playerid, cmdtext[])
  2. {
  3.     if(!strcmp("/infernus", cmdtext, true) && !IsPlayerInAnyVehicle(playerid))
  4.     {
  5.         //DECLARE VARIABLES
  6.         new
  7.             Float:x,
  8.             Float:y,
  9.             Float:z,
  10.             Float:a,
  11.             vehicleId[5];
  12.            
  13.         // GET PLAYER POS TO CREATE VEHICLES
  14.         GetPlayerPos(playerid, x,y,z);
  15.         GetPlayerFacingAngle(playerid, a);
  16.        
  17.         // CREATE PLAYER VEHICLE
  18.         vehicleId[0] = CreateVehicle(411, x, y, z, a, -1, -1, -1);
  19.         PutPlayerInVehicle(playerid, vehicleId[0], 0);
  20.        
  21.         // CREATE VEHICLES
  22.         vehicleId[1] = CreateVehicle(411, x, y, z, a, -1, -1, -1);
  23.         vehicleId[2] = CreateVehicle(411, x, y, z, a, -1, -1, -1);
  24.         vehicleId[3] = CreateVehicle(411, x, y, z, a, -1, -1, -1);
  25.         vehicleId[4] = CreateVehicle(411, x, y, z, a, -1, -1, -1);
  26.  
  27.         // SET VEHICLES ON FORMAT
  28.         // <- <-  <- <- <- <-
  29.        
  30.         SetVehicleAfterVehicle(vehicleId[0], vehicleId[1]);
  31.         SetVehicleAfterVehicle(vehicleId[1], vehicleId[2]);
  32.         SetVehicleAfterVehicle(vehicleId[2], vehicleId[3]);
  33.         SetVehicleAfterVehicle(vehicleId[3], vehicleId[4]);
  34.         return true;
  35.     }
  36.     return false;
  37. }
  38.  
  39. // FUNCTION
  40. SetVehicleAfterVehicle(vehicleid1, vehicleid2)
  41. {
  42.     new
  43.         Float:vehiclePos[4]
  44.     ;
  45.  
  46.     return (GetVehiclePos(vehicleid1, vehiclePos[0], vehiclePos[1], vehiclePos[2]),     GetVehicleZAngle(vehicleid1, vehiclePos[3]),SetVehiclePos(vehicleid2,  vehiclePos[0] - (floatsin(-vehiclePos[3]+180, degrees) * 5.0), vehiclePos[1] - (floatcos(-vehiclePos[3]+180, degrees) * 5.0), vehiclePos[2] + 1.3),SetVehicleZAngle(vehicleid2, vehiclePos[3]));
  47. }
  48.  
  49. /*
  50.  
  51.     Criado por Bruno da Silva
  52. Este código coloca um carro atrás do outro de forma perfeita através de um calculo rápido
  53.         Bom para races
  54.   www.ips-team.blogspot.com
  55. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement