Problem with /o chat
#1

When I go in game and chat in /o it does not come up with your Admin Rank, it only said 'Administrator', can anyone help me to get this set to the correct player rank!?

Code:
Quote:

CMD: o(playerid, params[])
{
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if ((noooc) && (PlayerInfo[playerid][pAdmin] < 2 && EventKernel[EventCreator] != playerid && PlayerInfo[playerid][pDonateRank] < 6 && !OOCPower[playerid] && PlayerInfo[playerid][pHelper] < 4))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " The OOC channel has been disabled by an Admin!");
return 1;
}
if(gOoc[playerid])
{
SendClientMessageEx(playerid, TEAM_CYAN_COLOR, " You have disabled OOC Chat, re-enable with /togooc!");
return 1;
}
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/o)oc [ooc chat]");

if(PlayerInfo[playerid][pAdmin] == 1)
{
new string[128];
format(string, sizeof(string), "(( Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Administrator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pAdmin] >= 999999)
{
new string[128];
format(string, sizeof(string), "(( Server Owner %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pHelper] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Community Advisor %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
else if(PlayerInfo[playerid][pDonateRank] == 6)
{
new string[128];
format(string, sizeof(string), "(( Special Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pHelper] <= 2)
{
new string[128];
format(string, sizeof(string), "(( %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
return 1;
}

Reply
#2

Change this line:
pawn Код:
else if(PlayerInfo[playerid][pAdmin] >= 2)
for this one:
pawn Код:
else if(2 <= PlayerInfo[playerid][pAdmin] < 999999)
Reply
#3

It comes from here :

pawn Код:
else if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Administrator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
Simply divide "if the player is an administrator" main condition by smaller parts such as "if the player is an administrator with admin level 2", "with admin level 3", etc.
Reply
#4

Код:
CMD: o(playerid, params[])
{
new AdminRank;
AdminRank = PlayerInfo[playerid][pAdmin];
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if ((noooc) && (PlayerInfo[playerid][pAdmin] < 2 && EventKernel[EventCreator] != playerid && PlayerInfo[playerid][pDonateRank] < 6 && !OOCPower[playerid] && PlayerInfo[playerid][pHelper] < 4))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " The OOC channel has been disabled by an Admin!");
return 1;
}
if(gOoc[playerid])
{
SendClientMessageEx(playerid, TEAM_CYAN_COLOR, " You have disabled OOC Chat, re-enable with /togooc!");
return 1;
}
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/o)oc [ooc chat]");

if(PlayerInfo[playerid][pAdmin] == 1)
{
new string[128];
format(string, sizeof(string), "(( Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Administrator %s Level %i: %s ))", GetPlayerNameEx(playerid), AdminRank params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pAdmin] >= 999999)
{
new string[128];
format(string, sizeof(string), "(( Server Owner %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pHelper] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Community Advisor %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
else if(PlayerInfo[playerid][pDonateRank] == 6)
{
new string[128];
format(string, sizeof(string), "(( Special Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pHelper] <= 2)
{
new string[128];
format(string, sizeof(string), "(( %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
return 1;
}

EDIT: Wait, What do you want?
I edited your code, so the admin rank shows up in the message
Reply
#5

Quote:

Code:

CMD: o(playerid, params[])
{
new AdminRank;
AdminRank = PlayerInfo[playerid][pAdmin];
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if ((noooc) && (PlayerInfo[playerid][pAdmin] < 2 && EventKernel[EventCreator] != playerid && PlayerInfo[playerid][pDonateRank] < 6 && !OOCPower[playerid] && PlayerInfo[playerid][pHelper] < 4))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " The OOC channel has been disabled by an Admin!");
return 1;
}
if(gOoc[playerid])
{
SendClientMessageEx(playerid, TEAM_CYAN_COLOR, " You have disabled OOC Chat, re-enable with /togooc!");
return 1;
}
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/o)oc [ooc chat]");

if(PlayerInfo[playerid][pAdmin] == 1)
{
new string[128];
format(string, sizeof(string), "(( Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Administrator %s Level %i: %s ))", GetPlayerNameEx(playerid), AdminRank params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pAdmin] >= 999999)
{
new string[128];
format(string, sizeof(string), "(( Server Owner %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
else if(PlayerInfo[playerid][pHelper] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Community Advisor %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
else if(PlayerInfo[playerid][pDonateRank] == 6)
{
new string[128];
format(string, sizeof(string), "(( Special Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pHelper] <= 2)
{
new string[128];
format(string, sizeof(string), "(( %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
return 1;
}
return 1;
}


EDIT: Wait, What do you want?
I edited your code, so the admin rank shows up in the message

I wanted it so whatever the player admin rank is it will say it in /o , I'm the server owner and when I talk in /o it said
"Administrator:" as my rank, when I'm the owner.
Reply
#6

Your problem comes from the fact that this code

pawn Код:
else if(PlayerInfo[playerid][pAdmin] >= 999999)
{
new string[128];
format(string, sizeof(string), "(( Server Owner %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}
will never be read if you are an administrator, because if you are, this one

pawn Код:
else if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Administrator %s Level %i: %s ))", GetPlayerNameEx(playerid), AdminRank params);
OOCOff(COLOR_OOC,string);
}
will be considered as "true" before.

To fix it, replace your condition for admin level 2+ by this one :

pawn Код:
if(2 <= PlayerInfo[playerid][pAdmin] < 99999)
Reply
#7

Quote:

Your problem comes from the fact that this code

pawn Code:
else if(PlayerInfo[playerid][pAdmin] >= 999999)
{
new string[128];
format(string, sizeof(string), "(( Server Owner %s: %s ))", GetPlayerNameEx(playerid), params);
OOCOff(COLOR_OOC,string);
}

will never be read if you are an administrator, because if you are, this one

pawn Code:
else if(PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128];
format(string, sizeof(string), "(( Administrator %s Level %i: %s ))", GetPlayerNameEx(playerid), AdminRank params);
OOCOff(COLOR_OOC,string);
}

will be considered as "true" before.

To fix it, replace your condition for admin level 2+ by this one :

pawn Code:
if(2 <= PlayerInfo[playerid][pAdmin] < 99999)

I did that and it said "Administrator" in /o still
Reply
#8

Why instead of making that command unbearably big, do this:

pawn Код:
stock GetAdminName(playerid)
    {
        new ret[16 + 1];
        switch (Player[playerid][AdminLevel])
        {
            case 0:format(ret, sizeof(ret), "Player");
            case 1:format(ret, sizeof(ret), "Moderator");
            case 2 ... 999998:format(ret, sizeof(ret), "Administrator");
            case 999999:format(ret, sizeof(ret), "Server Owner");
        }
        return ret;
    }
So in the function you can just: (uses sscanf)

pawn Код:
CMD:o(playerid, params[])
    {
        new
            message[144],
            s[24 + 1],
            phelper = PlayerInfo[playerid][pHelper],
            padmin = PlayerInfo[playerid][pAdmin],
            pdonator = PlayerInfo[playerid][pDonateRank];
       
        if(gPlayerLogged{playerid} == 0) return SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in!");
        if(noooc) return SendClientMessageEx(playerid, COLOR_GRAD2, "The OOC Channel has been disabled by an admin!"); // Change it back to whatever you had if you need it, didnt see the concept behind it and thought it was useless XD
        if(gOoc[playerid]) return SendClientMessageEx(playerid, TEAM_CYAN_COLOR, "You have disabled the OOC chat. Re-enable it with /togooc!");
        if(sscanf(params, "%s", message)) return SendClientMessageEx(playerid, COLOR_GRAD2, "Usage: /ooc [message");
       
        if(padmin != 0)
        {
            format(s, sizeof(s), "%s %s: %s", GetAdminName(playerid), GetPlayerNameEx(playerid), message);
        }
        else if(phelper >= 2)
        {
            format(s, sizeof(s), "Community Advisor %s: %s", GetPlayerNameEx(playerid), message);
        }
        else if(donator == 6)
        {
            format(s, sizeof(s), "Special Moderator %s: %s", GetPlayerNameEx(playerid), message);
        }
        SendClientMessageToAll(COLOR_OOC, s);
       
    }
Reply
#9

I did that and I get these errors.


Error:
Quote:

C:\Users\James\Desktop\Second Life Gaming RP\SLRP.pwn(1294) : error 017: undefined symbol "Player"
C:\Users\James\Desktop\Second Life Gaming RP\SLRP.pwn(1294) : error 029: invalid expression, assumed zero
C:\Users\James\Desktop\Second Life Gaming RP\SLRP.pwn(1294) : error 029: invalid expression, assumed zero
C:\Users\James\Desktop\Second Life Gaming RP\SLRP.pwn(1294) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

4 Errors.

Pawn Code:
Quote:

stock GetAdminName(playerid)
{
new ret[16 + 1];
switch (Player[playerid][AdminLevel])
{
case 0:format(ret, sizeof(ret), "Player");
case 1:format(ret, sizeof(ret), "Server Moderator");
case 2:format(ret, sizeof(ret), "Junior Administrator");
case 3:format(ret, sizeof(ret), "General Administrator");
case 4:format(ret, sizeof(ret), "Senior Administrator");
case 5:format(ret, sizeof(ret), "Head Administrator");
case 6:format(ret, sizeof(ret), "Server Manager");
case 7:format(ret, sizeof(ret), "Server Co-Owner");
case 8:format(ret, sizeof(ret), "Server Owner");
}
return ret;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)