GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Leonidas300 le 22 Août 2010, 19:44:53

Titre: ou placé ce If ?
Posté par: Leonidas300 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
Titre: Re : ou placé ce If ?
Posté par: Eloctro 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
Titre: Re : ou placé ce If ?
Posté par: minimicro 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.
Titre: Re : ou placé ce If ?
Posté par: Leonidas300 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);
Titre: Re : ou placé ce If ?
Posté par: minimicro 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 ^^