/v buy
#1

I want to make it so when I type /v buy I get the exact vehicle that I sit in. (If it's a salescar)
But I can't seem to make it... I'm now turning to you with hopes that you may help me.
pawn Код:
else if(strcmp(x_nr,"buy",true) == 0)
            {
                if(IsASalesVehicle(idcar))
                {
                    if(PlayerInfo[playerid][pLevel] < 2)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You need to be level 2 to buy a vehicle!");
                        return 1;
                    }
                    new sellstring[24];
                    if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999 || PlayerInfo[playerid][pPcarkey3] == 9999) { }
                    else return SendClientMessage(playerid, COLOR_GREY,"* You already own three cars!");
                    if(GetPlayerMoney(playerid) >= CarInfo[idcar][cPrice])
                    {
                        if(PlayerInfo[playerid][pCarLic] == 1)
                        {
                            for(new h = 1; h < sizeof(CarInfo); h++)
                            {
                                if(CarInfo[h][cOwned] == 0)
                                {
                                    idcar = h;
                                    h = 9999;
                                }
                            }

                            if(PlayerInfo[playerid][pPcarkey] == 9999) { PlayerInfo[playerid][pPcarkey] = idcar; }
                            else if(PlayerInfo[playerid][pPcarkey2] == 9999) { PlayerInfo[playerid][pPcarkey2] = idcar; }
                            else if(PlayerInfo[playerid][pPcarkey3] == 9999) { PlayerInfo[playerid][pPcarkey3] = idcar; }
                            else { PlayerInfo[playerid][pPcarkey] = idcar; }
                            CarInfo[idcar][cOwned] = 1;
                            strmid(CarInfo[idcar][cOwner], sendername, 0, strlen(sendername), 999);
                            SafeGivePlayerMoney(playerid,-CarInfo[idcar][cPrice]);
                            PlayerPlayMusic(playerid);
                            format(sellstring, sizeof(sellstring),"LARP/Vehicles/%d.ini",idcar)
                            dini_Create(sellstring);
                            dini_IntSet(sellstring,"Model",CarInfo[idcar][cModel]);
                            dini_FloatSet(sellstring,"Location_X",CarInfo[idcar][cLocationx]);
                            dini_FloatSet(sellstring,"Location_Y",CarInfo[idcar][cLocationy]);
                            dini_FloatSet(sellstring,"Location_Z",CarInfo[idcar][cLocationz]);
                            dini_FloatSet(sellstring,"Angle",CarInfo[idcar][cAngle]);
                            dini_IntSet(sellstring,"Color_1",CarInfo[idcar][cColorOne]);
                            dini_IntSet(sellstring,"Color_2",CarInfo[idcar][cColorTwo]);
                            dini_IntSet(sellstring,"Component0",CarInfo[idcar][cComponent0]);
                            dini_IntSet(sellstring,"Component1",CarInfo[idcar][cComponent1]);
                            dini_IntSet(sellstring,"Component2",CarInfo[idcar][cComponent2]);
                            dini_IntSet(sellstring,"Component3",CarInfo[idcar][cComponent3]);
                            dini_IntSet(sellstring,"Component4",CarInfo[idcar][cComponent4]);
                            dini_IntSet(sellstring,"Component5",CarInfo[idcar][cComponent5]);
                            dini_IntSet(sellstring,"Component6",CarInfo[idcar][cComponent6]);
                            dini_IntSet(sellstring,"Component7",CarInfo[idcar][cComponent7]);
                            dini_IntSet(sellstring,"Component8",CarInfo[idcar][cComponent8]);
                            dini_IntSet(sellstring,"Component9",CarInfo[idcar][cComponent9]);
                            dini_IntSet(sellstring,"Component10",CarInfo[idcar][cComponent10]);
                            dini_IntSet(sellstring,"Component11",CarInfo[idcar][cComponent11]);
                            dini_IntSet(sellstring,"Component12",CarInfo[idcar][cComponent12]);
                            dini_IntSet(sellstring,"Component13",CarInfo[idcar][cComponent13]);

                            /*format(string, sizeof(string),"LARP/Vehicles/SalesCarID%d.ini",idcar);
                            fremove(string);*/

                           
                            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;
                            OnPropUpdate(4,idcar);
                            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;
                    }
                }
            }
Reply


Messages In This Thread
/v buy - by Don_Cage - 03.09.2013, 19:00
Re: /v buy - by Konstantinos - 03.09.2013, 19:09
Re: /v buy - by Don_Cage - 03.09.2013, 19:38
Re: /v buy - by Pottus - 03.09.2013, 19:41
Re: /v buy - by Don_Cage - 03.09.2013, 19:44
Re: /v buy - by Pottus - 03.09.2013, 19:55
Re: /v buy - by Don_Cage - 03.09.2013, 20:06
Re: /v buy - by Pottus - 03.09.2013, 20:22
Re: /v buy - by Don_Cage - 04.09.2013, 11:35

Forum Jump:


Users browsing this thread: 5 Guest(s)