Custom vehicle interiors??
#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


Messages In This Thread
Custom vehicle interiors?? - by PazGru - 20.01.2013, 13:17
Re: Custom vehicle interiors?? - by azzerking - 20.01.2013, 13:18
Re: Custom vehicle interiors?? - by PazGru - 20.01.2013, 13:50
Re: Custom vehicle interiors?? - by Threshold - 20.01.2013, 14:05

Forum Jump:


Users browsing this thread: 2 Guest(s)