SA-MP Forums Archive
SAMP Defining one car like another after command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SAMP Defining one car like another after command (/showthread.php?tid=446057)



SAMP Defining one car like another after command - Zigonja - 24.06.2013

Okay, I have some problems, I don't know how to start this, and if it's even possible. I have some cars that are on sale (IsASalesCar) and when I /v buy it, it spawns somewhere and that car I was in it stays where it was. That's actually working, but I want to make is to when I /v buy it it, it wouldn't teleport anywhere, but stay on the position, and become (IsAOwnedCar), apart from new one being created. I've already made the command to add (IsASalesCar) in game.

I don't see the matter of showing the code, because it's just normal Raven's roleplay script.


Re: SAMP Defining one car like another after command - introzen - 24.06.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
for reference, I read your problem, got interested, saw you hadn't included code because you said it was just a regular game mode, can't be bothered with going out of my way to search for and find said code to read, and am now leaving this topic again.
+1..


Re: SAMP Defining one car like another after command - Zigonja - 24.06.2013

Okay, sorry

pawn Код:
//These are the enums:
new CarInfo[600][cInfo];

// CARS
new armycar[32];
new governcar[5];
new copcar[37];
new swatcar[11];
new vicecar[13];
new fbicar[20];
new tacticalcar[8];
new ambulance[8];
new surenoscar[16];
new signatracar[14];
new fdcar[16];
new harvest[4];
new drugharvest[4];
new yamaguchicar[13];
new bratvacar[6];
new specialfcar[7];
new ownedcar[sizeof(CarInfo)];
new admincar[2];
new developercar[52];
new anarchybike[15];
new salescar[147];
new hitmencar[14];
new Rentveh[40];
new createdcar[MAX_VEHICLES];
// CARS

// And this is the /v buy code I want to change
            else if(strcmp(x_nr,"buy",true) == 0)
            {
                new car = 1;
                new model = GetVehicleModel(idcar);
                if(IsASalesVehicle(idcar))
                {
                    if(PlayerInfo[playerid][pLevel] < 2)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You need to be level 2 to buy a vehicle!");
                        return 1;
                    }
                    if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999) { }
                    else return SendClientMessage(playerid, COLOR_GREY,"* You already own Two cars!");
                    if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
                    {
                        if(PlayerInfo[playerid][pCarLic] == 1)
                        {
                            for(new h = 1; h < sizeof(CarInfo); h++)
                            {
                                if(CarInfo[h][cOwned] == 0)
                                {
                                    car = h;
                                    h = 9999;
                                }
                            }
                            format(string, sizeof(string),"LARP/Vehicles/%d.ini",car)
                            dini_Create(string);

                            if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = car; }
                            else { PlayerInfo[playerid][pPcarkey] = car; }
                            CarInfo[car][cOwned] = 1;
                            strmid(CarInfo[car][cOwner], sendername, 0, strlen(sendername), 999);
                            SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar));
                            if(IsModelAPlane(idcar) || IsModelAHeli(idcar))
                            {
                                CarInfo[car][cLocationx] = 1432.6451;
                                CarInfo[car][cLocationy] = 1378.7216;
                                CarInfo[car][cLocationz] = 11.5507;
                                CarInfo[car][cAngle] = 359.2072;
                                SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Las Venturas Airport, you can get it there!");
                                SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
                                SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
                                GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~Las Venturas Airport!", 5000, 3);
                            }
                            else if(IsModelABoat(idcar))
                            {
                                CarInfo[car][cLocationx] = -1568.9614;
                                CarInfo[car][cLocationy] = 169.0118;
                                CarInfo[car][cLocationz] = -0.6016;
                                CarInfo[car][cAngle] = 208.7506;
                                SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to San Fierro Docks, you can get it there!");
                                SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
                                SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
                                GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3);
                            }
                            else
                            {
                                CarInfo[car][cLocationx] = -1589.2644;
                                CarInfo[car][cLocationy] = 106.9119;
                                CarInfo[car][cLocationz] = 3.5495;
                                CarInfo[car][cAngle] = 317.1649;
                                SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to San Fierro Docks, you can get it there!");
                                SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
                                SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
                                GameTextForPlayer(playerid, "~p~Congratulations~n~~w~Don't forget to pickup your car at the ~b~San Fierro Docks!", 5000, 3);
                            }
                            CarInfo[car][cModel] = model;
                            CarInfo[car][cVirWorld] = 0;
                            CarInfo[car][cPaintjob] = 999;
                           
                            CarInfo[car][cColorOne] = 1;
                            CarInfo[car][cColorTwo] = 1;
                           
                            CarInfo[car][cComponent0] = 0;
                            CarInfo[car][cComponent1] = 0;
                            CarInfo[car][cComponent2] = 0;
                            CarInfo[car][cComponent3] = 0;
                            CarInfo[car][cComponent4] = 0;
                            CarInfo[car][cComponent5] = 0;
                            CarInfo[car][cComponent6] = 0;
                            CarInfo[car][cComponent7] = 0;
                            CarInfo[car][cComponent8] = 0;
                            CarInfo[car][cComponent9] = 0;
                            CarInfo[car][cComponent10] = 0;
                            CarInfo[car][cComponent11] = 0;
                            CarInfo[car][cComponent12] = 0;
                            CarInfo[car][cComponent13] = 0;
                            //DestroyVehicle(car);
                            ownedcar[car] = CreateVehicle(CarInfo[car][cModel],CarInfo[car][cLocationx],CarInfo[car][cLocationy],CarInfo[car][cLocationz],90.0,1,1,30000);
                            PlayerPlayMusic(playerid);
                            SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!");
                            SendClientMessage(playerid, COLOR_GRAD2, "Type /vehiclehelp to view the vehicle manual!");
                            gEngine[playerid] = 0;
                            engineOn[GetPlayerVehicleID(playerid)] = false;
                            SendClientMessage(playerid, COLOR_GREY, "Remember to set the new Security Code of the Car (/v setcode)!");
                            new pass[24];
                            format(pass, sizeof(pass),"%d%d%d",random(9),random(9),random(9));
                            CarInfo[car][cCode] = strval(pass);
                            OnPropUpdate(4,car);
                            OnPlayerUpdateEx(playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "* For security reasons, a Driving License is needed to buy a car!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "  You don't have enough cash with you ! ");
                        return 1;
                    }
                }
            }