Custom vehicle interiors??
#1

Hey guys!
I've seen many servers where few vehicles has a special interior when you press 'G' to get into them such as airplanes, PD cars, tanks, buses, trucks and etc.
I want to ask how can I do it?
Any guides/howtos/ tutorials please?

THX!

P.S
I am a complete newbie, so I dont know many functions..
Reply
#2

Read the wiki:

https://sampwiki.blast.hk/wiki/InteriorCars
Reply
#3

Quote:
Originally Posted by azzerking
Посмотреть сообщение
I meant Interiors TO vehicles
not
Vehicles to Interiors
Reply
#4

I'm not sure if anyone is going to be able to MAKE the entire script for you, let alone the custom interiors. How is this made? Well, it's a mixture of using OnPlayerEnterVehicle, SetPlayerPos, SetPlayerInterior and maybe SetPlayerVirtualWorld.

Basically it works like this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) //This is called wheneven a player tries to enter a vehicle, by press F or G. (Or whatever your defaults for passenger/driver are.)
{
    if(ispassenger == 1) //if ispassenger equals 1, this means they are entering as a passenger, by pressing G (default)
    {
        //Now that we know the player is entering as a passenger, we can do the following:
        SetPlayerPos(playerid, X, Y, Z); //The players position gets set to where the interior of the vehicle is made
        SetPlayerInterior(playerid, interiorid); //Sometimes if the interior is in another interior, you use this to set the players interior to it
        //SetPlayerVirtualWorld(playerid, worldid); //This is also sometimes used, so the player cannot be seen by other players who are not also in the vehicle.
    }
    return 1;
}
For more information on these functions, read here:
https://sampwiki.blast.hk/wiki/OnPlayerEnterVehicle
https://sampwiki.blast.hk/wiki/SetPlayerPos
https://sampwiki.blast.hk/wiki/SetPlayerInterior
https://sampwiki.blast.hk/wiki/SetPlayerVirtualWorld
__

Or another thing you can use is
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) //This is called when the state of the player changes, like entering the vehicle and becoming a driver, as a new state
{
    if(newstate == PLAYER_STATE_PASSENGER) //If the new state is a passenger
    {
        if(oldstate == PLAYER_STATE_ONFOOT) //if they used to be on foot before becoming a passenger
        {
            SetPlayerPos(playerid, X, Y, Z);
            SetPlayerInterior(playerid, interiorid);
            SetPlayerVirtualWorld(playerid, worldid);
        }
    }
    return 1;
}
Read here for more about OnPlayerStateChange:
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)