GetVehicleDistanceFromPoint FR

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:14, 5 January 2013
Connor Mead (Talk | contribs)

← Previous diff
Revision as of 19:18, 5 January 2013
Connor Mead (Talk | contribs)

Next diff →
Line 2: Line 2:
{{Title}} {{Title}}
-{{AddedIn0.3c|function|R3}}+{{AddedIn0.3cFR|fonction|R3}}
-{{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.}}+{{Description|Cette fonction permet de récupérer la distance séparant un véhicule d'un point sur la carte}}
{{Parameters|vehicleid, Float:X, Float:Y, Float:Z}} {{Parameters|vehicleid, Float:X, Float:Y, Float:Z}}
-{{Param|vehicleid|The ID of the vehicle to calculate the distance for.}}+{{Param|vehicleid|L'ID du véhicume}}
-{{Param|Float:X|The X map coordinate.}}+{{Param|Float:X|Les coordonnées X de la carte.}}
-{{Param|Float:Y|The Y map coordinate.}}+{{Param|Float:Y|Les coordonnées Y de la carte.}}
-{{Param|Float:Z|The Z map coordinate.}}+{{Param|Float:Z|Les coordonnées Z de la carte.}}
-{{Returns|A float containing the distance from the point specified in the coordinates.}}+{{ReturnsFR|Une variable Float contenant la distance séparant le véhicule du point}}
<pawn> <pawn>
-/* when the player types 'vendingmachine' in to the chat box, they'll see this.*/+/* Quand le joueur écrit vendingmachine dans le chat.*/
public OnPlayerText(playerid, text[]) { public OnPlayerText(playerid, text[]) {
if(strcmp(text, "vendingmachine", true) == 0) { if(strcmp(text, "vendingmachine", true) == 0) {
Line 21: Line 21:
szMessage[44]; szMessage[44];
- format(szMessage, sizeof(szMessage), "You're %f away from our vending machine.", fDistance);+ format(szMessage, sizeof(szMessage), "Tu es à %f de la "vending machine".", fDistance);
SendClientMessage(playerid, 0xA9C4E4FF, szMessage); SendClientMessage(playerid, 0xA9C4E4FF, szMessage);
} }

Revision as of 19:18, 5 January 2013




Cette fonction a été ajoutée dans SA-MP 0.3c R3 et n'est pas utilisable dans les versions antérieures!


Description:

Cette fonction permet de récupérer la distance séparant un véhicule d'un point sur la carte


Parameters:
(vehicleid, Float:X, Float:Y, Float:Z)
vehicleidL'ID du véhicume
Float:XLes coordonnées X de la carte.
Float:YLes coordonnées Y de la carte.
Float:ZLes coordonnées Z de la carte.

Retourne:

Une variable Float contenant la distance séparant le véhicule du point


/* Quand le joueur écrit vendingmachine dans le chat.*/
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), "Tu es à %f de la "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.