• 03 Mai 2025, 01:31:57


Auteur Sujet: ou placé ce If ?  (Lu 663 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne Leonidas300

  • *
  • Bandit
  • Pawno-Amateur, a déjà crée plusieurs système
  • Messages: 301
    • Voir le profil
ou placé ce If ?
« le: 22 Août 2010, 19:44:53 »
Salut à tous
Voila je chercher comment faire, pour que si l'admin est en duty-off il ne recois pas les /report mais il peux en envoyé ( oui oui l'admin )

( ou placé ce if ?
Code: (pawn) [Sélectionner]
  if(AdminDuty[playerid] == 1)
 {
 }

Code: (pawn) [Sélectionner]
if(dialogid == REPORTMENU)
{
if(response)
        {
        new str[160];
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            if (str[i] == '_')
            str[i] = ' ';
format(str, sizeof(str), "(ID:%d)%s Report: %s",playerid, str, (inputtext));
ABroadCast(COLOR_YELLOW,str,1);
format(string, sizeof(string), "Report envoyé: %s", (inputtext));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}

merci




Zombi PAWN,Créateur de *** ****** ********* !

Cherche hébérgement SA:MP! [PM Moi]
Merci à vous

Hors ligne Eloctro

  • Pawno Fan
  • *
  • Grand Banditisme
  • Aight !
  • Messages: 846
    • Voir le profil
    • GtaSA-RP
Re : ou placé ce If ?
« Réponse #1 le: 22 Août 2010, 20:39:11 »
if(dialogid == REPORTMENU)
{
if(response)
        {
        new str[160] = ' ';
    GetPlayerName(playerid, str, MAX_PLAYER_NAME);
format(str, sizeof(str), "(ID:%d)%s Report: %s",playerid, str, (inputtext));
format(string, sizeof(string), "Report envoyé: %s", (inputtext));
SendClientMessage(playerid, COLOR_YELLOW, string);
            for (new i = 0; i < MAX_PLAYER_NAME; i++)
            {
            if (str[i] == '_')
            str[i] = ' ';
}
            for (new i = 0; i < MAX_PLAYERS; i++)
            {
if(AdminDuty[i] == 1)
{
SendClientMessage(i, COLOR_YELLOW, str);
}
}
}
}

J'ai pas trop compris mais essaye ça
« Modifié: 22 Août 2010, 20:42:24 par Eloctro »

Hors ligne minimicro

  • *
  • Tueur
  • Codeur Php / Mysql / Pawno
  • Messages: 53
    • Voir le profil
Re : ou placé ce If ?
« Réponse #2 le: 22 Août 2010, 20:47:32 »
Il peux être interessant d'ajouter un paramètre à la fonction ABroadCast a utiliser en booléen qui definierais si le messages sera envoyé aux admins en service, ou a tous les admins. Si tu nous envoit ton ABroadCast, nous pourrions t'aider à construire cette nouvelle fonction.
Codeur Php / Pawno / MySql - Administration et maintenance serveur

Hors ligne Leonidas300

  • *
  • Bandit
  • Pawno-Amateur, a déjà crée plusieurs système
  • Messages: 301
    • Voir le profil
Re : ou placé ce If ?
« Réponse #3 le: 22 Août 2010, 21:55:16 »
Sa serais sympas de m'éxpliquer en même temps si tu m'aidé à construire ta fonction

Code: (pawn) [Sélectionner]
public ABroadCast(color,const string[],level)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (PlayerInfo[i][pAdmin] >= level)
{
SendClientMessage(i, color, string);
printf("%s", string);
}
}
}
return 1;
}

forward ABroadCast(color,const string[],level);




Zombi PAWN,Créateur de *** ****** ********* !

Cherche hébérgement SA:MP! [PM Moi]
Merci à vous

Hors ligne minimicro

  • *
  • Tueur
  • Codeur Php / Mysql / Pawno
  • Messages: 53
    • Voir le profil
Re : ou placé ce If ?
« Réponse #4 le: 23 Août 2010, 10:28:14 »
forward ABroadCast(color,const string[],level, inDuty);

Code: (pawn) [Sélectionner]
public ABroadCast(color,const string[],level, inDuty)
{
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
            if(!IsPlayerConnected(i))
                  {continue;}
            if (PlayerInfo[i][pAdmin] < level)
                  {continue;}
            if(!inDuty || inDuty && (variable pour verifier si l'admin est en service))
                  {SendClientMessage(i, color, string);}
            printf("%s", string);
      }
}

Puis si tu veux envoyer un message à un admin qui doit etre en service :

ABroadCast(COLOR, string, LEVEL_MINI, true);
Sinon, pour tous les admins connectés :

ABroadCast(COLOR, string, LEVEL_MINI, false);

Il faudra que tu modifies tous tes ABroadCast par contre ^^
 
Codeur Php / Pawno / MySql - Administration et maintenance serveur