Hello,
Revenant d'un cours de Maths d'hier, je me suis dit que j'allais utiliser ce que j'ai appris.
Pour cela, j'ai fait une petite commande, qui est pratique, car un peu gonflant d'avoir un SetVehicleVelocity où l'on peut que aller en X ou Y :
Cette commande vous sert à vous donner un bon coup de boost vers l'angle auquel vous êtes orienté.
if(strcmp(cmd,"/vitesse",true)==0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
new Float:Angle5;
new Float:Xx, Float:Yy, Float:Zz;
GetPlayerFacingAngle(playerid, Angle5);
GetPlayerPos(playerid, Xx, Yy, Zz);
new Float:DeltaX = 2 * (-floatsin(Angle5,degrees));
new Float:DeltaY = 2 * floatcos(Angle5,degrees);
SetPlayerVelocity(playerid, DeltaX, DeltaY, 0.1);
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
new Float:Angle6;
GetVehicleZAngle(GetPlayerVehicleID(playerid), Angle6);
new Float:DeltaX = 2 * (-floatsin(Angle6,degrees));
new Float:DeltaY = 2 * floatcos(Angle6,degrees);
SetVehicleVelocity(GetPlayerVehicleID(playerid), DeltaX, DeltaY, 0.0);
return 1;
}
}
En haut de votre GM, vérifiez que vous ayez bien ceci : #include <float>
Intégrez cette commande dans "OnPlayerCommandText".
Je vous laisse profiter ! ;D