SA-MP Forums Archive
How can I detect if the player is shooting an admin onduty? - 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: How can I detect if the player is shooting an admin onduty? (/showthread.php?tid=442858)



How can I detect if the player is shooting an admin onduty? - Don_Cage - 09.06.2013

Well like the title say. I want to make it so if a player shoots an admin that is ON duty he will get slapped in the air and get a gametext where it say for example "Don't shoot admin on duty!" i know how to make the slap etc but I don't know how I can detect if the player is shooting an admin?


Re: How can I detect if the player is shooting an admin onduty? - Sascha - 09.06.2013

Код:
public OnPlayerGiveDamage(playerid, damageid, Float:amount, weaponid)
{
	if(PlayerInfo[damageid][Level] >= 1 && PlayerInfo[damageid][OnDuty] == 1)
	{
	    Your code
	}
	return 1;
}
you need to repalce the "PlayerInfo[damageid][Level]" and the "PlayerInfo[damageid][OnDuty]" with your variables that define the player's level and the on-duty-status


Re: How can I detect if the player is shooting an admin onduty? - Don_Cage - 09.06.2013

Only like that? Should have thougt about that. haha! Well thank you for the fast response! +REP for you.


Re: How can I detect if the player is shooting an admin onduty? - Black Wolf - 09.06.2013

You can try OPSP include too.


Re: How can I detect if the player is shooting an admin onduty? - Don_Cage - 09.06.2013

Quote:
Originally Posted by Black Wolf
Посмотреть сообщение
You can try OPSP include too.
Allready used the other way but please send me a link to that include so I can check it out.


Re: How can I detect if the player is shooting an admin onduty? - Sinner - 09.06.2013

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
Allready used the other way but please send me a link to that include so I can check it out.
OnPlayerTakeDamage is natively supported now, you're better off using the callback provided rather then an include (the include will be slower and less accurate).

https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage