GetVehiclePos FR

From SA-MP Wiki

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

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

Next diff →
Line 1: Line 1:
 +{{ScriptingFR}}
 +{{Title}}
 +
 +{{Description|Sauvegarde la position X, Y, et Z d'un véhicule dans une variable}}
 +
 +{{ParametersFR|vehicleid, &Float:X, &Float:Y, &Float:Z}}
 +{{Param|vehicleid|L'ID du véhicule.}}
 +{{Param|Float:X|La variable où stocker les coordonnées X.}}
 +{{Param|Float:Y|La variable où stocker les coordonnées Y.}}
 +{{Param|Float:Z|La variable où stocker les coordonnées Z.}}
 +
 +{{NoReturnFR}}
 +
 +<pawn>
 +public OnPlayerCommandText(playerid, cmdtext[])
 +{
 + if(strcmp(cmdtext, "/vehpos", true) == 0)
 + {
 + new currentveh;
 + currentveh = GetPlayerVehicleID(playerid);
 +
 + new Float:vehx, Float:vehy, Float:vehz;
 + GetVehiclePos(currentveh, vehx, vehy, vehz);
 +
 + new vehpostext[96];
 + format(vehpostext, sizeof(vehpostext), "La position actuelle de votre véhicule est: %f, %f, %f", vehx, vehy, vehz);
 +
 + SendClientMessage(playerid, 0xFFFFFFFF, vehpostext);
 + return 1;
 + }
 +
 + return 0;
 +}
 +</pawn>
 +
 +{{RelatedFunctionsFR}}
 +*[[GetVehicleDistanceFromPoint_FR|GetVehicleDistanceFromPoint:]]
 +*[[SetVehiclePos_FR|SetVehiclePos:]] Modifier la position d'un véhicule
 +*[[GetVehicleZAngle_FR|GetVehicleZAngle:]] Récupérer l'angle Z d'un véhicule
 +
[[Category:Scripting Functions FR]] [[Category:Scripting Functions FR]]

Revision as of 19:12, 5 January 2013




Description:

Sauvegarde la position X, Y, et Z d'un véhicule dans une variable


Paramètres:
(vehicleid, &Float:X, &Float:Y, &Float:Z)
vehicleidL'ID du véhicule.
Float:XLa variable où stocker les coordonnées X.
Float:YLa variable où stocker les coordonnées Y.
Float:ZLa variable où stocker les coordonnées Z.


RetourneCette fonction ne retourne pas de valeur spécifique.


public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/vehpos", true) == 0)
     {
          new currentveh;
          currentveh = GetPlayerVehicleID(playerid);
 
          new Float:vehx, Float:vehy, Float:vehz;
          GetVehiclePos(currentveh, vehx, vehy, vehz);
 
          new vehpostext[96];
          format(vehpostext, sizeof(vehpostext), "La position actuelle de votre véhicule est: %f, %f, %f", vehx, vehy, vehz);
 
          SendClientMessage(playerid, 0xFFFFFFFF, vehpostext);
          return 1;
     }
 
     return 0;
}

Fonctions Relatives

Les fonctions suivantes peuvent être utiles car elles sont indirectement ou directement liées a cette fonction.