Admin Chat < Admins can't see chat or my text, but I can see their chat
#1

This is the command I'm talking about. I can see my own text, but no other admin can see it. And when other admins are trying to talk in /a, they cannot see their own chat but I can see it. What's wrong with this cmd?

pawn Code:
dcmd_a(playerid, params[])
{
    new aText[128],aName[MAX_PLAYER_NAME],string[128];
    if(sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");
    if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
    GetPlayerName(playerid,aName,sizeof(aName));
    format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(pInfo[i][pAdmin] > 0) return SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    return 1;
}
Reply
#2

pawn Code:
if(!sscanf(params,"s",aText))
should be
pawn Code:
if(sscanf(params,"s",aText))
Reply
#3

Quote:
Originally Posted by bogeyman_EST
pawn Code:
if(!sscanf(params,"s",aText))
should be
pawn Code:
if(sscanf(params,"s",aText))
Already tried, isn't working.
Reply
#4

Try this:

pawn Code:
dcmd_a(playerid,params[])
{
    new aName[MAX_PLAYER_NAME],string[128];
    if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
    if(!strlen(params)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");
   
    GetPlayerName(playerid,aName,sizeof(aName));
    format(string,sizeof(string),"[AdminChat]%s: %s",aName,params);
   
    for(new i=0;i<=MAX_PLAYERS<i++;)
    {
      if(pInfo[i][pAdmin] > 0)
        SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by WackoX
Try this:

pawn Code:
dcmd_a(playerid,params[])
{
    new aName[MAX_PLAYER_NAME],string[128];
    if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
    if(!strlen(params)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");
   
    GetPlayerName(playerid,aName,sizeof(aName));
    format(string,sizeof(string),"[AdminChat]%s: %s",aName,params);
   
    for(new i=0;i<=MAX_PLAYERS<i++;)
    {
      if(pInfo[i][pAdmin] > 0)
        SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    return 1;
}
Not working, same as my command. Only showing the usage, nothing else.
Reply
#6

Try this
pawn Code:
dcmd_a(playerid,params[])
{
    new aText[128],aName[MAX_PLAYER_NAME],string[128];
    if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
    if(sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");
   
    GetPlayerName(playerid,aName,sizeof(aName));
    format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);
   
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
      if(pInfo[i][pAdmin] > 0)
        SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    return 1;
}
Reply
#7

pawn Code:
{
new aText[128],aName[MAX_PLAYER_NAME],string[128];
if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
if(!sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");

GetPlayerName(playerid,aName,sizeof(aName));
format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);

for(new i=0;i<=MAX_PLAYERS;i++)
{
  if(pInfo[i][pAdmin] > 0)
    SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
return 1;
}
Reply
#8

Quote:
Originally Posted by Razvann
pawn Code:
{
new aText[128],aName[MAX_PLAYER_NAME],string[128];
if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
if(!sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");

GetPlayerName(playerid,aName,sizeof(aName));
format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);

for(new i=0;i<=MAX_PLAYERS;i++)
{
  if(pInfo[i][pAdmin] > 0)
    SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
return 1;
}
Not working.

Quote:
Originally Posted by Razvann
pawn Code:
{
new aText[128],aName[MAX_PLAYER_NAME],string[128];
if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
if(!sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");

GetPlayerName(playerid,aName,sizeof(aName));
format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);

for(new i=0;i<=MAX_PLAYERS;i++)
{
  if(pInfo[i][pAdmin] > 0)
    SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
return 1;
}
THIS ONE WORKS!!!
There is only 1 little thing:
When I type for example ''/a test''
it shows;
(AdminChat)[UF]DarkPhoenix: test
SERVER: Unknown Command (while it IS working).
Reply
#9

Code:
return 0;
instead of
Quote:

return 1;

?

just a suggestion, im not a super good scripter
Reply
#10

Quote:
Originally Posted by KnackeBrod
Code:
return 0;
instead of
Quote:

return 1;

?
Doesn't change anything at all.
Reply
#11

pawn Код:
{
new aText[128],aName[MAX_PLAYER_NAME],string[128];
if(pInfo[playerid][pAdmin] < 1) { SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level."); return 1; }
if(!sscanf(params,"s",aText)) { SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''."); return 1; }

GetPlayerName(playerid,aName,sizeof(aName));
format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);

for(new i=0;i<=MAX_PLAYERS;i++)
{
 if(pInfo[i][pAdmin] > 0)
   SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
return 1;
}
Should work, but I wrote it off my mind.
Reply
#12

pawn Код:
dcmd_a(playerid,params[])
{
    new aText[128],aName[MAX_PLAYER_NAME],string[128];
    if(sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");
    if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
    GetPlayerName(playerid,aName,sizeof(aName));
    format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);
   
    for(new i=0;i<=MAX_PLAYERS<i++;)
    {
      if(pInfo[i][pAdmin] > 0)
        SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    return 1;
}
sscanf should be before pInfo
Reply
#13

Quote:
Originally Posted by [03
Garsino ]
pawn Код:
dcmd_a(playerid,params[])
{
    new aText[128],aName[MAX_PLAYER_NAME],string[128];
    if(sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"[USAGE] ''/a [text]''.");
    if(pInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_LIGHTYELLOW,"You are not an Administrator with the required level.");
    GetPlayerName(playerid,aName,sizeof(aName));
    format(string,sizeof(string),"[AdminChat]%s: %s",aName,aText);
   
    for(new i=0;i<=MAX_PLAYERS<i++;)
    {
      if(pInfo[i][pAdmin] > 0)
        SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    return 1;
}
sscanf should be before pInfo
Not working. Seriously, noone knows! :P
Reply
#14

Take a look at mine, it's working perfect.
pawn Код:
dcmd_adminmessage(playerid, params[])
{
    if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid))
    {
        new msg[128], string[128];
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /adminmessage (message)");
        if(strlen(msg) < 1) return SendClientMessage(playerid, COLOUR_SYSTEM, "Your Message Must Contain At Least 1 Character.");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][Level] >= 1)
            {
            format(string, sizeof(string), "Admin Message (%s): %s", pNick(playerid), msg);
            SendClientMessage(i, 0x33FF33AA, string);
            }
        }
        return 1;
    }
    else return SendErrorMessage(playerid, 0); // Unknown command error message
}

stock pNick(playerid) // You will need this one, it's a very handy custom function instead of using GetPlayerName all the time.
{
    new nick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
    return nick;
}
Reply
#15

Quote:
Originally Posted by [03
Garsino ]
Take a look at mine, it's working perfect.
pawn Код:
dcmd_adminmessage(playerid, params[])
{
    if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid))
    {
        new msg[128], string[128];
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOUR_SYSTEM, "Usage: /adminmessage (message)");
        if(strlen(msg) < 1) return SendClientMessage(playerid, COLOUR_SYSTEM, "Your Message Must Contain At Least 1 Character.");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlayerInfo[i][Level] >= 1)
            {
            format(string, sizeof(string), "Admin Message (%s): %s", pNick(playerid), msg);
            SendClientMessage(i, 0x33FF33AA, string);
            }
        }
        return 1;
    }
    else return SendErrorMessage(playerid, 0); // Unknown command error message
}

stock pNick(playerid) // You will need this one, it's a very handy custom function instead of using GetPlayerName all the time.
{
    new nick[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
    return nick;
}
No, I want to use my own but MY command isn't working that's why I asked help.
Reply
#16

Look at mine and see how I made it
...
Reply
#17

Quote:
Originally Posted by [03
Garsino ]
Look at mine and see how I made it
...
I told you, it ain't working.
Reply
#18

Then you have screwed something up, srsly. It works fine for me.
Reply
#19

Quote:
Originally Posted by [03
Garsino ]
Then you have screwed something up, srsly. It works fine for me.
This code works for me. You must have screwed something up, like stated above.
Reply
#20

make sure you have the correct lengt with
dcmd(commandhere, commandlenght(without /), cmdtext);
like
pawn Код:
dcmd(amsg, 4, cmdtext);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)