MessageToAdmins doesn't work[DINI]
#1

Hi, i'm using sscanf for cmd system and DINI for Users.
I've created a /report command. I'm Italian, then the command has Italian Phrases.

Код:
dcmd_segnala(playerid,params[])
{
 new id;
 new motivo[256];
 new utente[24];
 new criminale[24];
 new string[256];
 if(sscanf(params,"us",id,motivo)) SendClientMessage(playerid,COLOR_YELLOW,"Usa: /segnala <id/nome> <motivo> - Serve per segnalare un utente fastidioso agli Admin in Linea!");
 else
 {
  if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,0xFF0000AA,"ID non connesso!");
  else
  {
   GetPlayerName(playerid,utente,sizeof(utente));
   GetPlayerName(id,criminale,sizeof(criminale));
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
    if(IsPlayerConnected(i))
    {
	 if(Account[i][pAdmin] >=1)
	 {
      format(string,sizeof(string),"{0000FF}<<<---[SEGNALAZIONE]--->>> {FFFFFF}[ %s ] {0000FF}ha segnalato {FFFFFF}[ %s ]{0000FF}----{FFFFFF}[{0000FF}Motivo:{FFFFFF} %s ]{0000FF} <<<---[SEGNALAZIONE]--->>>",utente,criminale,motivo);
      SendClientMessage(i,COLOR_WHITE,string);
     }
    }
   }
   format(string,sizeof(string),"[REPORT]--->>> [ %s ] ha segnalato [ %s ]----[Motivo: %s ]",utente,criminale,motivo);
   print(string);
   new File[300];
   format(File,sizeof(File),PATH,criminale);
   format(string,sizeof(string),"Da: %s - Per: %s",utente,motivo);
   dini_Set(File,"Report",string);
   Account[id][pReportNr]++;
  }
 }
return 1;
}
THE PROBLEM: This cmd doesn't send message to Admins. Then, this script doesn't work:
Код:
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
    if(IsPlayerConnected(i))
    {
	 if(Account[i][pAdmin] >=1)
	 {
      format(string,sizeof(string),"{0000FF}<<<---[SEGNALAZIONE]--->>> {FFFFFF}[ %s ] {0000FF}ha segnalato {FFFFFF}[ %s ]{0000FF}----{FFFFFF}[{0000FF}Motivo:{FFFFFF} %s ]{0000FF} <<<---[SEGNALAZIONE]--->>>",utente,criminale,motivo);
      SendClientMessage(i,COLOR_WHITE,string);
     }
    }
   }
I've already Tried with forward MessageToAdmins(ecc ecc ecc); public MessageToAdmins(ecc ecc ecc); but it does the same problem. Why?

Thanks for Replies
Reply
#2

why dont you just make a stock or a new callback? it's much easier to do it like this
pawn Код:
stock MessageToAllAdmins(msg[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(Account[i][pAdmin] >=1)
            {
                SendClientMessage(i,-1,msg);
            }
        }
    }
    return 1;
}
and an example to send a message to all admins who are online would be look like this
pawn Код:
new string[128];
format(string,sizeof(string),"Your Message Here");
MessageToAllAdmins(string);//this will manage to send your message to all admins
Reply
#3

Thanks, but it doesn't change. Same problem :/
Reply
#4

Try this one. hope it work's
pawn Код:
dcmd_segnala(playerid,params[])
{
    new id;
    new motivo[256];
    new string[256];
   
    new utente[24];
    GetPlayerName(playerid,utente,sizeof(utente));
    new criminale[24];
    GetPlayerName(id,criminale,sizeof(criminale));

    if(sscanf(params,"us",id,motivo)) return SendClientMessage(playerid,COLOR_YELLOW,"Usa: /segnala <id/nome> <motivo> - Serve per segnalare un utente fastidioso agli Admin in Linea!");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,0xFF0000AA,"ID non connesso!");
   
    format(string,sizeof(string),"[REPORT]--->>> [ %s ] ha segnalato [ %s ]----[Motivo: %s ]",utente,criminale,motivo);
    print(string);
    format(string,sizeof(string),"{0000FF}<<<---[SEGNALAZIONE]--->>> {FFFFFF}[ %s ] {0000FF}ha segnalato {FFFFFF}[ %s ]{0000FF}----{FFFFFF}[{0000FF}Motivo:{FFFFFF} %s ]{0000FF} <<<---[SEGNALAZIONE]--->>>",utente,criminale,motivo);
    MessageToAllAdmins(string);
   
    new File[300];
    format(File,sizeof(File),PATH,criminale);
    format(string,sizeof(string),"Da: %s - Per: %s",utente,motivo);
    dini_Set(File,"Report",string);
    return 1;
}
Reply
#5

Nothing ! :/ ... MessageToAllAdmins function doesn't work ...
Reply
#6

Max string length for SCM is ~145 but your string is bigger than that i think
Reply
#7

Need help with this too so i borrow this thread a bit

i want to add so when a player use this command every admin will get a message "Has Used The Command (/a).

pawn Код:
CMD:armour(playerid, params[])
{
    new /*string[128],*/ name[MAX_PLAYER_NAME], Float:armour;
    if(isDead[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
        return 1;
    }
    GetPlayerArmour(playerid, armour);
    if(armour >= 100)
    {
        SendClientMessage(playerid, COLOR_RED, "Your Armour Is Already Full.");
        return 1;
    }
    else
    {
    GetPlayerName(playerid, name, sizeof name);
  //  format(string, sizeof string, "%s (%d) Has Used /armour To Refill His Armour.", name, playerid);
    SetPlayerChatBubble(playerid, "Has Refilled His Armour (/a)", COLOR_YELLOW, 60, 3000);
  //    SendClientMessageToAll(COLOR_YELLOW, string);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Refilled Your Armour.");
    SetPlayerArmour(playerid, 100.0);
    return 1;
    }
}
pawn Код:
CMD:heal(playerid, params[])
{
   new /*string[128],*/ name[MAX_PLAYER_NAME];
   new Float:health;GetPlayerHealth(playerid,health);
   if(isDead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
   if(health >= 100) return SendClientMessage(playerid, COLOR_RED, "Your Health Is Already Full.");
   GetPlayerName(playerid, name, sizeof name);
  // format(string, sizeof string, "%s (%d) Has Used /heal To Heal Himself.", name, playerid);
   SetPlayerChatBubble(playerid, "Has Refilled His Health (/h)", COLOR_YELLOW, 60, 3000);
  // SendClientMessageToAll(COLOR_YELLOW, string);
   SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Healed Yourself.");
   SetPlayerHealth(playerid, 100.0);
   return 1;
}
Reply
#8

Add this

pawn Код:
stock MessageToAllAdmins(const msg[],color = -1)
{

    for(new i; i != MAX_PLAYERS; i++)
        if(IsPlayerConnected(i) && (Account[i][pAdmin] >= 1 || IsPlayerAdmin(i)))
            SendClientMessage(i,color,msg);

    return;
}
replace
pawn Код:
SendClientMessageToAll(COLOR_YELLOW, string);
to
pawn Код:
MessageToAllAdmins(string,COLOR_YELLOW);
and uncomment formats
Reply
#9

Got error, think its this :

if(IsPlayerConnected(i) && (Account[i][pAdmin] >= 1 || IsPlayerAdmin(i)))

my admin variable is (!IsCnRAdmin) can you fix it pls ?
Reply
#10

Just replace to your own variable(s)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)