Admin Chat Help
#1

Hi,

I'm making an admin chat command but I'd like some minor help with the command. I'd highly appriciate it if you guys or gals could help me out by showing me how I can change the following script into such: I'd like players with a level above 1 to be able to speak in /ac, although when they use the command I want it to say "(( Admin %s: %s ))", but when level 1 players use the command I want it to say "(( Moderator %s: %s )). Oh, and obviously level 0 players shouldn't be able to use the command, as demonstrated in the script. I doubt it's too hard for you guys, and I'll appriciate it a lot if you help out!

pawn Code:
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];
    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;
}
Reply
#2

Add
pawn Code:
if(PlayerInfo[playerid][Level] == 1) format(string, sizeof(string), " Moderator %s: %s", GetPName(playerid), params);
Full code:
pawn Code:
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[playerid][Level] < 1) return SendClientMessage(playerid, 0xc3f8fd, string);
    }
    return 1;
}
Reply
#3

Nope.
pawn Code:
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
#4

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; // I think it should be > instead of < ?
SendClientMessage(i, 0xc3f8fd, string);
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)