• 05 Juin 2026, 14:10:56


Auteur Sujet: Commende /arrest du GF, problème..  (Lu 1629 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne ApocKalipsS

  • *
  • Gangster
  • **** | Une experience GTA IV hors du commun !
  • Messages: 1141
    • Voir le profil
Commende /arrest du GF, problème..
« le: 04 Février 2009, 19:14:37 »
Bonjour,
Je voudrais que quand un policier tape /arreter et qu'il ne soit pas dans le praking du commicariat à cette endroit là :
1528.2424,-1677.4082,5.8906Il y a un message qui dise "vous n'êtes pas près des prisons.
J'ai déjà ceci :
if(strcmp(cmd, "/arreter", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
if(gTeam[playerid] == 2  || IsACop(playerid))
{
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   Vous n'êtes pas en service !");
    return 1;
}
        if(!PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391)
{// Jail spot
    SendClientMessage(playerid, COLOR_GREY, "   Vous n'êtes pas près de la prison, vous ne pouvez pas arreter quelqu'un !");
    return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arreter [prix] [temps (minutes)] [caution (0=non 1=oui)] [prix de la caution]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 35000) { SendClientMessage(playerid, COLOR_GREY, "   Le prix de l'arrestation ne peux être entre 1 et 35000$ !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arreter [prix] [temps (minutes)] [caution (0=non 1=oui)] [prix de la caution]");
return 1;
}
new time = strval(tmp);
if(time < 1 || time > 40) { SendClientMessage(playerid, COLOR_GREY, "   Le temps de la prison est de 1 à 40 minutes."); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arreter [prix] [temps (minutes)] [caution (0=non 1=oui)] [prix de la caution]");
return 1;
}
new bail = strval(tmp);
if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, "   La caution est 1 (non) ou 2 (oui)."); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arreter [prix] [temps (minutes)] [caution (0=non 1=oui)] [prix de la caution]");
return 1;
}
new bailprice = strval(tmp);
if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, "   La caution peut être entre $0 ou $3000000 !"); return 1; }
new suspect = GetClosestPlayer(playerid);
if(IsPlayerConnected(suspect))
{
if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
{
GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(WantedLevel[suspect] < 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   le joueur doit être recherché !");
    return 1;
}
format(string, sizeof(string), "* Vous avez arreter %s !", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoney(suspect, -moneys);
format(string, sizeof(string), "Arrestation par  %s ~n~ pour $%d", sendername, moneys);
GameTextForPlayer(suspect, string, 5000, 5);
ResetPlayerWeapons(suspect);
if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1)
{
format(string, sizeof(string), "<< L'officier %s a arréter le suspect %s >>", sendername, giveplayer);
OOCNews(COLOR_LIGHTRED, string);
}
else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2)
{
format(string, sizeof(string), "<< L'agent du FBI %s a arréter le suspect %s >>", sendername, giveplayer);
OOCNews(COLOR_LIGHTRED, string);
}
else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
{
format(string, sizeof(string), "<< le soldat %s a arréter le suspect %s >>", sendername, giveplayer);
OOCNews(COLOR_LIGHTRED, string);
}
SetPlayerInterior(suspect, 6);
SetPlayerPos(suspect,264.6288,77.5742,1001.0391);
PlayerInfo[suspect][pJailTime] = time * 60;
if(bail == 1)
{
JailPrice[suspect] = bailprice;
format(string, sizeof(string), "Vous avez été arreter pour %d secondes.   Caution: %d$", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
}
else
{
    JailPrice[suspect] = 0;
format(string, sizeof(string), "Vous avez été arreter pour %d secondes.   Caution: Unable", PlayerInfo[suspect][pJailTime]);
SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
}
PlayerInfo[suspect][pJailed] = 1;
        PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "Got Arrested");
WantedPoints[suspect] = 0;
WantedLevel[suspect] = 0;
WantLawyer[suspect] = 1;
}//distance
}//not connected
else
{
    SendClientMessage(playerid, COLOR_GREY, "   No-one close enough to arrest.");
    return 1;
}
}
else
{
    SendClientMessage(playerid, COLOR_GREY, "   Vous n'êtes pas un policier/agent du FBI/soldat !");
    return 1;
}
}//not connected
return 1;
}

je ne veux surtout pas supprimer la position quand on est dans le commicariat (ceci : if(!PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391) )
Mais en ajouer un autre quoi,
Je me suis mal exprimé, mais j'éspère que vous avez compris !
Merci d'avance de vos réponses,
AKS

Hors ligne S!m

  • *
  • Messages: 2341
    • Voir le profil
Re : Commende /arrest du GF, problème..
« Réponse #1 le: 04 Février 2009, 23:53:43 »
Salut,

je te conseil, en premier, d'aller voir ce post :http://www.gtaonline.fr/forums/index.php/topic,6175.0.html plus précisément, recherche l'opérateur ||

l'exemple devrait t'aider :P

++Sim++





Hors ligne Nikko™

  • *
  • Mafioso
  • Messages: 2393
    • Voir le profil
Re : Commende /arrest du GF, problème..
« Réponse #2 le: 05 Février 2009, 12:10:32 »
Et bah si tu veu en ajouter un autre, tu a juste a reprendre la meme fonction et de changer les cordonées que tu ajoute ensuite en desssous du premier ...


        if(!PlayerToPoint(6.0, playerid, 1528.2424,-1677.4082,5.8906)
{// Jail spot
    SendClientMessage(playerid, COLOR_GREY, "   Vous n'êtes pas près de la prison, vous ne pouvez pas arreter quelqu'un !");
    return 1;
}

++
nikko

Hors ligne MrFredo

  • *
  • Grand Banditisme
  • Scripteur PHP/PAWN
  • Messages: 953
    • Voir le profil
    • GTA-Hosting
Re : Commende /arrest du GF, problème..
« Réponse #3 le: 05 Février 2009, 12:16:27 »
plutot mettre comme la dit sim l'operateur || dans la condition avec deriere cette operateur le nouveau !PlayerToPoint

Hors ligne Nikko™

  • *
  • Mafioso
  • Messages: 2393
    • Voir le profil
Re : Commende /arrest du GF, problème..
« Réponse #4 le: 05 Février 2009, 12:19:59 »
Aussi ..  :)

++
nikko

Hors ligne ApocKalipsS

  • *
  • Gangster
  • **** | Une experience GTA IV hors du commun !
  • Messages: 1141
    • Voir le profil
Re : Commende /arrest du GF, problème..
« Réponse #5 le: 05 Février 2009, 18:04:29 »
              if(!PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391) || !PlayerToPoint(6.0, playerid, 1528.2424,-1677.4082,5.8906))

J'ai mis ça, et ca ne marche pas...

Hors ligne MrFredo

  • *
  • Grand Banditisme
  • Scripteur PHP/PAWN
  • Messages: 953
    • Voir le profil
    • GTA-Hosting
Re : Commende /arrest du GF, problème..
« Réponse #6 le: 05 Février 2009, 18:09:41 »
Faut modifier ta condition et la suite de ton code de cette maniere
Code: (pawn) [Sélectionner]
if(PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391) || PlayerToPoint(6.0, playerid, 1528.2424,-1677.4082,5.8906))
{
      tmp = strtok(cmdtext, idx);
      if(!strlen(tmp))
     {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /arreter [prix] [temps (minutes)] [caution (0=non 1=oui)] [prix de la caution]");
    return 1;
      }
       .......
}
else
{
       SendClientMessage(playerid, COLOR_GREY, "   Vous n'êtes pas près de la prison, vous ne pouvez pas arreter quelqu'un !");
       return 1;
}

Hors ligne S!m

  • *
  • Messages: 2341
    • Voir le profil
Re : Commende /arrest du GF, problème..
« Réponse #7 le: 05 Février 2009, 19:50:05 »
Salut,

j'avais mal regarder le script, comme il s'agit d'un cas où:
le joueur n'est pas dans la zone, je lui envoie un message

Tu dois remplacer le || par un &&

ce qui donnerais:
        if(!PlayerToPoint(6.0, playerid, 1528.2424,-1677.4082,5.8906) && !PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391))
{// Jail spot
    SendClientMessage(playerid, COLOR_GREY, "   Vous n'êtes pas près de la prison, vous ne pouvez pas arreter quelqu'un !");
    return 1;
}

EDIT: ah.....désolé, j'avais pas porté attention ^^

++Sim++
« Modifié: 05 Février 2009, 20:32:23 par Sim »





Hors ligne ApocKalipsS

  • *
  • Gangster
  • **** | Une experience GTA IV hors du commun !
  • Messages: 1141
    • Voir le profil
Re : Commende /arrest du GF, problème..
« Réponse #8 le: 05 Février 2009, 20:23:45 »
Merci à toi, Sim, ca marche !
PS : Dans ton code tu as oublié le "&& !playertopoint" etc., mais j'ai corrigé :)