Admin Chat
#1

If player not a admin but still use the command
it send to the admin like Test:
Код:
CMD:achat(playerid, params[])
{
	new string[128];
    new result[128];
	if (PlayerInfo[playerid][pAdmin] >= 3)
    if(sscanf(params,"s[128]",result))
    {
              SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /achat [Message]");
    }
	for (new i; i < MAX_PLAYERS; i++)
	{
        if (PlayerInfo[i][pAdmin] >= 3)
	    {
            new pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, sizeof(pName));
            if (PlayerInfo[i][pAdmin] >= 3)format(string, 128, "Admin Chat: %s: %s", pName, result);
            SendClientMessage(i, 0xFFFFFFFF, string);
	    }
	}
	return 1;
}
Reply
#2

try:
Код:
CMD:achat(playerid, params[])
{
	new string[128];
    new result[128];
	if (PlayerInfo[playerid][pAdmin] < 3) return true;
    if(sscanf(params,"s[128]",result)) return  SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /achat [Message]");
	for (new i; i < MAX_PLAYERS; i++)
	{
        if (PlayerInfo[i][pAdmin] >= 3)
	    {
            new pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, sizeof(pName));
            if (PlayerInfo[i][pAdmin] >= 3)format(string, 128, "Admin Chat: %s: %s", pName, result);
            SendClientMessage(i, 0xFFFFFFFF, string);
	    }
	}
	return 1;
}
Reply
#3

Quote:
Originally Posted by Kqly
Посмотреть сообщение
try:
Код:
CMD:achat(playerid, params[])
{
	new string[128];
    new result[128];
	if (PlayerInfo[playerid][pAdmin] < 3) return true;
    if(sscanf(params,"s[128]",result)) return  SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /achat [Message]");
	for (new i; i < MAX_PLAYERS; i++)
	{
        if (PlayerInfo[i][pAdmin] >= 3)
	    {
            new pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, sizeof(pName));
            if (PlayerInfo[i][pAdmin] >= 3)format(string, 128, "Admin Chat: %s: %s", pName, result);
            SendClientMessage(i, 0xFFFFFFFF, string);
	    }
	}
	return 1;
}
Nope still not working
Reply
#4

Check if player is an admin or not to use this command at the very beginning. Secondly, you should loop through connected players only (it can really cause a mess if variables aren't being reset properly).
pawn Код:
CMD:achat(playerid, params[]) {

    if(PlayerInfo[playerid][pAdmin] < 3)
        return SendClientMessage(playerid, 0xFF0000FF, "ERROR : You're not authorized to use this command!");
    //Other..
Reply
#5

Try this:

Quote:

CMD:achat(playerid, params[])
{
new string[128];
new result[128];
if (PlayerInfo[playerid][pAdmin] >= 3)
{
if(sscanf(params,"s[128]",result))
{
return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /achat [Message]");
}
for (new i; i < MAX_PLAYERS; i++)
{
if (PlayerInfo[i][pAdmin] >= 3)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, 128, "Admin Chat: %s: %s", pName, result);
SendClientMessage(i, 0xFFFFFFFF, string);
}
}
}
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)