/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
#2

If you mean model of the vehicle (for example, infernus)
pawn Код:
if( /* IT'S SALESCAR.. CHECK IT */ )
{
    new
        modelid
    ;
    If( IsPlayerInAnyVehicle( playerid ) ) modelid = GetVehicleModel( GetPlayerVehicleID( playerid ) );

    // Do what you want to do; the modelid is stored to "modelid"
}
Else if you mean vehicle id (for example, 0 (first car was created))
pawn Код:
if( /* IT'S SALESCAR.. CHECK IT */ )
{
    new
        vehicleid
    ;
    If( IsPlayerInAnyVehicle( playerid ) ) vehicleid= GetPlayerVehicleID( playerid );

    // Do what you want to do; the vehicleid is stored to "vehicleid"
}
Reply
#3

Can you please edit my cmd so I will get the vehicle? I've been working on this for ages now and still without success... I want the player to buy the vehicle he sits in when he types the cmd. Example if he is in vehicle ID 23 he will become the owner of vehicle ID 23
Reply
#4

That is just Ravens Roleplay code and the vehicle system in that script like the script it's self is trash your wasting your time Don_Cage.
Reply
#5

I have edited the whole system. This is the last part. I'm not wasting my time with this since everyone allways says that but still this is the last part in the whole GM that needs a fix. After that I've managed to fix every bug ever seen in the script.
So please if someone could edit the cmd for this it would be very good!
Reply
#6

I don't think so, that whole gamemode is a bug there is no hope of fixing it if you think that you've made headway you have not the fundamental design of that script is the main problem.
Reply
#7

Nothing is "forever bugged". If a bug can be made it can also be deleted. I have only the vehicle system that still is bugged now. Once I get help in fixing that I would be happy to show you so you can see it with your own eyes.
But even if you belive it or not. What harm would it do to help me?
Reply
#8

Did you not read what I said? THE FUNDAMENTAL DESIGN is the problem you'd have to re-write that entire script from top to bottom. There is no harm but your just wasting your time plain and simple for a script that isn't worth a ball of shit off my ass hair.
Reply
#9

Ok, Some success has been made now. The vehicle belongs to me but only after server restart. Which means that it does not change the owner right away. I need to gmx the server each time... Please help me with this last part now.
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 = GetPlayerVehicleID(playerid); 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;
                            CuvajVozilo(idcar);
                            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


Forum Jump:


Users browsing this thread: 6 Guest(s)