• 28 Mars 2024, 11:31:08


Auteur Sujet: [Fonction] MoveAttachedObject // AngleEnvironEgal  (Lu 10525 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne chneubeul

  • *
  • Gangster
  • GTA Online Addict :)
  • Messages: 1132
    • Voir le profil
[Fonction] MoveAttachedObject // AngleEnvironEgal
« le: 04 Décembre 2017, 17:03:40 »
Hello,

je vous partage mes 2 fonctions que j'ai faites dans un projet que je partagerais aussi une fois finis.

MoveAttachedObject                                                                     

MoveAttachedObject(oid, vid, Float:oX, Float:oY, Float:oZ, Float:orX, Float:orY, Float:orZ, Float:dX, Float:dY, Float:dZ, Float:drX, Float:drY, Float:drZ, Float:speed);

Utilisations  -> les coordonées 'o' doivent contenir l'OFFSET de l'objet attaché et les coordonnées 'd' celle où l'objet doit arriver. L'objet va bouger tout les 100ms + ou - vite selon la 'speed'.
Lien : pastebin

AngleEnvironEgal                                                                           
stock AngleEnvironEgal (Float:a, Float:b, Float:d)
{
new Float:fmin=b-d, Float:fmax=b+d, out;

if(fmin<0.0) {  fmin += 360.0; out = 1;}
if(fmax>360.0) {  fmax -= 360.0; out = 2;}
if(!out)
{
if (a>=fmin && a<=fmax)
    { return 1; }
}
else if (out == 1)
{
if (a>=fmin && 360.0-a<=fmax)
    { return 1; }
}
else if(out == 2)
{
    if (360.0+a>=fmin && a<=fmax)
    { return 1; }
}
    else
return 0;

    return 0;
}


Utilisation -> Entrer l'angle A et B, ansi que la 'fourchette' D. Petite pensée à Syg pour cette fonction :)


A+, Sam.
 :bye: