Guest User

Untitled

a guest
Apr 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.68 KB | None | 0 0
  1. #define MAX_FACTIONS 10
  2. new FactionCar[MAX_VEHICLES][MAX_FACTIONS];
  3.  
  4. public OnGameModeInit()
  5. {
  6.     for(new f = 1; f < MAX_FACTIONS; f++)
  7.     {
  8.         new cars[17]; format(cars, sizeof(cars), "/cars/factions/%d", f); // Looping factions
  9.         if(dini_Exists(cars)) // if the faction exists
  10.         {
  11.             new fcar[21];
  12.             for(new c = 1; c < 10; c++) // looping car (max 10 faction cars per faction)
  13.             {
  14.                 new vehid;
  15.                 format(fcar, sizeof(fcar), "/cars/factions/%d/%d", f, c); // formating values
  16.                 FactionCar[vehid][f] = AddStaticVehicleEx(dini_Int(fcar, "Model"), dini_Float(fcar, "SpawnX"), dini_Float(fcar, "SpawnY"), dini_Float(fcar, "SpawnZ"), dini_Float(fcar, "SpawnA"), dini_Int(fcar, "Color1"), dini_Int(fcar, "Color2"), 99999);
  17.             }
  18.         }
  19.     }
  20.  
  21. CMD:engine(playerid, input[])
  22. {
  23.     if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, " You are not in any vehicle!");
  24.    
  25.     new vehicleid = GetPlayerVehicleID(playerid);
  26.     new engine, lights, alarm, doors, bonnet, boot, objective;
  27.     GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  28.    
  29.     new fac;
  30.     if(FactionCar[vehicleid][fac] == Faction[playerid])
  31.     {
  32.         if(!engine)
  33.         {
  34.             SendMeWrap(playerid, "starts the engine of the vehicle");
  35.             SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
  36.             GameTextForPlayer(playerid, "~g~Engine on!", 3000, 4);
  37.         }
  38.         else
  39.         {
  40.             SendMeWrap(playerid, "shuts off the engine of the vehicle");
  41.             SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
  42.             GameTextForPlayer(playerid, "~r~Engine off!", 3000, 4);
  43.         }
  44.         return 1;
  45.     }
Add Comment
Please, Sign In to add comment