Admin chat doesn't work
#1

Hi,

I just made an admin chat command but it doesn't seem to work, for some reason. As I type in something in /ac nothing comes up in the chat, and I'm not sure why.

pawn Код:
CMD:ac(playerid,params[])
{
    if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, 0xF69521AA, "You can't use this command!");
    if(isnull(params)) return SendClientMessage(playerid, 0xF69521AA, "USAGE: /ac [message]");
    new string[128];
    if(PlayerInfo[playerid][Level] == 1) format(string, sizeof(string), "(( Moderator %s: %s ))", GetPName(playerid), params);
    format(string, sizeof(string), "(( Admin %s: %s ))", GetPName(playerid), params);
    foreach(Player, i){
    if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, 0xc3f8fd, string);
    }
    return 1;
}
I hope you can help!
Reply
#2

Код:
CMD:ac(playerid,params[])
{
    if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, 0xF69521AA, "You can't use this command!");
    if(isnull(params)) return SendClientMessage(playerid, 0xF69521AA, "USAGE: /ac [message]");
    new string[128];
    if(PlayerInfo[playerid][Level] == 1) format(string, sizeof(string), "(( Moderator %s: %s ))", GetPlayerName(playerid), params);
    format(string, sizeof(string), "(( Admin %s: %s ))", GetPlayerName(playerid), params);
    foreach(Player, i){
    if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, 0xc3f8fd, string);
    return 1;
}
Try this
Reply
#3

Thanks but it didn't really work, just gave me loads of errors.
Reply
#4

I've never seen it done like that before.

I'd suggest making an admin message function which loops around the players and checks if they're an admin - if they are, they see the message. That's always how I've done it.
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=497988

Don't make more than 1 thread for the same error, especially not within a 24 hour time period...

EDIT: It was more of a 2 hour time period, to make things worse.
Reply
#6

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=497988

Don't make more than 1 thread for the same error, especially not within a 24 hour time period...

EDIT: It was more of a 2 hour time period, to make things worse.
It's not the same error, therefore it would just be confusing for people if I were to talk about a completely new error in a topic about another error.

PriviatioBoni, how am I supposed to do that? I kind of get what you mean, but I'm not entirely sure how to do that.
Reply
#7

It's the exact same command... people will learn to adjust...
I've already posted the working code in the other thread.

pawn Код:
CMD:ac(playerid,params[])
{
    if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, 0xF69521AA, "You can't use this command!");
    if(isnull(params)) return SendClientMessage(playerid, 0xF69521AA, "USAGE: /ac [message]");
    new string[128];
    if(PlayerInfo[playerid][Level] == 1) format(string, sizeof(string), " Moderator %s: %s", GetPName(playerid), params);
    else format(string, sizeof(string), "Admin %s: %s", GetPName(playerid), params);
    foreach(Player, i)
    {
        if(PlayerInfo[i][Level] < 1) continue;
        SendClientMessage(i, 0xc3f8fd, string);
    }
    return 1;
}
Reply
#8

Thanks mate, REP+!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)