SA-MP Forums Archive
Aduty god mode - 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: Aduty god mode (/showthread.php?tid=600343)



Aduty god mode - CSLangdale - 06.02.2016

Hi what it is i have this /aduty in my script
if(strcmp(cmd, "/aduty", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(AdminDuty[playerid] == 0)
{
AdminDuty[playerid] = 1;
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "Server Administrator %s[%d] is now on Admin duty!", GetPlayerNameEx(playerid), playerid);
SendClientMessageToAll(COLOR_CORAL, string);
SetPlayerColor(playerid, COLOR_RED);
td[playerid] = Create3DTextLabel("[Admin Duty]",0x009999FF,0.0,0.0,0.0,40.0,1);
Attach3DTextLabelToPlayer(td[playerid],playerid, 0.0, 0.0,-0.9);
return 1;
}
but was wondering how can i make it so when on duty admin has god mode on?


Re: Aduty god mode - Sascha - 06.02.2016

first of all put your code into the code tags
[ c o d e ] your code [ / c o d e ]
or [ p h p ] code [ / p h p]
without the spaces obviously


Re: Aduty god mode - Mencent - 06.02.2016

PHP код:
SetPlayerHealth(playerid,999999.0); 
And when he is going out of admin duty:
PHP код:
SetPlayerHealth(playerid,100.0); 



Re: Aduty god mode - CSLangdale - 06.02.2016

Thanks


Re: Aduty god mode - JohnBlaze1971 - 07.02.2016

Something better that can be done is
Код:
enum pAdminGM
{
	pAdminGodmode
};
new pAdmin[playerid][pAdminGM];
if(strcmp(cmd, "/aduty", true) == 0)
{
	new string[128];
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		format(string, sizeof(string), "Server Administrator %s[%d] is now on Admin duty!", GetPlayerNameEx(playerid), playerid);
		SendClientMessageToAll(COLOR_CORAL, string);
		SetPlayerColor(playerid, COLOR_RED);
		td[playerid] = Create3DTextLabel("[Admin Duty]",0x009999FF,0.0,0.0,0.0,40.0,1);
		Attach3DTextLabelToPlayer(td[playerid],playerid, 0.0, 0.0,-0.9);
		SetPlayerHealth(playerid,1000000);
		pAdmin[playerid][pAdminGodmode] = 1;
	}
	else if(pAdmin[playerid][pAdminGodmode] == 1)
	{
		new str[128];
		format(str,sizeof(str),"Server Administrator %s[%d] is now off Admin duty!",GetPlayernameEx(playerid),playerid);
		SetPlayerHealth(playerid,100);
		Delete3TextLabel(td);
		pAdmin[playerid][pAdminGodmode] = 0;
	}
	return 1;
}