Admin off-duty help
#1

Could someone help me to do add admin off-duty stuff to this?

pawn Код:
CMD:adminduty(playerid, params[])
{
 new string[64];
 if (PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You can't use this command!");
 if (PlayerInfo[playerid][pAdminLevel] <= 3) return SendClientMessage(playerid, 0x868479FF, "TIP: Use /modduty to go on duty!");
 {
    format(string, sizeof(string), "ADMINDUTY: You are now admin on duty! (Your adminlevel is %s) ", pAdminLevel);
    SendClientMessage(playerid, 0x00FF00FF, string);
    PlayerInfo[playerid][pAdminDuty] = 1;
}
return 1;
}
I have tried to create that off-duty thing with "else" but i'm receiving error "error 029: invalid expression, assumed zero" so could anyone help me making that off-duty thing thx
Reply
#2

I just helped someone with an explanationpost that is somehow related to yours so perhaps, read this and if you still have an unanswered question. Just reply and i'll answer your question myself .



Quote:
Originally Posted by Rolyy
Посмотреть сообщение
Why using 2 commands? Why not use 1 command that toggle's it on or off by using a variable. In my opinion it would be more effective.


Here an example:
pawn Код:
//Somewhere at the beginning of the script
new ShowMessages[MAX_PLAYERS];


//under OnPlayerConnect
ShowMessages[playerid] = 1;


//under OnPlayerCommand
if(strcmp(cmd, "/togglemessage", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(ShowMessages[playerid] == 1)
        {
            ShowMessages[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "You have {00FFFF}Disabled {FFFFFF}the messages, Type /togglemessage again to toggle it."); //Not sure if both colours are correct :P just a guess.
            return 1;
        }
        if(ShowMessages[playerid] == 0)
        {
            ShowMessages[playerid] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "You have {FFFF00}Enabled{FFFFFF} the messages, Type /togglemessage again to toggle it."); //Not sure if both colours are correct :P just a guess.
            return 1;
        }
    }
    return 1;
}


And in every of your teleport commands, add the codes that is shown below.
pawn Код:
if(ShowMessages[playerid] == 1)
{
SendClientMessage(playerid, 0x........, "You have been teleported to ...");
}
There is no need to add (view codes below), because it there isnt any codes needed when ShowMessages is false (ShowMessages == 0).
pawn Код:
if(ShowMessages[playerid] == 0)
{
    //Add Pawno Codes
}

This seems very complecated but once you get it its very simple, but I hope this helps.

Regards,
Rolyy
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)