Bonjour,
Voici un petit Tuto pour la fonction PlayerToPoint
Un exemple précis "Je Veux dire Bonjour tout le monde" avec la fonction PlayerToPoint
Si le joueur n'est pas a l'endroit précis il ne peut pas lancer le message
Voici un Exemple
if(strcmp(cmdtext, "/message", true) == 0)
{
if(PlayerToPoint(playerid,10.0,2055.0913,1922.8147,12.1718))
{
SendClientMessageToAll(0xFFFF00AA,"Bonjour tout le monde !");
}else{
SendClientMessage(playerid,COLOR_WHITE,"vous êtes trop loin (Suivez le point Rouge)");
SetPlayerCheckpoint(playerid, 2055.0913,1922.8147,12.1718, 3.0);
}
return 1;
}
Le forward a mettre en haut de votre GM
forward PlayerToPoint (playerid, Float:radi, Float:x, Float:y, Float:z);
La fonction vous pouvez le mettre en bas de votre GM si vous le souhaitez.
public PlayerToPoint(playerid, Float:radi, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
Voila j'espère que le Tuto vous plaira :)
Cordialement,