Hello There, Guest! Login or Register


Train and passengers
#1
i know a lot of ppl has posted about this, but i have a suggestion.
do u remember in that mission Free Fall in san andreas single mode da plane interior?
i got da coords after searching em, i dunno if u already have em but  these are :Y)

2.828671 , 32.853580 , 1199.593750 and interior 1.

my idea is when someone press F key to enter the train, if theres already a driver, enter to that interior.


i learned a bit of pawno after i stolen that MOFO server  _O- and uhmm this might work:
Code:
...
static gTrainid;
static gTrainDriver;
...
public OnGameModeInit()
{
    ...
    gTrainid = CreateVehicle(537,....);
    gTrainDriver=-1;
    ...
}
...
public OnPlayerDisconnect(playerid, reason)
{
    ...
    if(playerid==gTrainDriver)
       gTrainDriver=-1;
    ...
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    ...
    if(gTrainid==vehicleid && gTrainDriver>-1){
        RemovePlayerFromVehicle(playerid);
        SetCameraBehindPlayer(playerid);
            SetPlayerInterior(playerid,1);
        SetPlayerPos(playerid,2.828671 , 32.853580 , 1199.593750);
        SetPlayerFacingAngle(playerid,90.0);
    }
    return 1;
}
...
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    ...
    if(newstate == PLAYER_STATE_DRIVER){
        new vehid = GetPlayerVehicleID(playerid);
        if(vehid==gTrainid)
            gTrainDriver=playerid;
    }
    if(oldstate == PLAYER_STATE_DRIVER){
        if(gTrainDriver==playerid)
            gTrainDriver=-1;
    }
    return 1;
}
...
i hope this aint useless D:

PS: Here isnt how to leave it the interior
Reply
#2
I didn't even know there was a train interior to be honest. Are you sure you are not getting mixed up with the Shamal interior?
Reply
#3
(08-06-2008, 11:41 AM)Jay link Wrote: I didn't even know there was a train interior to be honest. Are you sure you are not getting mixed up with the Shamal interior?
ye ur right, its not a train interior, but there can be placed an object blocking the cabin
Reply
#4
Reference image:
[Image: ?f=03pZoLLXm8.jpg]

Could work I guess, but then you'd just be stuck in a small wagon for the duration of the ride. No way of getting to the other wagons, sounds kind of boring.
Reply
#5
(08-06-2008, 07:09 PM)Chillosophy link Wrote: Could work I guess, but then you'd just be stuck in a small wagon for the duration of the ride. No way of getting to the other wagons, sounds kind of boring.

why boring?, it d be fuckin awesome cuz its way too better than being passenger in da train (where you are more stuck) and just waiting to arrive other place, plus u cant add passengers to trains.
Reply
#6
Hm.. I think it'd be better to either let people jump onto the carriages (by replacing the current ones with the old industrial-type carriages), or use a more train-like interior. That seems rather.. plane-like, which we could use for a plane!
Reply
#7
Doesn't SA-MP have the PutPlayerInVehicle hax for the train cabins and tram, for passengers?
I'm sure Fireburn created such thing a long time ago, not in LVP afaik, but just proof of concept code.
Reply
#8
I'm not sure how that would work. If you mean putting a player in the carriage using it, it just seems to crash. However, if you mean putting a player in the driver car, I'm not sure how many people that can take, but since there is no way to return a seat it, it won't be safe.

EDIT: Actually, there might be a way to safely put the player in the correct seat id, I'll experiment later to see how many it can hold.
Reply
#9
Well, if I remember correctly, the script could place a passenger as passenger in the train, but that is already possible. (Or does the train has hidden seats?)
It was also possible to use the passenger cabins.

PutPlayerInVehicle

(playerid,vehicleid,seatid)
playerid ID of the player
vehicleid ID of the vehicle
seatid ID of the seat (0-driver, 1-co-driver, 2&3-passengers, if the car has enough seats)

This function does not return a specific value, it's best to simply ignore it.

PutPlayerInVehicle(playerid, vehicleid, 0);

WARNING: Putting a player into a non-existing seat, or in a seat which is already taken, will cause a crash when they EXIT the car.

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.
    * GetPlayerVehicleID: Get the ID of the car of the player
    * RemovePlayerFromVehicle: Throw player out of vehicle
Reply
#10
(08-08-2008, 09:11 AM)Nakebod link Wrote: Doesn't SA-MP have the PutPlayerInVehicle hax for the train cabins and tram, for passengers?
I'm sure Fireburn created such thing a long time ago, not in LVP afaik, but just proof of concept code.
whats da point of making a player enter da train as passenger if he cant move? and which key d be used to join the train?

(08-08-2008, 12:36 PM)Nakebod link Wrote: The following functions might be useful as well, as they're related to this function in one way or another.
    * GetPlayerVehicleID: Get the ID of the car of the player
    * RemovePlayerFromVehicle: Throw player out of vehicle
what if they press 'F' ?

its better they appear inside the plane interior, it can make cruises much more fun
Reply