OnUnoccupiedVehicleUpdate
From SA-MP Wiki
(Difference between revisions)
Revision as of 23:22, 14 August 2014 PT (Talk | contribs) (fix an small error i let on past) ← Previous diff |
Revision as of 21:35, 16 August 2014 Ikkentim (Talk | contribs) Next diff → |
||
Line 18: | Line 18: | ||
{{Param|new_y|The new Y coordinate of the vehicle. This parameter was added in 0.3z. Leave it out if using an earlier version.}} | {{Param|new_y|The new Y coordinate of the vehicle. This parameter was added in 0.3z. Leave it out if using an earlier version.}} | ||
{{Param|new_z|The new Z coordinate of the vehicle. This parameter was added in 0.3z. Leave it out if using an earlier version.}} | {{Param|new_z|The new Z coordinate of the vehicle. This parameter was added in 0.3z. Leave it out if using an earlier version.}} | ||
- | {{Param|vel_x|The new vel X coordinate of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version.}} | + | {{Param|vel_x|The new X velocity of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version.}} |
- | {{Param|vel_y|The new vel Y coordinate of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version.}} | + | {{Param|vel_y|The new Y velocity of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version.}} |
- | {{Param|vel_z|The new vel Z coordinate of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version.}} | + | {{Param|vel_z|The new Z velocity of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version.}} |
{{Returns|Returning '''0''' in this callback will stop the vehicle syncing its position to other players.}} | {{Returns|Returning '''0''' in this callback will stop the vehicle syncing its position to other players.}} |
Revision as of 21:35, 16 August 2014
Description:
This callback is called every time an unoccupied vehicle updates the server with its status, for example when a player nudges a vehicle on their client, it is synced to the server (and then other players).
Description:
This callback is called when a player updates the position of a vehicle they're not driving. This can happen outside of the vehicle or when the player is a passenger of a vehicle that has no driver.
(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
vehicleid | The vehicleid that the callback is processing |
playerid | The playerid that the callback is processing (the playerid affecting the vehicle) |
passenger_seat | The passenger seat of the playerid moving the vehicle. 0 if they're not in the vehicle. |
new_x | The new X coordinate of the vehicle. This parameter was added in 0.3z. Leave it out if using an earlier version. |
new_y | The new Y coordinate of the vehicle. This parameter was added in 0.3z. Leave it out if using an earlier version. |
new_z | The new Z coordinate of the vehicle. This parameter was added in 0.3z. Leave it out if using an earlier version. |
vel_x | The new X velocity of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version. |
vel_y | The new Y velocity of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version. |
vel_z | The new Z velocity of the vehicle. This parameter was added in 0.3z R4. Leave it out if using an earlier version. |
Return Values:
Returning 0 in this callback will stop the vehicle syncing its position to other players.
- seat numbers: 0 if they're not in the vehicle, 1 for front-right passenger, rear row: 2 left and 3 right = rear seats passengers for 4-door vehicle. NEVER sent as a driver, this is not same as data in GetPlayerVehicleSeat
Tip | GetVehiclePos will give the old coordinates of the vehicle before this update. |
Example Usage:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z) { GetVehiclePos(vehicleid, new_x, new_y, new_z); if(!IsPlayerInRangeOfPoint(playerid, 10, new_x, new_y, new_z)) { // something } return 1; }