SA-MP Forums Archive
Admin Chat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Admin Chat (/showthread.php?tid=381147)



Admin Chat - Biess - 28.09.2012

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?


Re: Admin Chat rep++ - XtremeR - 28.09.2012

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


Re: Admin Chat rep++ - Biess - 28.09.2012

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


Re: Admin Chat rep++ - iPLEOMAX - 28.09.2012

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;
    }
}



Re: Admin Chat rep++ - Biess - 28.09.2012

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.



Re : Admin Chat rep++ - yusei - 28.09.2012

Код:
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


Re: Re : Admin Chat rep++ - Biess - 28.09.2012

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...


Re: Admin Chat rep++ - mamorunl - 28.09.2012

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.


Re: Admin Chat rep++ - Biess - 28.09.2012

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.