Admin Chat
#1

I need little help in my admin chat

pawn Код:
stock SendMessageToAdmins(text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i))
        {
            SendClientMessage(i, blue, text);
        }
    }
}
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid) && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(msg);
         return 0;
}
But i can't get it to work for my own admin variable

pawn Код:
if(PInfo[playerid][Level] < 1)
Could someone fix this?
Reply
#2

use this:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid) && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(colorhere,string);
         return 0;
}
pawn Код:
forward SendMessageToAdmins(color,const string[]);
public SendMessageToAdmins(color,const string[])
{

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (IsPlayerAdmin(i)) SendClientMessage(i, color, string);
    }
}
tested it works perfectly fine, i hope that helps
Reply
#3

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
use this:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid) && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(colorhere,string);
         return 0;
}
pawn Код:
forward SendMessageToAdmins(color,const string[]);
public SendMessageToAdmins(color,const string[])
{

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1) if (IsPlayerAdmin(i)) SendClientMessage(i, color, string);
    }
}
tested it works perfectly fine, i hope that helps
Yes.. but i need it to work with this
if(PInfo[playerid][Level] < 1) not rcon..
Before posting please read the topic man
Reply
#4

pawn Код:
stock SendMessageToAdmins(text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PInfo[playerid][Level])
        {
            SendClientMessage(i, blue, text);
        }
    }
}
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PInfo[playerid][Level] && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(msg);
         return 0;
    }
}
Reply
#5

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
pawn Код:
stock SendMessageToAdmins(text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PInfo[playerid][Level])
        {
            SendClientMessage(i, blue, text);
        }
    }
}
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PInfo[playerid][Level] && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(msg);
         return 0;
    }
}
pawn Код:
C:\Users\Bichan\Desktop\UKTDM\gamemodes\UKTDM.pwn(766) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

Код:
public OnPlayerText(playerid, text[])
{
    if(PInfo[playerid][Level] < 1 && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(msg);
         return 0;
    }
}
TRY
Reply
#7

Quote:
Originally Posted by yusei
Посмотреть сообщение
Код:
public OnPlayerText(playerid, text[])
{
    if(PInfo[playerid][Level] < 1 && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(msg);
         return 0;
    }
}
TRY
Don't you think i tried that? it gives me alot of errors...
Reply
#8

Quote:
Originally Posted by Biess
Посмотреть сообщение
I need little help in my admin chat

pawn Код:
stock SendMessageToAdmins(text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i))
        {
            SendClientMessage(i, blue, text);
        }
    }
}
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid) && text[0] == '.')
    {
         new msg[128], pName[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
         format(msg, sizeof(msg), "[ADMIN CHAT] %s (ID %d): %s", pName, playerid, text[1]);
         SendMessageToAdmins(msg);
         return 0;
}
But i can't get it to work for my own admin variable

pawn Код:
if(PInfo[playerid][Level] < 1)
Could someone fix this?
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PInfo[i][Level] > 1)
        {
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PInfo[playerid][Level] > 1 && text[0] == '.')
I'd recommend to start learning basic variables.
Reply
#9

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PInfo[i][Level] > 1)
        {
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PInfo[playerid][Level] > 1 && text[0] == '.')
I'd recommend to start learning basic variables.
worked ty.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)