• 23 Avril 2025, 12:27:00


Auteur Sujet: GetDistance  (Lu 1050 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne yhaabb

  • *
  • Nouveau
  • Messages: 9
    • Voir le profil
GetDistance
« le: 02 Août 2012, 02:45:47 »
Salut.

J'ai trouvé ce code sur Internet afin de mettre des distances pour le chat...

public OnPlayerText(playerid,text[])
{
new Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:z2 ,Float:dist,string[128],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s dit: %s",name,text);
GetPlayerPos(playerid,x,y,z);
for(new i=0;i<MAX_PLAYERS;i++)
{
if (!IsPlayerConnected(i)) continue;
GetPlayerPos(i,x2,y2,z2);
dist = GetDistance(x,y,z,x2,y2,z2);
if (dist<1.0) SendClientMessage(i,0xFFFFFFAA,string);
else if (dist<2.0) SendClientMessage(i,0xFFFFFFAA,string);
else if (dist<4.0) SendClientMessage(i,0xFFFFFFAA,string);
else if (dist<6.0) SendClientMessage(i,0xFFFFFFAA,string);
else if (dist<8.0) SendClientMessage(i,0xFFFFFFAA,string);
}
return 0;
}

Sauf que quand je compile j'obtiens "undefined symbol "GetDistance""

Donc, si on pouvait m'aidé sur sa plz. :)

Merci.

Hors ligne Ssk

  • *
  • Lulu's Stunt - Le serveur stunt de Lulu !
  • Messages: 8154
    • Voir le profil
Re : GetDistance
« Réponse #1 le: 02 Août 2012, 04:50:32 »
Peut être que la fonction n'existe pas dans ton script, sans parler du fait que la distance est inutile dans ton script vu que tu fais la même pour toute les distances lol



Derrière tout programme se cache un programmeur, je considère le monde comme un programme.
Mon blog

Hors ligne Alexandre_Leborgn

  • *
  • Criminel
  • Messages: 35
    • Voir le profil
Re : GetDistance
« Réponse #2 le: 03 Août 2012, 05:02:45 »
la fonction :

Citer
stock GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 )
{
    return floatround( floatsqroot( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) + ( ( z1 - z2 ) * ( z1 - z2 ) ) ) ) );
}