You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Mark that the player should be placed in their vehicle once it is fully loaded.
40
+
// This avoids issues where the vehicle might not yet be loaded on the client's side.
41
+
SetPVarInt(playerid, "PutPlayerInVehicle", 1);
42
+
29
43
return 1;
30
44
}
45
+
46
+
public OnVehicleStreamIn(vehicleid, forplayerid)
47
+
{
48
+
// This callback is triggered when a vehicle streams in for the player (i.e. when it is loaded into memory).
49
+
// Check if the streamed-in vehicle is the player's and if they need to be placed in it.
50
+
if (vehicleid == s_PlayerVehicle[forplayerid] && GetPVarInt(forplayerid, "PutPlayerInVehicle"))
51
+
{
52
+
// Put the player into the vehicle.
53
+
PutPlayerInVehicle(forplayerid, vehicleid, 0);
54
+
55
+
// Clear the marker to prevent repeatedly putting the player into the vehicle
56
+
// (e.g., if the player leaves the vehicle and it streams in again later).
57
+
DeletePVar(forplayerid, "PutPlayerInVehicle");
58
+
}
59
+
60
+
return 1;
61
+
}
62
+
31
63
```
32
64
33
65
| ID | Seat |
@@ -48,7 +80,9 @@ You can use [GetPlayerVehicleSeat](GetPlayerVehicleSeat) in a loop to check if a
48
80
49
81
:::warning
50
82
51
-
If the seat is invalid or is taken, will cause a crash when they EXIT the vehicle.
83
+
* If the seat is invalid or already taken, the client will crash when they EXIT the vehicle.
84
+
* Putting a player into a vehicle that is not streamed in can be unreliable. This is due to a potential client-side issue where the vehicle may not have fully loaded into memory yet.
85
+
* This also applies when attempting to put a player into a vehicle that was just created.
0 commit comments