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



Admin On Duty help!!! - ironmen - 21.06.2015

I have made this /aduty command that sets admin duty on/off (With label says admin on duty)
The Problem is with the label
it shows but when i turn aduty off it never destroy please help

Код:
CMD:aduty(playerid, paramas[])
{
    new Text3D:label = Create3DTextLabel("Admin On Duty", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
    if(adutys[playerid] == 1)
    {
		if(pInfo[playerid][Admin] >= 1)
		{
	    	SetPlayerColor(playerid, 0xAA3333AA); // Yellow colour hex
	    	SetPlayerHealth(playerid, 9999999);
	    	SetPlayerArmour(playerid, 9999999);
	    	adutys[playerid] = 0;
	    	Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
		}
		else
		SendClientMessage(playerid, 0xAA3333AA, "You must be admin to access this command!");
	}
	else
	if(adutys[playerid] == 0)
	{
			if(pInfo[playerid][Admin] >= 1)
		{
			SetPlayerColor(playerid, 0xFFFFFFAA);
	    	SetPlayerHealth(playerid, 100);
	    	SetPlayerArmour(playerid, 0);
	    	DeletePlayer3DTextLabel(playerid, label);
	    	adutys[playerid] = 1;
		}
	    else
	    SendClientMessage(playerid, 0xAA3333AA, "You must be admin to access this command!");
	}
	return 1;
}
Thanks!


Re: Admin On Duty help!!! - Dusan01 - 21.06.2015

add on top of script this:
Код:
 new Text3D:labela[MAX_PLAYERS];
and replace command with this:
Код:
CMD:aduty(playerid, paramas[])
{
    if(adutys[playerid] == 1)
    {
		if(pInfo[playerid][Admin] >= 1)
		{
	    	SetPlayerColor(playerid, 0xAA3333AA); // Yellow colour hex
	    	SetPlayerHealth(playerid, 9999999);
	    	SetPlayerArmour(playerid, 9999999);
	    	adutys[playerid] = 0;
			labela[playerid] = Create3DTextLabel("Admin On Duty", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
	    	Attach3DTextLabelToPlayer(labela[playerid], playerid, 0.0, 0.0, 0.7);
		}
		else
		SendClientMessage(playerid, 0xAA3333AA, "You must be admin to access this command!");
	}
	else
	if(adutys[playerid] == 0)
	{
			if(pInfo[playerid][Admin] >= 1)
		{
			SetPlayerColor(playerid, 0xFFFFFFAA);
	    	SetPlayerHealth(playerid, 100);
	    	SetPlayerArmour(playerid, 0);
Delete3DTextLabel(labela[playerid]);
	    	adutys[playerid] = 1;
		}
	    else
	    SendClientMessage(playerid, 0xAA3333AA, "You must be admin to access this command!");
	}
	return 1;
}



Re: Admin On Duty help!!! - ironmen - 21.06.2015

Thanks it worked!!
+rep