SA-MP Forums Archive
[URGENT] Help with aduty - 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: [URGENT] Help with aduty (/showthread.php?tid=613305)



[URGENT] Help with aduty - StrikerZ - 26.07.2016

My problem is that when i use /aduty then log off and forgot to be off duty and when i again join server and try to /aduty again it says that Administrator is now off duty. I mean to say that isn't there anything to do that if a On duty admin disconnects and he automatically goes offduty? Cuz when i log in and write /aduty to be off duty i get skin bug at that time.Any ideas?


Re: [URGENT] Help with aduty - Usama651 - 26.07.2016

I Think check on ONPLAYERDISCONNECT ....


More Help contact in scripting contact me on ********.com/usamakhalid666


Re: [URGENT] Help with aduty - WhiteGhost - 26.07.2016

Show the /aduty code:


Re: [URGENT] Help with aduty - StrikerZ - 27.07.2016

here it is
Код:
CMD:aduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    if(PlayerInfo[playerid][pAdminDuty] == 0)
	    {
			new playername[MAX_PLAYER_NAME];
			GetPlayerName(playerid, playername, sizeof(playername));
			new string[120];
			if(PlayerInfo[playerid][pAdminNameSet] == 0)
 			{
				return SendClientMessage(playerid, -1, "You must set your admin name before going on duty.( /aname )");
   			}
			// SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
			SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
			format(string, sizeof(string), "** Administrator %s is now on admin duty. (/report for assistance) **", GetPlayerNameEx(playerid));
			SendClientMessageToAllEx(COLOR_YELLOW, string);
			PlayerInfo[playerid][pAdminNameSet] = 1;
			PlayerInfo[playerid][pAdminDuty] = 1;
			SetPVarInt(playerid, "LastSkin", GetPlayerSkin(playerid));
			SetPlayerSkin(playerid, 294);
			SetPlayerHealth(playerid, 100000);
			SetPlayerArmour(playerid, 100000);
			

			format(string, sizeof(string), "users/%s.ini", playername);
			fremove(string);
			OnPlayerStatsUpdate(playerid);
			return 1;
		}
		else if(PlayerInfo[playerid][pAdminDuty] == 1)
	    {
			new playername[MAX_PLAYER_NAME];
			GetPlayerName(playerid, playername, sizeof(playername));
			new string[120];
			if(PlayerInfo[playerid][pNormalNameSet] == 0)
 			{
				return SendClientMessage(playerid, -1, "You must set your player name before going off duty.( /playername )");
   			}
			format(string, sizeof(string), "** Administrator %s is now off admin duty. **", GetPlayerNameEx(playerid));
			SendClientMessageToAllEx(COLOR_YELLOW, string);
			PlayerInfo[playerid][pNormalNameSet] = 1;
			PlayerInfo[playerid][pAdminDuty] = 0;
			SetPlayerSkin(playerid, GetPVarInt(playerid, "LastSkin"));
			SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid, 100);

			format(string, sizeof(string), "users/%s.ini", playername);
			fremove(string);
			SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
			OnPlayerStatsUpdate(playerid);

			return 1;
		}
	}
	return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
}



Re: [URGENT] Help with aduty - Devon007 - 27.07.2016

Under OnplayerConnect

Код:
PlayerInfo[playerid][pAdminDuty] = 0;



Re: [URGENT] Help with aduty - StrikerZ - 27.07.2016

Not working


Re: [URGENT] Help with aduty - BoBiTza - 27.07.2016

maybe you get adminduty from db and not update db when exit


Re: [URGENT] Help with aduty - StrikerZ - 27.07.2016

So any fix?


Re: [URGENT] Help with aduty - StrikerZ - 28.07.2016

any fix?