GetVehicleDistanceFromPoint FR
From SA-MP Wiki
(Difference between revisions)
Revision as of 19:14, 5 January 2013
Page d'Accueil | Les Fonctions | Les Callbacks | Les bases du Scripting | Plugins de Serveur | Tutoriaux
Ne prenez pas en compte les FR dans les noms
Description:
This function can be used to calculate the distance (as a float) between a vehicle and another map coordinate. This can be useful to detect how far a vehicle away is from a location.
(vehicleid, Float:X, Float:Y, Float:Z)
vehicleid | The ID of the vehicle to calculate the distance for. |
Float:X | The X map coordinate. |
Float:Y | The Y map coordinate. |
Float:Z | The Z map coordinate. |
Return Values:
A float containing the distance from the point specified in the coordinates.
/* when the player types 'vendingmachine' in to the chat box, they'll see this.*/ public OnPlayerText(playerid, text[]) { if(strcmp(text, "vendingmachine", true) == 0) { new Float: fDistance = GetVehicleDistanceFromPoint(GetPlayerVehicleID(playerid), 237.9, 115.6, 1010.2), szMessage[44]; format(szMessage, sizeof(szMessage), "You're %f away from our vending machine.", fDistance); SendClientMessage(playerid, 0xA9C4E4FF, szMessage); } return 0; }
Fonctions Relatives
Les fonctions suivantes peuvent être utiles car elles sont indirectement ou directement liées a cette fonction.
- GetPlayerDistanceFromPoint: Récupérer la distance séparant un joueur d'un point de la carte
- GetVehiclePos: Récupérer la position d'un véhicule