new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new braqueur = 0;
for (new i=0; i<=MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(i,5.0,x,y,z) { braqueur++; }
}
}
return 1;GetPlayerPos(playerid, X, Y, Z);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(EnBraquage[i] && IsPlayerInRangeOfPoint(i, 1.0, X, Y, Z))
{
countbraqueur++;
}
}
if(countbraqueur >= 2)
{
// 2 joueur autour de playerid
}
[code]
Player1 (ID: 1), Player2 (ID: 2), et Player3 (ID: 3), veulent faire un braquage.
Player1 est le leader et Player2 et Player3 sont ses assistants.
Player1: /braquage
Serveur à Player1: Vous avez démarré l'évènement "braquage"
Serveur à Player1: Ils vous faut deux assistants
Player2: /assister 1
Serveur à Player1: Vous avez 1 assistants, il vous en manque plus qu'un !
Player3: /assister 1
Serveur à Player1: Vous avez 2 assistants ! Le braquage commence !
Serveur à Player2: Le braquage commence !
Serveur à Player3: Le braquage commence !
GetDistanceFromMeToPoint est pour les npc
stock Float:GetDistanceBetweenPoints(Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ)
{
return floatsqroot(floatadd(floatadd(floatpower(floatsub(X, PointX), 2.0), floatpower(floatsub(Y, PointY), 2.0)), floatpower(floatsub(Z, PointZ), 2.0)));
}
stock Float:GetDistanceBetweenPlayers(playerid, otherplayerid)
{
new Float:X[2], Float:Y[2], Float:Z[2];
GetPlayerPos(playerid, X[0], Y[0], Z[0]);
GetPlayerPos(otherplayerid, X[1], Y[1], Z[1]);
return GetDistanceBetweenPoints(X[0], Y[0], Z[0], X[1], Y[1], Z[1]);
}public GetDistanceBetweenPlayers(playerid,giveplayerid, Float:radi)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(giveplayerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid,radi,x,y,z)) { return 1; }
return 0;
}
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(EnBraquage[i] && IsPlayerInRangeOfPoint(i, 1.0, x, y, z))
{
countbraqueur++;
}
} if(countbraqueur >= 2)
{
MONCODE
}
else
{
SendClientMessage(playerid, COLOR_RED, "Il doit y avoir 2 personnes proches du coffres avec vous!");
return 1;
}public Envoyeraceuxquibraques(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(EnBraquage[i])
{
SendClientMessage(i, color, string);
}
}
}
} format(string, sizeof(string), "Vous essayez d'ouvir le coffre, vous devez attendre pendant 5 minutes!");
Envoyeraceuxquibraques(COLOR_YELLOW, string);
format(string, sizeof(string), "L'alarme c'est déclanché, la police est maintenant avértis de votre braquage!");
Envoyeraceuxquibraques(COLOR_YELLOW, string);Tu as donc choisi la méthode de scott1, tu risque d'avoir des problèmes avec les personnes qui seront proches mais pas consentant !