Advertisement
Guest User

Advanced Vehicle Ownership & Dealership & Commands

a guest
Aug 29th, 2013
2,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 23.73 KB | None | 0 0
  1. public OnPlayerCommandText(playerid, cmdtext[])
  2. {
  3.     if(strcmp("/buyvehicle", cmdtext, true, 10) == 0)
  4.     {
  5.         if(IsPlayerInRangeOfPoint(playerid, 10.0, 919.4584,-1252.2156,16.2109))
  6.         {
  7.             ShowPlayerDialog(playerid,DIALOG_CATEGORY,DIALOG_STYLE_LIST ,"1. Choose a category","Aircrafts\nBikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nSaloons\nSport Vehicles\nStation Wagons\nBoats\nUnique Vehicles","Next","Cancel");
  8.             return 1;
  9.         } else { SendClientMessage(playerid, COLOR_GREY, "Error: {FFFFFF}You are not at the vehicle dealership."); return 1; } // It will return that message if the player isn't at the dealership
  10.     }
  11.     if(strcmp("/vehiclecommands", cmdtext, true, 10) == 0)
  12.     {
  13.         SendClientMessage(playerid, COLOR_GREEN, "________________Vehicle commands:_________________");
  14.         SendClientMessage(playerid, COLOR_GRAD6, "/lock /locateveh /towveh /park /setcolor /setplate");
  15.         SendClientMessage(playerid, COLOR_GREEN, "__________________________________________________");
  16.     }
  17.     if(strcmp("/setplate", cmdtext, true, 10) == 0)
  18.     {
  19.         if(PlayerInfo[playerid][pVehicle1] == 0 && PlayerInfo[playerid][pVehicle2] == 0 && PlayerInfo[playerid][pVehicle3] == 0)
  20.         { SendClientMessage(playerid, COLOR_WHITE, "You do not own any vehicles to change the plate to."); return 1; }
  21.         if(GetPlayerMoney(playerid) < 1000) { SendClientMessage(playerid, COLOR_WHITE, "You need at least $5,000 to change your vehicle plate."); return 1; }
  22.         new x_nr[256];
  23.         x_nr = strtok(cmdtext, idx);
  24.         if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/setplate [1-2-3] [carplate]"); return 1; }
  25.         if(strcmp(x_nr,"1",true) == 0)
  26.         {
  27.             if(PlayerInfo[playerid][pVehicle1] != 0)
  28.             {
  29.                 new vehid;
  30.                 if(GetPlayerVehicleID(playerid) == personalcar1[playerid]) { vehid = personalcar1[playerid]; }
  31.                 else { SendClientMessage(playerid, COLOR_WHITE, "You need to be sat inside your vehicle."); return 1; }
  32.                 if(IsPlayerInVehicle(playerid, vehid))
  33.                 {
  34.                     if(!cmdtext[idx]) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/setplate 1 [carplate]"); }
  35.                     new Float:XX,Float:YY,Float:ZZ,Float:AA;
  36.                     new Float:CarHP, Float:OldCarHP;
  37.                     new panels,tires;
  38.                     GetVehicleHealth(vehid, CarHP);
  39.                     GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
  40.                     OldCarHP = CarHP;
  41.                     format(PlayerInfo[playerid][pVehicle1Plate], 32 ,"%s",cmdtext[idx]);
  42.                     SetVehicleNumberPlate(vehid,PlayerInfo[playerid][pVehicle1Plate]);
  43.                     GetVehiclePos(vehid,XX,YY,ZZ);
  44.                     GetVehicleZAngle(vehid, AA);
  45.                     SetVehicleToRespawn(vehid);
  46.                     SetVehiclePos(vehid,XX,YY,ZZ);
  47.                     SetVehicleZAngle(vehid, AA);
  48.                     PutPlayerInVehicle(playerid,vehid,0);
  49.                     SetVehicleHealth(vehid, OldCarHP);
  50.                     UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
  51.                     format(string, sizeof(string), "You have set your first vehicle's plate to %s, it costed $5,000", PlayerInfo[playerid][pVehicle1Plate]);
  52.                     SendClientMessage(playerid, COLOR_WHITE, string);
  53.                     GivePlayerMoney(playerid, -5000);
  54.                     ChangeVehicleColor(vehid, PlayerInfo[playerid][pVehicle1Color1], PlayerInfo[playerid][pVehicle1Color2]);
  55.                     OnPlayerUpdateEx(playerid);
  56.                 }
  57.                 else { format(string, sizeof(string), "You are not in your first vehicle."); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
  58.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 1."); return 1; }
  59.         }
  60.         else if(strcmp(x_nr,"2",true) == 0)
  61.         {
  62.             if(PlayerInfo[playerid][pVehicle2] != 0)
  63.             {
  64.                 new vehid;
  65.                 if(GetPlayerVehicleID(playerid) == personalcar2[playerid]) { vehid = personalcar2[playerid]; }
  66.                 else { SendClientMessage(playerid, COLOR_WHITE, "You need to be sat inside your vehicle."); return 1; }
  67.                 if(IsPlayerInVehicle(playerid, vehid))
  68.                 {
  69.                     if(!cmdtext[idx]) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/setplate 2 [carplate]"); }
  70.                     new Float:XX,Float:YY,Float:ZZ,Float:AA;
  71.                     new Float:CarHP, Float:OldCarHP;
  72.                     new panels,tires;
  73.                     GetVehicleHealth(vehid, CarHP);
  74.                     GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
  75.                     OldCarHP = CarHP;
  76.                     format(PlayerInfo[playerid][pVehicle2Plate], 32 ,"%s",cmdtext[idx]);
  77.                     SetVehicleNumberPlate(vehid,PlayerInfo[playerid][pVehicle2Plate]);
  78.                     GetVehiclePos(vehid,XX,YY,ZZ);
  79.                     GetVehicleZAngle(vehid, AA);
  80.                     SetVehicleToRespawn(vehid);
  81.                     SetVehiclePos(vehid,XX,YY,ZZ);
  82.                     SetVehicleZAngle(vehid, AA);
  83.                     PutPlayerInVehicle(playerid,vehid,0);
  84.                     SetVehicleHealth(vehid, OldCarHP);
  85.                     UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
  86.                     format(string, sizeof(string), "You have set your second vehicle's plate to %s, it costed $5,000", PlayerInfo[playerid][pVehicle2Plate]);
  87.                     SendClientMessage(playerid, COLOR_WHITE, string);
  88.                     GivePlayerMoney(playerid, -5000);
  89.                     ChangeVehicleColor(vehid, PlayerInfo[playerid][pVehicle2Color1], PlayerInfo[playerid][pVehicle2Color2]);
  90.                     OnPlayerUpdateEx(playerid);
  91.                 }
  92.                 else { format(string, sizeof(string), "You are not in your second vehicle."); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
  93.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 2."); return 1; }
  94.         }
  95.         else if(strcmp(x_nr,"3",true) == 0)
  96.         {
  97.             if(PlayerInfo[playerid][pVehicle3] != 0)
  98.             {
  99.                 new vehid;
  100.                 if(GetPlayerVehicleID(playerid) == personalcar3[playerid]) { vehid = personalcar3[playerid]; }
  101.                 else { SendClientMessage(playerid, COLOR_WHITE, "You need to be sat inside your vehicle."); return 1; }
  102.                 if(IsPlayerInVehicle(playerid, vehid))
  103.                 {
  104.                     if(!cmdtext[idx]) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/setplate 3 [carplate]"); }
  105.                     new Float:XX,Float:YY,Float:ZZ,Float:AA;
  106.                     new Float:CarHP, Float:OldCarHP;
  107.                     new panels,tires;
  108.                     GetVehicleHealth(vehid, CarHP);
  109.                     GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
  110.                     OldCarHP = CarHP;
  111.                     format(PlayerInfo[playerid][pVehicle3Plate], 32 ,"%s",cmdtext[idx]);
  112.                     SetVehicleNumberPlate(vehid,PlayerInfo[playerid][pVehicle3Plate]);
  113.                     GetVehiclePos(vehid,XX,YY,ZZ);
  114.                     GetVehicleZAngle(vehid, AA);
  115.                     SetVehicleToRespawn(vehid);
  116.                     SetVehiclePos(vehid,XX,YY,ZZ);
  117.                     SetVehicleZAngle(vehid, AA);
  118.                     PutPlayerInVehicle(playerid,vehid,0);
  119.                     SetVehicleHealth(vehid, OldCarHP);
  120.                     UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
  121.                     format(string, sizeof(string), "You have set your third vehicle's plate to %s, it costed $5,000", PlayerInfo[playerid][pVehicle3Plate]);
  122.                     SendClientMessage(playerid, COLOR_WHITE, string);
  123.                     GivePlayerMoney(playerid, -5000);
  124.                     ChangeVehicleColor(vehid, PlayerInfo[playerid][pVehicle3Color1], PlayerInfo[playerid][pVehicle3Color2]);
  125.                     OnPlayerUpdateEx(playerid);
  126.                 }
  127.                 else { format(string, sizeof(string), "You are not in your third vehicle."); SendClientMessage(playerid, COLOR_WHITE, string); return 1; }
  128.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 3."); return 1; }
  129.         }
  130.         return 1;
  131.     }
  132.     if(strcmp("/locateveh", cmdtext, true, 10) == 0)
  133.     {
  134.         if(PlayerInfo[playerid][pVehicle1] == 0 && PlayerInfo[playerid][pVehicle2] == 0 && PlayerInfo[playerid][pVehicle3] == 0)
  135.         { SendClientMessage(playerid, COLOR_WHITE, "You do not own any vehicles to locate."); return 1; }
  136.         new x_nr[256];
  137.         x_nr = strtok(cmdtext, idx);
  138.         if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/locateveh [1-2-3]"); return 1; }
  139.         if(strcmp(x_nr,"1",true) == 0)
  140.         {
  141.             if(PlayerInfo[playerid][pVehicle1] != 0)
  142.             {
  143.                 CP[playerid] = 69;
  144.                 new Float:vehx, Float:vehy, Float:vehz; GetVehiclePos(personalcar1[playerid], vehx, vehy, vehz);
  145.                 SetPlayerCheckpoint(playerid, vehx, vehy, vehz, 6.0);
  146.                 SendClientMessage(playerid, COLOR_WHITE, "A checkpoint has been set to your vehicle in slot 1.");
  147.                 return 1;
  148.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 1."); return 1; }
  149.         }
  150.         else if(strcmp(x_nr,"2",true) == 0)
  151.         {
  152.             if(PlayerInfo[playerid][pVehicle2] != 0)
  153.             {
  154.                 CP[playerid] = 69;
  155.                 new Float:vehx, Float:vehy, Float:vehz; GetVehiclePos(personalcar2[playerid], vehx, vehy, vehz);
  156.                 SetPlayerCheckpoint(playerid, vehx, vehy, vehz, 6.0);
  157.                 SendClientMessage(playerid, COLOR_WHITE, "A checkpoint has been set to your vehicle in slot 2.");
  158.                 return 1;
  159.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 2."); return 1; }
  160.         }
  161.         else if(strcmp(x_nr,"3",true) == 0)
  162.         {
  163.             if(PlayerInfo[playerid][pVehicle3] != 0)
  164.             {
  165.                 CP[playerid] = 69;
  166.                 new Float:vehx, Float:vehy, Float:vehz; GetVehiclePos(personalcar3[playerid], vehx, vehy, vehz);
  167.                 SetPlayerCheckpoint(playerid, vehx, vehy, vehz, 6.0);
  168.                 SendClientMessage(playerid, COLOR_WHITE, "A checkpoint has been set to your vehicle in slot 3.");
  169.                 return 1;
  170.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 3."); return 1; }
  171.         }
  172.         return 1;
  173.     }
  174.     if(strcmp("/vehtow", cmdtext, true, 10) == 0)
  175.     {
  176.         if(PlayerInfo[playerid][pVehicle1] == 0 && PlayerInfo[playerid][pVehicle2] == 0 && PlayerInfo[playerid][pVehicle3] == 0)
  177.         { SendClientMessage(playerid, COLOR_WHITE, "You do not own any vehicles to tow."); return 1; }
  178.         if(GetPlayerMoney(playerid) < 1000) { SendClientMessage(playerid, COLOR_WHITE, "You need at least $1,000 to tow a vehicle."); return 1; }
  179.         new x_nr[256];
  180.         x_nr = strtok(cmdtext, idx);
  181.         if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/towveh [1-2-3]"); return 1; }
  182.         if(strcmp(x_nr,"1",true) == 0)
  183.         {
  184.             if(PlayerInfo[playerid][pVehicle1] != 0)
  185.             {
  186.                 new car = personalcar1[playerid];
  187.                 if(CarTow(car)) { SendClientMessage(playerid, COLOR_WHITE, "You towed your vehicle in slot 1 to its last /park position, it costed you $1,000.");
  188.                 GivePlayerMoney(playerid, -1000); SetVehiclePos(car, PlayerInfo[playerid][pVehicle1X], PlayerInfo[playerid][pVehicle1Y], PlayerInfo[playerid][pVehicle1Z]);
  189.                 SetVehicleZAngle(car, PlayerInfo[playerid][pVehicle1C]); }
  190.                 else { SendClientMessage(playerid, COLOR_WHITE, "You can't tow the vehicle because it's in use."); return 1; }
  191.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 1."); return 1; }
  192.         }
  193.         else if(strcmp(x_nr,"2",true) == 0)
  194.         {
  195.             if(PlayerInfo[playerid][pVehicle2] != 0)
  196.             {
  197.                 new car = personalcar2[playerid];
  198.                 if(CarTow(car)) { SendClientMessage(playerid, COLOR_WHITE, "You towed your vehicle in slot 2 to its last /park position, it costed you $1,000.");
  199.                 GivePlayerMoney(playerid, -1000); SetVehiclePos(car, PlayerInfo[playerid][pVehicle2X], PlayerInfo[playerid][pVehicle2Y], PlayerInfo[playerid][pVehicle2Z]);
  200.                 SetVehicleZAngle(car, PlayerInfo[playerid][pVehicle2C]); }
  201.                 else { SendClientMessage(playerid, COLOR_WHITE, "You can't tow the vehicle because it's in use."); return 1; }
  202.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 2."); return 1; }
  203.         }
  204.         else if(strcmp(x_nr,"3",true) == 0)
  205.         {
  206.             if(PlayerInfo[playerid][pVehicle3] != 0)
  207.             {
  208.                 new car = personalcar3[playerid];
  209.                 if(CarTow(car)) { SendClientMessage(playerid, COLOR_WHITE, "You towed your vehicle in slot 3 to its last /park position, it costed you $1,000.");
  210.                 GivePlayerMoney(playerid, -1000); SetVehiclePos(car, PlayerInfo[playerid][pVehicle3X], PlayerInfo[playerid][pVehicle3Y], PlayerInfo[playerid][pVehicle3Z]);
  211.                 SetVehicleZAngle(car, PlayerInfo[playerid][pVehicle3C]); }
  212.                 else { SendClientMessage(playerid, COLOR_WHITE, "You can't tow the vehicle because it's in use."); return 1; }
  213.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 3."); return 1; }
  214.         }
  215.         return 1;
  216.     }
  217.     if(strcmp("/setcolor", cmdtext, true, 10) == 0)
  218.     {
  219.         if(PlayerInfo[playerid][pVehicle1] == 0 && PlayerInfo[playerid][pVehicle2] == 0 && PlayerInfo[playerid][pVehicle3] == 0)
  220.         { SendClientMessage(playerid, COLOR_WHITE, "You do not own any vehicles to change the color of."); return 1; }
  221.         if(GetPlayerMoney(playerid) < 500) { SendClientMessage(playerid, COLOR_WHITE, "You need at least $500 to change your vehicle's color."); return 1; }
  222.         tmp = strtok(cmdtext, idx);
  223.         if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/setcolor [color1] [color2]"); return 1; }
  224.         new color1;
  225.         color1 = strval(tmp);
  226.         if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_WHITE, "The first color cannot be below 0 or above 126."); return 1; }
  227.         tmp = strtok(cmdtext, idx);
  228.         if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/setcolor [color1] [color2]"); return 1; }
  229.         new color2;
  230.         color2 = strval(tmp);
  231.         if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_WHITE, "The second color cannot be below 0 or above 126."); return 1; }
  232.         new vehid, vehid2, vehid3;
  233.         if(GetPlayerVehicleID(playerid) == personalcar1[playerid]) { vehid = personalcar1[playerid]; }
  234.         else if(GetPlayerVehicleID(playerid) == personalcar2[playerid]) { vehid2 = personalcar2[playerid]; }
  235.         else if(GetPlayerVehicleID(playerid) == personalcar3[playerid]) { vehid3 = personalcar3[playerid]; }
  236.         else { SendClientMessage(playerid, COLOR_WHITE, "You need to be sat inside your vehicle."); return 1; }
  237.         if(IsPlayerInVehicle(playerid, vehid)) { PlayerInfo[playerid][pVehicle1Color1] = color1; PlayerInfo[playerid][pVehicle1Color2] = color2;
  238.         GivePlayerMoney(playerid, -500); format(string, sizeof(string), "You changed this car to color %d and %d.", color1, color2);
  239.         SendClientMessage(playerid, COLOR_WHITE, string); ChangeVehicleColor(vehid, color1, color2); OnPlayerUpdateEx(playerid); return 1; }
  240.         else if(IsPlayerInVehicle(playerid, vehid2)) { PlayerInfo[playerid][pVehicle2Color1] = color1; PlayerInfo[playerid][pVehicle2Color2] = color2;
  241.         GivePlayerMoney(playerid, -500); format(string, sizeof(string), "You changed this car to color %d and %d.", color1, color2);
  242.         SendClientMessage(playerid, COLOR_WHITE, string); ChangeVehicleColor(vehid2, color1, color2); OnPlayerUpdateEx(playerid); return 1; }
  243.         else if(IsPlayerInVehicle(playerid, vehid3)) { PlayerInfo[playerid][pVehicle3Color1] = color1; PlayerInfo[playerid][pVehicle3Color2] = color2;
  244.         GivePlayerMoney(playerid, -500); format(string, sizeof(string), "You changed this car to color %d and %d.", color1, color2);
  245.         SendClientMessage(playerid, COLOR_WHITE, string); ChangeVehicleColor(vehid3, color1, color2); OnPlayerUpdateEx(playerid); return 1; }
  246.         else { SendClientMessage(playerid, COLOR_WHITE, "You need to be sat in your vehicle to use this command."); return 1; }
  247.     }
  248.     if(strcmp("/lock", cmdtext, true, 10) == 0)
  249.     {
  250.         if(PlayerInfo[playerid][pVehicle1] == 0 && PlayerInfo[playerid][pVehicle2] == 0 && PlayerInfo[playerid][pVehicle3] == 0)
  251.         { SendClientMessage(playerid, COLOR_WHITE, "You do not own any vehicles to lock or unlock."); return 1; }
  252.         new x_nr[256];
  253.         x_nr = strtok(cmdtext, idx);
  254.         if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/lock [1-2-3]"); return 1; }
  255.         if(strcmp(x_nr,"1",true) == 0)
  256.         {
  257.             if(PlayerInfo[playerid][pVehicle1] != 0)
  258.             {
  259.                 if(PlayerInfo[playerid][pVehicle1Lock] == 0)
  260.                 {
  261.                     GetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  262.                     SetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
  263.                     PlayerInfo[playerid][pVehicle1Lock] = 1;
  264.                     GameTextForPlayer(playerid, "~w~vehicle 1~r~ LOCKED", 3000, 6);
  265.                     OnPlayerUpdateEx(playerid);
  266.                     return 1;
  267.                 }
  268.                 else if(PlayerInfo[playerid][pVehicle1Lock] != 0)
  269.                 {
  270.                     GetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  271.                     SetVehicleParamsEx(personalcar1[playerid], engine, lights, alarm, 0, bonnet, boot, objective);
  272.                     PlayerInfo[playerid][pVehicle1Lock] = 0;
  273.                     GameTextForPlayer(playerid, "~w~vehicle 1~g~ UNLOCKED", 3000, 6);
  274.                     OnPlayerUpdateEx(playerid);
  275.                     return 1;
  276.                 }
  277.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 1."); return 1; }
  278.         }
  279.         else if(strcmp(x_nr,"2",true) == 0)
  280.         {
  281.             if(PlayerInfo[playerid][pVehicle2] != 0)
  282.             {
  283.                 if(PlayerInfo[playerid][pVehicle2Lock] == 0)
  284.                 {
  285.                     GetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  286.                     SetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
  287.                     PlayerInfo[playerid][pVehicle2Lock] = 1;
  288.                     GameTextForPlayer(playerid, "~w~vehicle 2~r~ LOCKED", 3000, 6);
  289.                     OnPlayerUpdateEx(playerid);
  290.                     return 1;
  291.                 }
  292.                 else if(PlayerInfo[playerid][pVehicle2Lock] != 0)
  293.                 {
  294.                     GetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  295.                     SetVehicleParamsEx(personalcar2[playerid], engine, lights, alarm, 0, bonnet, boot, objective);
  296.                     PlayerInfo[playerid][pVehicle2Lock] = 0;
  297.                     GameTextForPlayer(playerid, "~w~vehicle 2~g~ UNLOCKED", 3000, 6);
  298.                     OnPlayerUpdateEx(playerid);
  299.                     return 1;
  300.                 }
  301.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 2."); return 1; }
  302.         }
  303.         else if(strcmp(x_nr,"3",true) == 0)
  304.         {
  305.             if(PlayerInfo[playerid][pVehicle3] != 0)
  306.             {
  307.                 if(PlayerInfo[playerid][pVehicle3Lock] == 0)
  308.                 {
  309.                     GetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  310.                     SetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, 1, bonnet, boot, objective);
  311.                     PlayerInfo[playerid][pVehicle3Lock] = 1;
  312.                     GameTextForPlayer(playerid, "~w~vehicle 3~r~ LOCKED", 3000, 6);
  313.                     OnPlayerUpdateEx(playerid);
  314.                     return 1;
  315.                 }
  316.                 else if(PlayerInfo[playerid][pVehicle3Lock] != 0)
  317.                 {
  318.                     GetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
  319.                     SetVehicleParamsEx(personalcar3[playerid], engine, lights, alarm, 0, bonnet, boot, objective);
  320.                     PlayerInfo[playerid][pVehicle3Lock] = 0;
  321.                     GameTextForPlayer(playerid, "~w~vehicle 3~g~ UNLOCKED", 3000, 6);
  322.                     OnPlayerUpdateEx(playerid);
  323.                     return 1;
  324.                 }
  325.             } else { SendClientMessage(playerid, COLOR_WHITE, "You don't have a vehicle on slot 3."); return 1; }
  326.         }
  327.         return 1;
  328.     }
  329.     if(strcmp("/park", cmdtext, true, 10) == 0)
  330.     {
  331.         if(PlayerInfo[playerid][pVehicle1] == 0 && PlayerInfo[playerid][pVehicle2] == 0 && PlayerInfo[playerid][pVehicle3] == 0)
  332.         { SendClientMessage(playerid, COLOR_WHITE, "You do not own any vehicles to park."); return 1; }
  333.         new vehid, vehid2, vehid3;
  334.         if(GetPlayerVehicleID(playerid) == personalcar1[playerid]) { vehid = personalcar1[playerid]; }
  335.         else if(GetPlayerVehicleID(playerid) == personalcar2[playerid]) { vehid2 = personalcar2[playerid]; }
  336.         else if(GetPlayerVehicleID(playerid) == personalcar3[playerid]) { vehid3 = personalcar3[playerid]; }
  337.         else { SendClientMessage(playerid, COLOR_WHITE, "You need to be sat in your vehicle to use this command."); return 1; }
  338.         if(IsPlayerInVehicle(playerid, vehid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  339.         {
  340.             new Float:x,Float:y,Float:z,Float:a;
  341.             GetVehiclePos(vehid, x, y, z);
  342.             GetVehicleZAngle(vehid, a);
  343.             PlayerInfo[playerid][pVehicle1X] = x;
  344.             PlayerInfo[playerid][pVehicle1Y] = y;
  345.             PlayerInfo[playerid][pVehicle1Z] = z;
  346.             PlayerInfo[playerid][pVehicle1C] = a;
  347.             OnPlayerUpdateEx(playerid);
  348.             DestroyVehicle(personalcar1[playerid]);
  349.             new model1 = PlayerInfo[playerid][pVehicle1Model];
  350.             new car1color1 = PlayerInfo[playerid][pVehicle1Color1];
  351.             new car1color2 = PlayerInfo[playerid][pVehicle1Color2];
  352.             personalcar1[playerid] = CreateVehicle(model1, Float:x, Float:y, Float:z, Float:a, car1color1, car1color2, 999999);
  353.             SetVehicleNumberPlate(personalcar1[playerid], PlayerInfo[playerid][pVehicle1Plate]);
  354.             TogglePlayerControllable(playerid, 1);
  355.             PutPlayerInVehicle(playerid, vehid, 0);
  356.             SendClientMessage(playerid, COLOR_WHITE, "You parked your car here, it will respawn at this position.");
  357.             return 1;
  358.         }
  359.         else if(IsPlayerInVehicle(playerid, vehid2) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  360.         {
  361.             new Float:x,Float:y,Float:z,Float:a;
  362.             GetVehiclePos(vehid2, x, y, z);
  363.             GetVehicleZAngle(vehid2, a);
  364.             PlayerInfo[playerid][pVehicle2X] = x;
  365.             PlayerInfo[playerid][pVehicle2Y] = y;
  366.             PlayerInfo[playerid][pVehicle2Z] = z;
  367.             PlayerInfo[playerid][pVehicle2C] = a;
  368.             OnPlayerUpdateEx(playerid);
  369.             DestroyVehicle(personalcar2[playerid]);
  370.             new model2 = PlayerInfo[playerid][pVehicle2Model];
  371.             new car2color1 = PlayerInfo[playerid][pVehicle2Color1];
  372.             new car2color2 = PlayerInfo[playerid][pVehicle2Color2];
  373.             personalcar2[playerid] = CreateVehicle(model2, Float:x, Float:y, Float:z, Float:a, car2color1, car2color2, 999999);
  374.             SetVehicleNumberPlate(personalcar2[playerid], PlayerInfo[playerid][pVehicle2Plate]);
  375.             TogglePlayerControllable(playerid, 1);
  376.             PutPlayerInVehicle(playerid, vehid2, 0);
  377.             SendClientMessage(playerid, COLOR_WHITE, "You parked your car here, it will respawn at this position.");
  378.             return 1;
  379.         }
  380.         else if(IsPlayerInVehicle(playerid, vehid3) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  381.         {
  382.             new Float:x,Float:y,Float:z,Float:a;
  383.             GetVehiclePos(vehid3, x, y, z);
  384.             GetVehicleZAngle(vehid3, a);
  385.             PlayerInfo[playerid][pVehicle3X] = x;
  386.             PlayerInfo[playerid][pVehicle3Y] = y;
  387.             PlayerInfo[playerid][pVehicle3Z] = z;
  388.             PlayerInfo[playerid][pVehicle3C] = a;
  389.             OnPlayerUpdateEx(playerid);
  390.             DestroyVehicle(personalcar3[playerid]);
  391.             new model3 = PlayerInfo[playerid][pVehicle3Model];
  392.             new car3color1 = PlayerInfo[playerid][pVehicle3Color1];
  393.             new car3color2 = PlayerInfo[playerid][pVehicle3Color2];
  394.             personalcar3[playerid] = CreateVehicle(model3, Float:x, Float:y, Float:z, Float:a, car3color1, car3color2, 999999);
  395.             SetVehicleNumberPlate(personalcar3[playerid], PlayerInfo[playerid][pVehicle3Plate]);
  396.             TogglePlayerControllable(playerid, 1);
  397.             PutPlayerInVehicle(playerid, vehid3, 0);
  398.             SendClientMessage(playerid, COLOR_WHITE, "You parked your car here, it will respawn at this position.");
  399.             return 1;
  400.         }
  401.         else { SendClientMessage(playerid, COLOR_WHITE, "You need to be sat in your vehicle to use this command."); return 1; }
  402.     }
  403. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement