14.11.2013, 09:44
Say we have a variable called "new npctrain" which = the vehicle ID of the train, the NPC is using...
When the train comes in to the station now, you can teleport the player into like that:
To prevent him from leaving the train, you can freeze the player
To get sure, that there aren't players in the same seat (not sure if that would cause errors, you can use something like that) [NOT TESTET!!]
at the top of your script:
and then at the function or callback that says you whether the train entered the station:
When the train comes in to the station now, you can teleport the player into like that:
Код:
PutPlayerInVehicle(playerid, npctrain, 1);
Код:
TogglePlayerControllable(playerid, 0);
at the top of your script:
Код:
#define MAX_TRAIN_SEATS 20 //CHANGE THAT TO YOUR CUSTOM WISHES - THE MAX AMOUNTS OF SEATS THAT YOU TRAIN SHOULD HAVE
Код:
new blocked = 0;
for(new n=1; n<=MAX_TRAIN_SEATS; n++)
{
blocked = 0;
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i) && GetPlayerVehicleID(i) == npctrain)
{
if(GetVehicleSeat(i) == n)
{
blocked = 1;
}
}
}
if(blocked == 0)
{
PutPlayerInVehicle(playerid, npctrain, n);
TogglePlayerControllable(playerid, 0);
}
}

