SA-MP Forums Archive
Admin chat doesn't work - 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 doesn't work (/showthread.php?tid=497995)



Admin chat doesn't work - Vasu99 - 01.03.2014

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!


Re: Admin chat doesn't work - Hybris - 01.03.2014

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


Re: Admin chat doesn't work - Vasu99 - 01.03.2014

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


Re: Admin chat doesn't work - PrivatioBoni - 01.03.2014

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.


Re: Admin chat doesn't work - Threshold - 01.03.2014

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.


Re: Admin chat doesn't work - Vasu99 - 01.03.2014

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.


Re: Admin chat doesn't work - Threshold - 01.03.2014

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



Re: Admin chat doesn't work - Vasu99 - 01.03.2014

Thanks mate, REP+!