OnPlayerEnterVehicle not being called.
#1

For some reason the vehicleid "DealerVeh" is not being called (With/without an array). Can anyone tell me why it's not showing the dialog when players enter the vehicles?

pawn Код:
new DealerVeh1;
new DealerVeh2;
new DealerVeh3;
new DealerVeh4;


//ongamemodeinit
//VEHICLE DEALERSHIP1 (BLUEBERRY)
    DealerVeh1 = CreateVehicle(542,358.1000100,-78.9000000,1.2000000,180.0000000,105,88,15); //Clover
    DealerVeh2 = CreateVehicle(540,362.1000100,-78.9000000,1.4000000,180.0000000,156,161,15); //Vincent
    DealerVeh3 = CreateVehicle(533,366.8999900,-79.1000000,1.2000000,180.0000000,54,65,15); //Feltzer
    DealerVeh4 = CreateVehicle(549,371.3999900,-79.0000000,1.2000000,178.0000000,77,50,15); //Tampa

//entering the vehicle
//Blueberry dealership
    if(vehicleid == DealerVeh1)
    {
        ShowPlayerDialog(playerid, DEALER_CLOVER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $825", "Buy", "Cancel");
    }
    if(vehicleid == DealerVeh2)
    {
        ShowPlayerDialog(playerid, DEALER_VINCENT, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $1,250", "Buy", "Cancel");
    }
    if(vehicleid == DealerVeh3)
    {
        ShowPlayerDialog(playerid, DEALER_FELTZER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $2,250", "Buy", "Cancel");
    }
    if(vehicleid == DealerVeh4)
    {
        ShowPlayerDialog(playerid, DEALER_TAMPA, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for 1,000$", "Buy", "Cancel");
    }
Reply
#2

Are you using OnPlayerEnterVehicle or OnPlayerStateChange for this?
Reply
#3

pawn Код:
new DealerVeh[4 char];

    DealerVeh{0} = CreateVehicle(542,358.1000100,-78.9000000,1.2000000,180.0000000,105,88,15); //Clover
    DealerVeh{1} = CreateVehicle(540,362.1000100,-78.9000000,1.4000000,180.0000000,156,161,15); //Vincent
    DealerVeh{2} = CreateVehicle(533,366.8999900,-79.1000000,1.2000000,180.0000000,54,65,15); //Feltzer
    DealerVeh{3} = CreateVehicle(549,371.3999900,-79.0000000,1.2000000,178.0000000,77,50,15); //Tampa

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vID = GetPlayerVehicleID(playerid);

    if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER) // you can change this
    {
        if(vID == DealerVeh{0})
        {
            ShowPlayerDialog(playerid, DEALER_CLOVER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $825", "Buy", "Cancel");
        }
        else if(vID == DealerVeh{1})
        {
            ShowPlayerDialog(playerid, DEALER_VINCENT, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $1,250", "Buy", "Cancel");
        }
        else if(vID == DealerVeh{2})
        {
            ShowPlayerDialog(playerid, DEALER_FELTZER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $2,250", "Buy", "Cancel");
        }
        else if(vID == DealerVeh{3})
        {
            ShowPlayerDialog(playerid, DEALER_TAMPA, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for 1,000$", "Buy", "Cancel");
        }
    }
    return true;
}
Reply
#4

Or that.
Reply
#5

pawn Код:
new DealerVeh[4];

    DealerVeh[0] = CreateVehicle(542,358.1000100,-78.9000000,1.2000000,180.0000000,105,88,15); //Clover
    DealerVeh[1] = CreateVehicle(540,362.1000100,-78.9000000,1.4000000,180.0000000,156,161,15); //Vincent
    DealerVeh[2] = CreateVehicle(533,366.8999900,-79.1000000,1.2000000,180.0000000,54,65,15); //Feltzer
    DealerVeh[3] = CreateVehicle(549,371.3999900,-79.0000000,1.2000000,178.0000000,77,50,15); //Tampa

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vID = GetPlayerVehicleID(playerid);

    if(newstate == PLAYER_STATE_DRIVER || newstate ==  PLAYER_STATE_PASSENGER) // you can change this
    {
        if(vID == DealerVeh[0])
        {
            ShowPlayerDialog(playerid, DEALER_CLOVER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $825", "Buy", "Cancel");
        }
        else if(vID == DealerVeh[1])
        {
            ShowPlayerDialog(playerid, DEALER_VINCENT, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $1,250", "Buy", "Cancel");
        }
        else if(vID == DealerVeh[2])
        {
            ShowPlayerDialog(playerid, DEALER_FELTZER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $2,250", "Buy", "Cancel");
        }
        else if(vID == DealerVeh[3])
        {
            ShowPlayerDialog(playerid, DEALER_TAMPA, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for 1,000$", "Buy", "Cancel");
        }
    }
    return true;
}
Or that.

1. You don't know if the guy is gonna create those after he already created 255 vehicles.

2. Bad condition check
Reply
#6

The multiple brackets annoy me. Just something I hate.

pawn Код:
new DealerVeh[4]; //Top of the script

//OnGameModeInit
    DealerVeh[0] = CreateVehicle(542,358.1000100,-78.9000000,1.2000000,180.0000000,105,88,15); //Clover
    DealerVeh[1] = CreateVehicle(540,362.1000100,-78.9000000,1.4000000,180.0000000,156,161,15); //Vincent
    DealerVeh[2] = CreateVehicle(533,366.8999900,-79.1000000,1.2000000,180.0000000,54,65,15); //Feltzer
    DealerVeh[3] = CreateVehicle(549,371.3999900,-79.0000000,1.2000000,178.0000000,77,50,15); //Tampa

//
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate ==  PLAYER_STATE_PASSENGER) // you can change this
    {
        new vID = GetPlayerVehicleID(playerid); //No point in doing this outside the 'newstate' check. (As far as we know)
        switch(vID)
        {
            case DealerVeh[0]: ShowPlayerDialog(playerid, DEALER_CLOVER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $825", "Buy", "Cancel");
            case DealerVeh[1]: ShowPlayerDialog(playerid, DEALER_VINCENT, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $1,250", "Buy", "Cancel");
            case DealerVeh[2]: ShowPlayerDialog(playerid, DEALER_FELTZER, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for $2,250", "Buy", "Cancel");
            case DealerVeh[3]: ShowPlayerDialog(playerid, DEALER_TAMPA, DIALOG_STYLE_MSGBOX, "Purchase Vehicle?", "Buy for 1,000$", "Buy", "Cancel");
        }
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)