SA-MP Forums Archive
OnPlayerEnterVehicle help needed! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerEnterVehicle help needed! (/showthread.php?tid=248390)



OnPlayerEnterVehicle help needed! - linuxthefish - 13.04.2011

If I enter a Linerunner, or a SFPD car - none of these messages gets shown in the console!

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (vehicleid == 403) // False
    {
        print("The player entered a Linerunner! ");
    }
    else if (vehicleid == 597) // False
    {
        print("The player entered a vehicle other than the linerunner!");
    }
    return 1;
}



Re: OnPlayerEnterVehicle help needed! - JaTochNietDan - 13.04.2011

It looks like you're comparing the vehicle ID to the model ID, which won't work? You should be checking the model ID! For example:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (GetVehicleModel(vehicleid) == 403) // False
    {
        print("The player entered a Linerunner! ");
    }
    else if (GetVehicleModel(vehicleid) == 597) // False
    {
        print("The player entered a vehicle other than the linerunner!");
    }
    return 1;
}



Re: OnPlayerEnterVehicle help needed! - ronnie3148 - 13.04.2011

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new model = GetVehicleModel(vehicleid);
    if (model == 403) // False
    {
        print("The player entered a Linerunner! ");
    }
    else if (model == 597) // False
    {
        print("The player entered a vehicle other than the linerunner!");
    }
    return 1;
}