• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] [SOLVED] how make a correct IF function with for parameter vehicle ID == enum id
#1
SOLUTION:

Code:
stock IsPlayerInDealerVehicle(playerid)



{



new s; new invehicleid = GetPlayerVehicleID(playerid);



for( s=1; s<MAX_SALON_SLOT; s)



? ? ? ? {











for(new salon=1; salon<MAX_SALON; salon)



? ? ? ? {



? ? ? ? ? ? ?



? ? ? ? ? ? ? if(SalonCarIdSlot[salon][s] == invehicleid)



? ? ? ? ? ? ? {



? ? ? ? ? ? ??







? ? ? ? ? ? ? SetPVarInt(playerid, "UseIdSalon", salon);







SetPVarInt(playerid, "UseSlotSalon", s);



? ? ? ? ? ? ? new sVehSlotDeal = s;



? ? ? ? ? ? ? new salonDealID = salon;



? ? ? ? ? ? ? new st[160];



format(st,sizeof(st),"Anda yakin ingin membeli nomor tansport %i?\n\nModel: %s\nBiaya: $%i",



sVehSlotDeal ,NameCars(SalonModelSlot[salonDealID][sVehSlotDeal]),SalonPriseSlot[salonDealID][sVehSlotDeal]);



ShowPlayerDialog(playerid,64, DIALOG_STYLE_MSGBOX, "Pasar mobil", st, "Untuk membeli", "Keluarlah");



? ? ? ? ? ? ? return true;



? ? ? ? ? ? ? }



? ? ? ? ? ? ?







? ? ? ? }



}? ? ? ? ?











return 0;







}



how to make a correct IF function with the required parameter for a vehicle ID that has many Increments?

I find it difficult to match the player into a particular car.



Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

{

if(!ispassenger)

{

new slot=GetPVarInt(playerid,"SalonSlot");

new salon;

for(new s=1;s<MAX_SALON_SLOT;s)

? ? ? ? ? ? {

? ? ? ? ? ? ?







if(vehicleid == SalonCarIdSlot[salon][s] )

{

new st[160];

format(st,sizeof(st),"Anda yakin ingin membeli nomor tansport %i?\n\nModel: %s\nBiaya: $%i",slot,NameCars(SalonModelSlot[s][slot]),SalonPriseSlot[s][slot]);

ShowPlayerDialog(playerid,64, DIALOG_STYLE_MSGBOX, "Pasar mobil", st, "Untuk membeli", "Keluarlah");

}





}



}





// IS THE CODE TRUE FOR ?

// If function detect is that vehicle a vehicle created for dealer vehicle

}



How to display dialog style on certain vehicles group enum?
  Reply
#2
I do not understand what you want.

Please explain more...
  Reply
#3
(2021-05-01, 12:54 AM)Radical Wrote: I do not understand what you want.

Please explain more...



I just wanna show dialog if player enter vehicle on dealer vehicle sir



Code:
if(vehicleid == SalonCarIdSlot[salon][s] )

{

new st[160];

format(st,sizeof(st),"Anda yakin ingin membeli nomor tansport %i?\n\nModel: %s\nBiaya: $%i",slot,NameCars(SalonModelSlot[s][slot]),SalonPriseSlot[s][slot]);

ShowPlayerDialog(playerid,64, DIALOG_STYLE_MSGBOX, "Pasar mobil", st, "Untuk membeli", "Keluarlah");

}
  Reply
#4
Code:
#define MAX_SALON_SLOT  (1)



#define SPORT_VEHICLES  (0)



enum dealerInfo

{

    carModel,

    carPrice,

    carSlot,

    Float: carPos[4],

    carID

}

new SalonData[][dealerInfo] =

{

    {451, 50000, SPORT_VEHICLES, {2507.0300, 2499.5908, 21.5469, -90.0000}},

    {411, 50000, SPORT_VEHICLES, {2507.2168, 2494.1467, 21.5469, -90.0000}},

};



public OnGameModeInit() {

    for (new s; s < MAX_SALON_SLOT; s) {

        SalonData[s][carID] = CreateVehicle(SalonData[s][carModel], SalonData[s][carPos][0], SalonData[s][carPos][1], SalonData[s][carPos][2], SalonData[s][carPos][3], -1, -1, -1);

    }

    return 1;

}



public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

{

    if (!ispassenger) {

        new salon_slot=GetPVarInt(playerid,"SalonSlot");

        for (new s; s < MAX_SALON_SLOT; s) {

            if ( salon_slot == SalonData[s][carSlot] ) {

                if ( vehicleid == SalonData[s][carID] ) {

                    new st[160];

                    format(st,sizeof(st),"Anda yakin ingin membeli nomor tansport %i?\n\nModel: %s\nBiaya: $%i",s,NameCars(SalonData[s][carModel]),SalonData[s][carPrice]);

                    ShowPlayerDialog(playerid,64, DIALOG_STYLE_MSGBOX, "Pasar mobil", st, "Untuk membeli", "Keluarlah");

                    break;

                }

            }

        }

    }

    return 1;

}



public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {

    if ( dialogid == 64 ) {

        

        if (!response)

            return 1;



        new salon_slot=GetPVarInt(playerid,"SalonSlot");

        for (new s; s < MAX_SALON_SLOT; s) {

            if ( salon_slot == SalonData[s][carSlot] ) {

                if ( GetPlayerVehicleID(playerid) == SalonData[s][carID] ) {



                    if (GetPlayerMoney(playerid) < SalonData[s][carPrice])

                        return SendClientMessage(playerid, -1, "You don't have enough money."), RemovePlayerFromVehicle(playerid);



                    GivePlayerMoney(playerid, -SalonData[s][carPrice]);



                    new st[160];

                    format(st,sizeof(st),"You bought car : %s\nPrice: $%i",NameCars(SalonData[s][carModel]),SalonData[s][carPrice]);

                    ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Delaer", st, "Okay", "");



                    //other stuffs...





                    break;

                }

            }

        }



        return 1;

    }

    return 1;

}
  Reply
#5
But is not work in a lot o vehicle dealer. I see a simply function like sample :

Code:
stock IsVelo(carid)

{

switch(GetVehicleModel(carid)) { case 481,509,510:return true; }

return 0;

}





stock IsFlyCar(carid)

{

switch(GetVehicleModel(carid)) { case 417,425,430,441,446,447,452..454,460,469,472,473,476,484,487,488,493,497,501,511..513,519,520,539,548,553,563,571,577,592,593,595:return true; }

return 0;

}



How to fix this issue sir?



Code:
stock IsPlayerInDealerVehicle(playerid)

{

/*

switch(GetPlayerVehicleID(playerid)) { case



for(new salon=1;salon<MAX_SALON;salon)

? ? {

for(new s=1;s<MAX_SALON_SLOT;s)

? ? ? ? ? ? {

? ? ? ? ? ? ? SalonCarIdSlot[salon][s];





? ? ? ? ? ? }

}? ? ? ? ? ?

:return true; }



return 0;

*/

}
  Reply


Forum Jump: