SA-MP Forums Archive
Help +REP - 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: Help +REP (/showthread.php?tid=347375)



Help +REP - Nirzor - 01.06.2012

How will i make an admin command like /onduty /offduty so admins can be on and off duty


Re: Help +REP - Menaz - 01.06.2012

which admin system you are using ?


Re: Help +REP - ViniBorn - 01.06.2012

pawn Код:
new bool:Duty[MAX_PLAYERS];

//OnPlayerConnect
Duty[playerid] = false;



//   Command  /duty
if(Duty[playerid])
    Duty[playerid] = false;
else
    Duty[playerid] = true;



Re: Help +REP - Sandiel - 01.06.2012

Place this in the OnPlayerConnect callback
Код:
if(PlayerInfo[playerid][pAdmin] >= 1)
{
      PlayerInfo[playerid][pAdminDuty] = 0;
}
Command using ZCMD
Код:
CMD:aduty(playerid, params[])
{
	new pName[MAX_PLAYER_NAME];
	new string[128];
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    if(PlayerInfo[playerid][pAdminDuty] == 1)
	    {
	        PlayerInfo[playerid][pAdminDuty] = 1;
	        SetPVarInt(playerid, "LastSkin", GetPlayerSkin(playerid));
	        SetPlayerSkin(playerid, 294);
	        SetPlayerColor(playerid, COLOR_LIGHTBLUE);
			GetPlayerName(playerid, pName, sizeof(pName));
			format(string, sizeof(string), "** Administrator %s is now on admin duty. **", pName);
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
			    if(PlayerInfo[i][pAdmin] >= 1)
			    {
			        SendClientMessage(i, COLOR_YELLOW, string);
			    }
			}
	    }
	    else if(PlayerInfo[playerid][pAdminDuty] == 0)
	    {
	        PlayerInfo[playerid][pAdminDuty] = 0;
            SetPlayerSkin(playerid, GetPVarInt(playerid, "LastSkin"));
	        SetPlayerColor(playerid, COLOR_WHITE);
	        GetPlayerName(playerid, pName, sizeof(pName));
			format(string, sizeof(string), "** Administrator %s is now off admin duty. **", pName);
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
			    if(PlayerInfo[i][pAdmin] >= 1)
			    {
			        SendClientMessage(i, COLOR_YELLOW, string);
			    }
			}
	    }
	}
	else return SendClientMessage(playerid, COLOR_GREY, ".:: You are not authorized to use this feature ::.");
	return 1;
}
Glad to help.


Re: Help +REP - Nirzor - 01.06.2012

Thank you