SA-MP Forums Archive
Little bug - 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: Little bug (/showthread.php?tid=580217)



Little bug - ZachKnoxx - 03.07.2015

For some reason when I type /duty in-game while in a faction(SAFMD), it displays me going on-duty for LSPD too. I can't figure this out.



Код HTML:
CMD:duty(playerid, params[])
{
		new szMessage[256];
		if(FactionCheck(playerid, 1))
		{
			if(!coponduty[playerid])
			{
	        	SetPlayerColor(playerid, COLOR_LSPD);
		        coponduty[playerid] = 1;
		        dutyforcop[playerid] = 1;
				format(szMessage, sizeof(szMessage), "[COP] %s %s has gone on duty.", GetLSPDRank(playerid), GetPlayerNameEx(playerid));
				SendLSPDMessage(COLOR_LSPD, 1, szMessage);
			}
			else
			{
	        	SetPlayerColor(playerid, TRANSPARENT_WHITE);
				ResetPlayerWeapons(playerid);
		        dutyforcop[playerid] = 0;
		        coponduty[playerid] = 0;
				format(szMessage, sizeof(szMessage), "[COP] %s %s has gone off duty", GetLSPDRank(playerid), GetPlayerNameEx(playerid));
				SendSAFMDMessage(COLOR_LSPD, 1, szMessage);
			}
		}
		//----FMD
		if(FactionCheck(playerid, 2))
		{
			if(!firemanonduty[playerid])
			{
	        	SetPlayerColor(playerid, COLOR_SAFMD);
		        firemanonduty[playerid] = 1;
		        dutyforfireman[playerid] = 1;
		        GivePlayerWeapon(playerid,6,1);
		        GivePlayerWeapon(playerid,42,1000);
				format(szMessage, sizeof(szMessage), "[MEDIC] %s %s has gone on duty.", GetSAFMDRank(playerid), GetPlayerNameEx(playerid));
				SendSAFMDMessage(COLOR_SAFMD, 1, szMessage);
			}
			else
			{
	        	SetPlayerColor(playerid, TRANSPARENT_WHITE);
				ResetPlayerWeapons(playerid);
		        dutyforfireman[playerid] = 0;
		        firemanonduty[playerid] = 0;
				format(szMessage, sizeof(szMessage), "[MEDIC] %s %s has gone off duty", GetSAFMDRank(playerid), GetPlayerNameEx(playerid));
				SendSAFMDMessage(COLOR_SAFMD, 1, szMessage);
			}
		}
        return 1;
}



Re: Little bug - FilesMAker - 03.07.2015

Can you explain more your bug ?
Thanks


Re: Little bug - ZachKnoxx - 03.07.2015

Quote:
Originally Posted by FilesMAker
Посмотреть сообщение
Can you explain more your bug ?
Thanks
Okay. When I am in the Medic faction and type /duty, it displays a message saying I have gone off duty in LSPD, even though I am not in that faction.


Re: Little bug - Crystallize - 03.07.2015

GetLSPDRank? Why are you getting the data from the LSPD then? Remove it


Re: Little bug - Evocator - 03.07.2015

else if(FactionCheck(playerid, 2))
or
return 1
or recheck your "FactionCheck(playerid, 2)". It seems always returning true.