OnPlayerText Help [+REP]
#1

Hello, I'm trying to make a script.
The script is:
When an admin types something, the thing which the admin typed should appear in the main chat without the sender's name.
Thanks, please help.
Reply
#2

You need to return 0 in OnPlayerText and make a format of how each player's text will be shown

The admin text would be similar to
pawn Код:
new string[128];
format(string,sizeof(string),"%s",text);
SendClientMessageToAll(-1,string);
Reply
#3

Sorry, but can you make me a full code?
Reply
#4

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid)
    {
        SendClientMessageToAll(-1, text);
        return 1;
    }
    return 1;
}
u need to be rcon admin ^^ may work, may not
Reply
#5

pawn Код:
public OnPlayerText(playerid, text[])
{
   // if player is Admin, in this case : RCON ADMIN, your desired message is send
   if(IsPlayerAdmin(playerid)) // replace IsPlayerAdmin([playerid) with your Admin system's function!
   {
       new string[256];
       format(string, sizeof(string), "%s", text);
       SendClientMessageToAll(-1, string);
   }
   else // but if the player is not admin, then an ordinary message is send.
   {
       new string1[256];
       format(string1, sizeof(string1), "%s:{FFFFFF} %s", text);
       SendClientMessageToAll(GetPlayerColor(playerid), string1);
   }
   return 0; // disables the defalt SA-MP chat so we can make custom chat
}
Reply
#6

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        format(string, sizeof(string), "Administrator says : %s", text);
        SendClientMessageToAll(-1, string);
        return 1;
    }
    return 1;
}
Like this ?
Reply
#7

What your code does is:
Sending Default Message: like: (Playercolor)Playernamewhite)text
and also will send
Administrator says: text, but with white.

Try to look at my code, is the one above.
Reply
#8

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new string[150], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(string,sizeof(string),"{40E0D0}[ADMIN] {%06x}%s(%d): {FFFFFF}%s", GetPlayerColor(playerid) >>> 8, name, playerid, text);
        SendClientMessageToAll(-1, string);
        return 0;
    }
    return 1;
}
Reply
#9

Thank y'all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)