SA-MP Forums Archive
/OnDuty /OffDuty CMD Help - 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: /OnDuty /OffDuty CMD Help (/showthread.php?tid=532830)



/OnDuty /OffDuty CMD Help - Meow22 - 20.08.2014

pawn Код:
CMD:duty(playerid, params[])
{
    new string[128];
    color=GetPlayerColor(playerid);
    if(Player[playerid][pAdmin] >= 1)
    {
    if(sgod[playerid] == 1)
    {
    sgod[playerid]=1;
    format(string,sizeof(string), "{FF0000}[Info]{FFFF00}%s{FFFFFF} is now on Duty!",GetName(playerid));
    SendMessageToAdmins(COLOR_ORANGE,string);
    SetPlayerHealth(playerid, 1000000),GameTextForPlayer(playerid,"~r~ You are now On Duty",3000,5);
    Admin[ playerid ] = Create3DTextLabel("DONT TOUCH ON ADMIN DUTY.",-1,30.0,40.0,50.0,40.0,0);
    SetPlayerColor(playerid, COLOR_ORANGE);
    GivePlayerWeapon(playerid,38,10000);
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_KRED, "[Info]{FFFFFF}You need{FFFF00} level 1 admin{FFFFFF} to use this Command!");
    }
    return 1;
}

CMD:offduty(playerid, params[])
{
if(Player[playerid][pAdmin] >= 1)
    {
new string[128];
if (sgod[playerid] == 0)
    {
    sgod[playerid]=0;
    SetPlayerColor(playerid,color);
    Delete3DTextLabel( Admin[ playerid ] );
    if(GetPlayerWeapon(playerid) == 38) ResetPlayerWeapons(playerid);
    SetPlayerHealth(playerid, 100),GameTextForPlayer(playerid,"~r~ you are now off the duty",3000,5);
    format(string,sizeof(string),"{FF0000}[Info]{FFFF00} %s{FFFFFF} is now off Duty!",GetName(playerid));
    SendMessageToAdmins(COLOR_GREEN,string);
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_KRED, "[Info]{FFFFFF}You need{FFFF00} level 1 admin{FFFFFF} to use this Command!");
    }
return 0;
}
/Duty => He Can't Kill his own Team mates...
/OffDuty =>Does not goes off does not remove weapons and does not change player color....

Please Help


Re: /OnDuty /OffDuty CMD Help - SnG.Scot_MisCuDI - 20.08.2014

to remove the weapon you gave him on duty use:
pawn Код:
SetPlayerAmmo(playerid, 38, 0);
instead of
pawn Код:
if(GetPlayerWeapon(playerid) == 38) ResetPlayerWeapons(playerid); //thats only if the player is HOLDING weapon id 38



Re: /OnDuty /OffDuty CMD Help - AroseKhanNiazi - 21.08.2014

pawn Код:
new dutycolor[MAX_PLAYERS];
CMD:duty(playerid)
{
    new string[128];
    if(Player[playerid][pAdmin] >= 1)
    {
        if(sgod[playerid] == 1)
        {
            sgod[playerid]=1;
            format(string,sizeof(string), "{FF0000}[Info]{FFFF00}%s{FFFFFF} is now on Duty!",GetName(playerid));
            SendMessageToAdmins(COLOR_ORANGE,string);
            SetPlayerHealth(playerid, 1000000),GameTextForPlayer(playerid,"~r~ You are now On Duty",3000,5);
            Admin[ playerid ] = Create3DTextLabel("DONT TOUCH ON ADMIN DUTY.",-1,30.0,40.0,50.0,40.0,0);
            SetPlayerColor(playerid, COLOR_ORANGE);
            GivePlayerWeapon(playerid,38,10000);
            dutycolor=GetPlayerColor(playerid);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_KRED, "[Info]{FFFFFF}You need{FFFF00} level 1 admin{FFFFFF} to use this Command!");
    }
    return 1;
}

CMD:offduty(playerid)
{
    if(Player[playerid][pAdmin] >= 1)
    {
        new string[128];
        if (sgod[playerid] == 0)
        {
            sgod[playerid]=0;
            SetPlayerColor(playerid,dutycolor);
            Delete3DTextLabel( Admin[ playerid ] );
            GivePlayerWeapon(playerid,38,0);
            SetPlayerHealth(playerid, 100),GameTextForPlayer(playerid,"~r~ you are now off the duty",3000,5);
            format(string,sizeof(string),"{FF0000}[Info]{FFFF00} %s{FFFFFF} is now off Duty!",GetName(playerid));
            SendMessageToAdmins(COLOR_GREEN,string);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_KRED, "[Info]{FFFFFF}You need{FFFF00} level 1 admin{FFFFFF} to use this Command!");
    }
    return 1;
}