SA-MP Forums Archive
Admin Chat Help - 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 Help (/showthread.php?tid=497988)



Admin Chat Help - Vasu99 - 01.03.2014

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



Re: Admin Chat Help - MattTucker - 01.03.2014

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



Re: Admin Chat Help - Threshold - 01.03.2014

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



Re: Admin Chat Help - Golimad - 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", 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;
}