Log in to reply
 

[Script] - if (Vehicle.Model.IsCar) && (Vehicle.Model.IsBike)



  • Hello, I would like to know how i can add both the
    if (Vehicle.Model.IsCar) + if (Vehicle.Model.IsBike)

    I tryed it but i could not get it to work

    if (PlayerPed.IsInVehicle())
    {
    Vehicle = PlayerPed.CurrentVehicle;

            if (Vehicle.Model.IsCar) && (Vehicle.Model.IsBike)
    

    {
    //Here my code
    }



  • A vehicle can't be a car and a bike at the same time. If what you are wanting is to check if the vehicle is a car OR a bike, use

    if (PlayerPed.IsInVehicle())
    {
    	Vehicle vehicle = PlayerPed.CurrentVehicle;
    
    	if (vehicle.Model.IsCar || vehicle.Model.IsBike)
    	{
    		//Here my code
    	}
    }
    

    But judging by the other little mistakes you made in the code, I think you should read some C# tutorials first before creating a mod with it.



  • @Jitnaught

    I have edited the Script and now it works for both bike's and cars. Thank you so much.

    I have learned c# Myself by Youtube, Friends, and the internet.
    I have been away for a long time and recently started scripting again, but indeed i should have know more than i know at this point.

    I have already made a few good scripts that people liked 1 is featured also

    https://www.gta5-mods.com/scripts/plane-rotor-speed

    My problem has been solved, I'm very thankfull :D


  • MODERATOR

    @Meestal_Richard how's parenting buddy? I see you've gotten a little bit of time back? Glad to see you're scripting again!


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.