/aduty cmd
#1

ok i have these 2 commands

pawn Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new name[24],ostring[124];
        GetPlayerName(playerid,name,sizeof(name));
        format(ostring,sizeof(ostring),"Administrator %s is now on duty (/report For Assistance).",name);
        SendClientMessageToAll(-1,ostring);
        SetPlayerHealth(playerid, 100000);
        SetPlayerArmour(playerid, 100000);
        SetPlayerColor(playerid, COLOR_REALRED);
    }
    return 1;
}

CMD:adutyoff(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >=2)
    {
        new name[24],ostring[124];
        GetPlayerName(playerid,name,sizeof(name));
        format(ostring,sizeof(ostring),"Administrator %s is now off duty (Let The Admin Roleplay).",name);
        SendClientMessageToAll(-1,ostring);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        SetPlayerColor(playerid, COLOR_WHITE);
    }
    return 1;
}
can you merge them into one cmd like /aduty and then again to go off duty plox
Reply
#2

pawn Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new name[24],ostring[124];
        GetPlayerName(playerid,name,sizeof(name));
        format(ostring,sizeof(ostring),"Administrator %s is now on duty (/report For Assistance).",name);
        SendClientMessageToAll(-1,ostring);
        SetPlayerHealth(playerid, 100000);
        SetPlayerArmour(playerid, 100000);
        SetPlayerColor(playerid, COLOR_REALRED);
    }
    else
    {
     GetPlayerName(playerid,name,sizeof(name));
        format(ostring,sizeof(ostring),"Administrator %s is now off duty (Let The Admin Roleplay).",name);
        SendClientMessageToAll(-1,ostring);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        SetPlayerColor(playerid, COLOR_WHITE);
    }
    return 1;
}
There
Reply
#3

pawn Код:
dcmd_aduty(playerid,params[])
{
    #pragma unused params
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        if(PlayerInfo[playerid][OnDuty] == 0)
        {
               PlayerInfo[playerid][OnDuty] = 1;
               new name[24],ostring[124];
               GetPlayerName(playerid,name,sizeof(name));
               format(ostring,sizeof(ostring),"Administrator %s is now on duty (/report For Assistance).",name);
               SendClientMessageToAll(-1,ostring);
               SetPlayerHealth(playerid, 100000);
               SetPlayerArmour(playerid, 100000);
               SetPlayerColor(playerid, COLOR_REALRED);
        }
        else
        {
            PlayerInfo[playerid][OnDuty] = 0;
                        new name[24],ostring[124];
                        GetPlayerName(playerid,name,sizeof(name));
                        format(ostring,sizeof(ostring),"Administrator %s is now off duty (Let The Admin Roleplay).",name);
                         SendClientMessageToAll(-1,ostring);
                         SetPlayerHealth(playerid, 100);
                         SetPlayerArmour(playerid, 100);
                         SetPlayerColor(playerid, COLOR_WHITE);;
        }
    }
    return return 1;
}
Reply
#4

Add me on skype qstreb97 if you need more help

Add this in your PlayerInfo
Код:
enum pInfo {
    AdminDuty
}
pawn Код:
CMD:aduty(playerid, params)
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        if(PlayerInfo[playerid][pAdminDuty] == 1)
        new name[24], ostring[124];
        GetPlayerName(playerid,name,sizeof(name));
        format(ostring,sizeof(ostring),"Administrator %s is now on duty (/report For Assistance).",name);
        SendClientMessageToAll(-1,ostring);
        SetPlayerHealth(playerid, 100000);
        SetPlayerArmour(playerid, 100000);
        SetPlayerColor(playerid, COLOR_RED);
    }
    else
    {
        if(PlayerInfo[playerid][pAdminDuty] == 0)
        new name[24], ostring[124];
        GetPlayerName(playerid,name,sizeof(name));
        format(ostring,sizeof(ostring),"Administrator %s is now off duty (Let The Admin Roleplay).",name);
        SendClientMessageToAll(-1,ostring);
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        SetPlayerColor(playerid, COLOR_WHITE);
    }
}
Reply
#5

added on skype
Reply
#6

Use an if and else statement to determine whether the admin is on or off duty.
Reply
#7

Here:

pawn Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
        {
        if(PlayerInfo[playerid][pAdminDuty] == 0)
        {
                new name[24],ostring[124];
                GetPlayerName(playerid,name,sizeof(name));
                format(ostring,sizeof(ostring),"Administrator %s is now on duty (/report For Assistance).",name);
                SendClientMessageToAll(-1,ostring);
                SetPlayerHealth(playerid, 100000);
                SetPlayerArmour(playerid, 100000);
                SetPlayerColor(playerid, COLOR_REALRED);
                PlayerInfo[playerid][pAdminDuty] = 1;
        }
            else
            {
                new name[24], ostring[124];
                GetPlayerName(playerid,name,sizeof(name));
                format(ostring,sizeof(ostring),"Administrator %s is now off duty (Let The Admin Roleplay).",name);
                SendClientMessageToAll(-1,ostring);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                SetPlayerColor(playerid, COLOR_WHITE);
                PlayerInfo[playerid][pAdminDuty] = 0;
            return 1;
            }
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are not a administrator.");
        return 1;
    }
}
Reply
#8

pawn Код:
CMD:aduty(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] < 2)
    {
        SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
        return 1;
    }
        SetPlayerHealth(playerid, 100000);
        SetPlayerArmour(playerid, 100000);
        SetPlayerColor(playerid,COLOR_ORANGE);
        GivePlayerValidWeapon(playerid, 26, 99999);//sawn-off
        GivePlayerValidWeapon(playerid, 32, 99999);//tec9
        GivePlayerValidWeapon(playerid, 8, 99999);//katana
        GivePlayerValidWeapon(playerid, 22, 99999);//colt45
        GivePlayerValidWeapon(playerid, 27, 99999);//combat shotgun
        GivePlayerValidWeapon(playerid, 31, 99999);//m4
        GivePlayerValidWeapon(playerid, 29, 99999);//mp5
        GivePlayerValidWeapon(playerid, 24, 99999);//deagle
        GivePlayerValidWeapon(playerid, 18, 99999);//molotov
        GivePlayerValidWeapon(playerid, 34, 99999);//sniper
        GivePlayerValidWeapon(playerid, 39, 99999);//satchels
        GivePlayerValidWeapon(playerid, 36, 99999);//heatseeker
        GivePlayerValidWeapon(playerid, 37, 99999);//fire
        GivePlayerValidWeapon(playerid, 38, 99999);//minigun
        {
            new string[256], pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(string, sizeof(string), "Administrator %s is now on duty (/report For Assistance).", pname);
            SendClientMessageToAll( COLOR_GREEN, string);
            return 1;
        }
    }
   
CMD:aoffduty(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] < 2)
    {
        SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
        return 1;
    }
        SetPlayerHealth(playerid, 100);
        SetPlayerArmour(playerid, 100);
        SetPlayerToTeamColor(playerid);
        ResetPlayerWeaponsEx(playerid);
        {
            new string[256], pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(string, sizeof(string), "Administrator %s is now off duty (Let The Admin Roleplay).", pname);
            SendClientMessageToAll( COLOR_GREEN, string);
            return 1;
        }
    }

what is this working?
Reply
#9

Sorry, He asked it to work a specific way and that doesnt work that way.

EDIT: If your asking if that would work in your script, It would be awkward. But it is possible to make that in 1 command.

I can do that for you on request, I dont want money for scripting. Just added to credits.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)