Jump to content
  • 0

Problema slot masina


Mark S.

Question

Problema intalnita (descriere): Buna ziua, am incercat sa adaug un slot pentru vehiculele personale si acum playerul poate cumpara cate vrea, problema este ca prima masina se cumpara bine a doua la fel se salveaza in stats iar la a treia masina nu se salveaza in stats nu salveaza carkey3 = idulmasinii.
Ero(area / rile) / warning-(ul / urile):-
Liniile de cod / sursa / script-ul:

aceasta este comanda originala pe care ai dou sloturi 

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] = 93.3057;
                                CarInfo[car][cLocationy] = 2502.0701;
                                CarInfo[car][cLocationz] = 16.4007;
                                CarInfo[car][cAngle] = 208.7506;
                                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!");
                                SetPlayerCheckpoint(playerid, 93.3057,2502.0701,16.4007, 3.0);
                                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] = 225.8744;
                                CarInfo[car][cLocationy] = -1912.4093;
                                CarInfo[car][cLocationz] = 1.0907;
                                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!");
                                SetPlayerCheckpoint(playerid, 225.8744, -1912.4093, 1.0907, 3.0);
                                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!");
                                SetPlayerCheckpoint(playerid, -1589.2644,106.91193,3.5495, 3.0);
                                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][cGas] = 0;
                            CarInfo[car][cparcare] = 0;
                            CarInfo[car][cinparcare] = 0;
                               VehicleKM[car] = 0;

                            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!");
                            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;
                    }
                }
            }

iar eu am incercat sa schimb din asta 

if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = car; }
                            else { PlayerInfo[playerid][pPcarkey] = car; }

in asta

if(PlayerInfo[playerid][pPcarkey] == 9999)
                                {
                                    PlayerInfo[playerid][pPcarkey2] = car;
                                   }
                                   else if(PlayerInfo[playerid][pPcarkey2] == 9999)
                                {
                                    PlayerInfo[playerid][pPcarkey3] = car;
                                   }
                                else if(PlayerInfo[playerid][pPcarkey] == 9999)
                                {
                                    PlayerInfo[playerid][pPcarkey3] = car;
                                }

Si nu se salveaza slot 3.

 

 


Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Da

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
if( PlayerInfo[ playerid ][ pPcarkey ] != 9999 || PlayerInfo[ playerid ][ pPcarkey2 ] != 9999 || PlayerInfo[ playerid ][ pPcarkey3 ] != 9999 )
	return SendClientMessage( playerid -1, "Nu mai ai slot-uri disponibile pentru a cumpara alta masina." );

if(PlayerInfo[ playerid ][ pPcarkey ] == 9999)
{
	PlayerInfo[ playerid ][ pPcarkey ] = car;
}
else if(PlayerInfo[ playerid ][ pPcarkey2 ] == 9999)
{
	PlayerInfo[ playerid ][ pPcarkey2 ] = car;
}
else if( PlayerInfo[ playerid ][ pPcarkey3 ] == 9999 )
{
    switch( PlayerInfo[ playerid ] [ pVip ] )
	{
		case 0: SendClientMessage( playerid -1, "Trebuie sa fii VIP pentru a folosi al 3-lea slot!" );
		case 1: PlayerInfo[ playerid ][ pPcarkey3 ] = car;
	}
}

server.php

Link to comment
Share on other sites

  • 0

if( PlayerInfo[playerid][pPcarkey] != 9999 || PlayerInfo[playerid][pPcarkey2] != 9999 || PlayerInfo[playerid][pPcarkey3] != 9999) return SendClientMessage( playeridm -1, "Nu mai ai slot-uri disponibile pentru a cumpara alta masina." );

if(PlayerInfo[playerid][pPcarkey] == 9999)
{
    PlayerInfo[playerid][pPcarkey] = car;
}
else if(PlayerInfo[playerid][pPcarkey2] == 9999)
{
    PlayerInfo[playerid][pPcarkey2] = car;
}
else if( PlayerInfo[ playerid ][ pPcarkey3 ] == 9999 )
{
    PlayerInfo[ playerid ][ pPcarkey3 ] = car;
}

Ia vezi acum.

I'm back bitches.

Link to comment
Share on other sites

  • 0

da am adaugat carkey3

Merge, si am o nedumerire daca playerul este vip vreau sa poate sa cumpere pana la slot 3 iar daca vip == 0  sa poata doar 2

am incercat asa dar nu cred ca e bine.

 

aici la inceput cu verde pun conditiile de vip?la

 

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][pPcarkey3] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999)
                    {

 

am incercat sa pun asa dar nu cred ca e bine.

    if(PlayerInfo[playerid][pVip] == 1)
                    {
                        if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey3] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999)
                    }
                    else if(PlayerInfo[playerid][pVip] == 0)
                    {
                        if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999)
                    }
Link to comment
Share on other sites

  • 0

Poftim, asta este ultimul meu post in acest topic.

if( PlayerInfo[playerid][pPcarkey] != 9999 || PlayerInfo[playerid][pPcarkey2] != 9999 || PlayerInfo[playerid][pPcarkey3] != 9999) return SendClientMessage( playeridm -1, "Nu mai ai slot-uri disponibile pentru a cumpara alta masina." );

if(PlayerInfo[playerid][pPcarkey] == 9999)
{
  PlayerInfo[playerid][pPcarkey] = car;
}
else if(PlayerInfo[playerid][pPcarkey2] == 9999)
{
  PlayerInfo[playerid][pPcarkey2] = car;
}
else if( PlayerInfo[ playerid ][ pPcarkey3 ] == 9999 && PlayerInfo[ playerid ][ pVip ] != 0 )
{
  PlayerInfo[ playerid ][ pPcarkey3 ] = car;
}

I'm back bitches.

Link to comment
Share on other sites

  • 0

 

Poftim, asta este ultimul meu post in acest topic.

if( PlayerInfo[playerid][pPcarkey] != 9999 || PlayerInfo[playerid][pPcarkey2] != 9999 || PlayerInfo[playerid][pPcarkey3] != 9999) return SendClientMessage( playeridm -1, "Nu mai ai slot-uri disponibile pentru a cumpara alta masina." );

if(PlayerInfo[playerid][pPcarkey] == 9999)
{
  PlayerInfo[playerid][pPcarkey] = car;
}
else if(PlayerInfo[playerid][pPcarkey2] == 9999)
{
  PlayerInfo[playerid][pPcarkey2] = car;
}
else if( PlayerInfo[ playerid ][ pPcarkey3 ] == 9999 && PlayerInfo[ playerid ][ pVip ] != 0 )
{
  PlayerInfo[ playerid ][ pPcarkey3 ] = car;
}

Nu merge

 

nu vad scopul iful asta if( PlayerInfo[playerid][pPcarkey] != 9999 || PlayerInfo[playerid][pPcarkey2] != 9999 || PlayerInfo[playerid][pPcarkey3] != 9999) return SendClientMessage( playeridm -1, "Nu mai ai slot-uri disponibile pentru a cumpara alta masina." );

 

eu am asa si merge sa cumpar 3 sloturi

 

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][pPcarkey3] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999)

                    {

                         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] != 9999) return SendClientMessage( playerid, -1, "Nu mai ai slot-uri disponibile pentru a cumpara alta masina." );

                                if(PlayerInfo[playerid][pPcarkey] == 9999)

                                {

                                  PlayerInfo[playerid][pPcarkey] = car;

                                }

                                else if(PlayerInfo[playerid][pPcarkey2] == 9999)

                                {

                                  PlayerInfo[playerid][pPcarkey2] = 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] = 93.3057;

                                    CarInfo[car][cLocationy] = 2502.0701;

                                    CarInfo[car][cLocationz] = 16.4007;

                                    CarInfo[car][cAngle] = 208.7506;

                                    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!");

                                    SetPlayerCheckpoint(playerid, 93.3057,2502.0701,16.4007, 3.0);

                                    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] = 225.8744;

                                    CarInfo[car][cLocationy] = -1912.4093;

                                    CarInfo[car][cLocationz] = 1.0907;

                                    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!");

                                    SetPlayerCheckpoint(playerid, 225.8744, -1912.4093, 1.0907, 3.0);

                                    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!");

                                    SetPlayerCheckpoint(playerid, -1589.2644,106.91193,3.5495, 3.0);

                                    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][cGas] = 0;

                                CarInfo[car][cparcare] = 0;

                                CarInfo[car][cinparcare] = 0;

                                   VehicleKM[car] = 0;

                                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!");

                                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;

                        }

                    }

                    else if(PlayerInfo[playerid][pPcarkey] != 9999 && PlayerInfo[playerid][pPcarkey3] != 9999 && PlayerInfo[playerid][pPcarkey2] != 9999)

                    {

                        SendClientMessage(playerid, COLOR_GREY, "  Nu ai sloturi! ");

                        return 1;

                    }

                }

            }

 

Cum sa fac ca daca ai pvip == 0 sa poti cumpara doar 2 sloturi?

Edited by Selby
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.