Admin Duty - +REP
#1

Hello,

I have an admin duty script, but if someone is on admin duty I want the textdraws visible only for the admins on admin duty.

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);
        SetPlayerColor(playerid, 0xFF9900FF);
        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);
		SetPlayerColor(playerid, 0xFFFFFFFF);
		ResetPlayerWeapons(playerid);
	    ResetDodWeapons(playerid);
	    SendClientMessage(playerid, COLOR_PURPLE, "You are now offduty as Admin, an admin duty tag has been disabled.");
	}
	return 1;
}

Textdraws must be visible if an admin is onduty.
Код:
//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);
TextDrawSetSelectable(Textdraw2, true);
Reply
#2

When go go on duty, use
pawn Код:
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
and when you go off duty, use
pawn Код:
TextDrawHideForPlayer(playerid,Textdraw0);
TextDrawHideForPlayer(playerid,Textdraw1);
TextDrawHideForPlayer(playerid,Textdraw2);
Reply
#3

Or create a public stock for just a player who uses the command or feature?

stock CreateTextdrawForPlayer(playerid)
{
Textdraw0[playerid] =
}
Reply
#4

Quote:
Originally Posted by Ciandlah
Посмотреть сообщение
Or create a public stock for just a player who uses the command or feature?

stock CreateTextdrawForPlayer(playerid)
{
Textdraw0[playerid] =
}
That would be CreatePlayerTextDraw
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)