SA-MP Forums Archive
Admin Duty - 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: Admin Duty (/showthread.php?tid=434036)



Admin Duty - Aarab - 30.04.2013

Hello,

I wanted if someone is on adminduty the textdraws will switch visible is that possible? And if they head offduty the textdraws will be automaticly removed.

Admin duty script:
Код:
CMD:aod(playerid, params[])
{
	new string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(!aDuty[playerid])
	{
        format(string, sizeof(string), "AdmWarn: %s has went on admin duty.", RPN(playerid));
		SendAdminMessage(COLOR_DARKRED, 1, string);
		aDuty[playerid] = 1;
	    format(string, sizeof(string), "ADMIN OUT OF CHARACTER", RPALN(playerid));
		if(IsValidDynamic3DTextLabel(aDutyText[playerid]))  DestroyDynamic3DTextLabel(aDutyText[playerid]);
		if(PlayerInfo[playerid][pAdmin] > 1) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, 0, 0, -20, 25, playerid);
        Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, aDutyText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.25);
        PlayerInfo[playerid][pModel] = GetPlayerSkin(playerid);
        GiveDodWeapon(playerid, 38, 11999);
        SetPlayerSkin(playerid, 294);
        SendClientMessage(playerid, COLOR_PURPLE, "You are now on Admin Duty, an admin duty TAG has been enabled.");
  	}
	else
	{
	    if(Spec[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't go off admin duty while spectating someone.");
		aDuty[playerid] = 0;
	    format(string, sizeof(string), "AdmWarn: %s has went off admin duty.", RPN(playerid));
	    SendAdminMessage(COLOR_DARKRED, 1, string);
		DestroyDynamic3DTextLabel(aDutyText[playerid]);
		new oldskinsss;
		oldskinsss = PlayerInfo[playerid][pModel];
		SetPlayerSkin(playerid, oldskinsss);
		ResetPlayerWeapons(playerid);
	    ResetDodWeapons(playerid);
	}
	return 1;
}
Textdraws:
Код:
//Global Textdraws:

new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;


Textdraw0 = TextDrawCreate(24.375000, 272.416900, "Admin Duty");
TextDrawLetterSize(Textdraw0, 0.662499, 3.787499);
TextDrawAlignment(Textdraw0, 1);
TextDrawColor(Textdraw0, -2147450625);
TextDrawSetShadow(Textdraw0, 1);
TextDrawSetOutline(Textdraw0, 0);
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 2);
TextDrawSetProportional(Textdraw0, 1);

Textdraw1 = TextDrawCreate(207.625000, 270.416656, "usebox");
TextDrawLetterSize(Textdraw1, 0.000000, 6.229631);
TextDrawTextSize(Textdraw1, 13.000000, 0.000000);
TextDrawAlignment(Textdraw1, 1);
TextDrawColor(Textdraw1, 0);
TextDrawUseBox(Textdraw1, true);
TextDrawBoxColor(Textdraw1, 102);
TextDrawSetShadow(Textdraw1, 0);
TextDrawSetOutline(Textdraw1, 0);
TextDrawFont(Textdraw1, 0);

Textdraw2 = TextDrawCreate(48.125000, 254.333419, "Yourlife Roleplay");
TextDrawLetterSize(Textdraw2, 0.449999, 1.600000);
TextDrawAlignment(Textdraw2, 1);
TextDrawColor(Textdraw2, -1);
TextDrawSetShadow(Textdraw2, 0);
TextDrawSetOutline(Textdraw2, 1);
TextDrawBackgroundColor(Textdraw2, 51);
TextDrawFont(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);


//Player Textdraws:

new PlayerText:Textdraw0[MAX_PLAYERS];


Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 22.500000, 303.333374, "You have an OOC tag!");
PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.449999, 1.600000);
PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw0[playerid], -5963521);
PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51);
PlayerTextDrawFont(playerid, Textdraw0[playerid], 1);
PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);