SA-MP Forums Archive
/aduty cmd - 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: /aduty cmd (/showthread.php?tid=369518)



/aduty cmd - NinjaChicken - 17.08.2012

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


Re: /aduty cmd - ToiletDuck - 17.08.2012

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


Re: /aduty cmd - kbalor - 17.08.2012

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



Re: /aduty cmd - RenSoprano - 17.08.2012

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



Re: /aduty cmd - sanplayer - 17.08.2012

added on skype


Re: /aduty cmd - Supercop - 17.08.2012

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


Re: /aduty cmd - sanplayer - 17.08.2012

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



Re: /aduty cmd - Scott Zulkifli - 17.08.2012

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?


Re: /aduty cmd - sanplayer - 17.08.2012

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.