Admin Duty
#1

Hello,
What I would like to know, which I figure this is very simple but I have no idea what the line would write out as.

I want to know how to change the color of an admins name when he/she goes onto admin duty.

EX: If I got on adminduty, I would like my name to show up as RED when I am on adminduty and the normal white when I am off, so that players know who is on admin duty.

Anyone care you help?

At the moment my aduty command looks like this:
Код:
command(aduty, playerid, params[])
{
#pragma unused params
    new string[128];
    if(Player[playerid][AdminLevel] >= 1) {
        if(Player[playerid][AdminDuty] == 0) {
            if(strlen(Player[playerid][AdminName]) >= 1 || strcmp(Player[playerid][AdminName], "Nothing", true) == 0) {
                SendClientMessage(playerid, WHITE, "You are now on admin duty.");
                Player[playerid][AdminDuty] = 1;

                if(Player[playerid][AdminLevel] >= 3) {
                    SetPlayerHealth(playerid, 500000);
                }

                SetPlayerSkin(playerid, Player[playerid][AdminSkin]);

                if(Player[playerid][HospitalTime] >= 1) {
                    Player[playerid][HospitalTime] = 0;
                    SetCameraBehindPlayer(playerid);
                    SetPlayerPos(playerid, SpawnX, SpawnY, SpawnZ);
                    SetPlayerDrunkLevel(playerid, 0);
                    SendClientMessage(playerid, WHITE, "You have been de-hospitalized.");
                }

                format(string, sizeof(string), "%s is now on Admin Duty.", Player[playerid][NormalName]);
                SendToAdmins(ADMINORANGE, string, 0);
            }
            else {
                SendClientMessage(playerid, WHITE, "You haven't set an administrators' name yet.");
            }
        }
        else {
            SendClientMessage(playerid, WHITE, "You're now off admin duty, though you will still see admin chat.");
            Player[playerid][AdminDuty] = 0;

            SetPlayerColor(playerid, WHITE);

            if(Player[playerid][AdminLevel] >= 3) {
                SetPlayerHealth(playerid, 100);
            }

            if(strlen(Player[playerid][NormalName]) > 1) {
                SetPlayerName(playerid, Player[playerid][NormalName]);
            }

            SetPlayerSkin(playerid, Player[playerid][LastSkin]);

            format(string, sizeof(string), "%s is now off Admin Duty.", GetName(playerid));
            SendToAdmins(ADMINORANGE, string, 0);
        }
    }
    return 1;
}
Reply
#2

pawn Код:
format(string,sizeof(string),"%s is now on Admin Duty.",Player[playerid][NormalName]);
SendToAdmins(ADMINORANGE,string,0);
SetPlayerColor(playerid,0xFF0000AA);
https://sampwiki.blast.hk/wiki/SetPlayerColor
Reply
#3

Thank you for quick reply.

Where should I add this into the script?


Sorry still teaching myself about basics of scripting. xD
Reply
#4

Have a good read through that code you posted.

With what you can gather from the wiki for SetPlayerColor, look where it turns admin ON and then OFF, this is where you want to use that function to change to red and to white (it's pretty easy to find as there is actual text in a message which says your on and off duty).

Also note where [pAdmin] is set to 1 (which means ON admin duty) and set to 0 (which means OFF admin duty).

Most variables like this are the same, 0 is OFF and 1 is ON.
Reply
#5

Again I thank you. xD

I realized after you posted that, I made yet another newbie mistake.

Thank you SAMP Community.
Reply
#6

Don't worry about, we all got to start somewhere. Years ago when I got into this sort of things, asking questions people acted like it was World War III LOL! Now they ask for my help..... :P.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)