Anti-DM Help (CNR) - 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: Anti-DM Help (CNR) (
/showthread.php?tid=605622)
Anti-DM Help (CNR) -
humayunaftabkhan02 - 22.04.2016
Hello, I want some help for my new gamemode.
I'm creating 'Cops and Robbers'. The help which I need is that If there is a COP (TEAM_COP) and there is a CIVILLIAN(TEAM_CIVI), If the cops shoot the civillian they do no damage to him and If the civillian shoots the cop he also doesn't do any damage BUT if the civillian gets wanted He and the cop can damage each other.
I would be very thankful If I get some help, I did search but couldn't find anything and I did find some threads but couldn't understand it. I'm a newbie so would like someone to help me please.
Thankyou!!
Re: Anti-DM Help (CNR) -
Fairuz - 22.04.2016
PHP код:
if(Player[issuerid][playerClass] == CLASS_CIVILIAN || Player[issuerid][playerClass] == CLASS_FIREFIGHTER || Player[issuerid][playerClass] == CLASS_MEDIC)
{
if(Player[playerid][playerClass] == CLASS_ARMY || Player[playerid][playerClass] == CLASS_POLICE || Player[playerid][playerClass] == CLASS_CIA || Player[playerid][playerClass] == CLASS_FBI || Player[playerid][playerClass] == CLASS_SECRETSERVICE)
{
if(Player[issuerid][playerWantedLevel] == 0)
{
if(Player[playerid][playerJailTime] <= 0)
{
givePlayerWanted(issuerid, 6);
sendWantedMessage(issuerid, 6);
newPlayerColour(issuerid);
}
}
}
}
else if(Player[issuerid][playerClass] == CLASS_POLICE || Player[issuerid][playerClass] == CLASS_ARMY || Player[issuerid][playerClass] == CLASS_CIA || Player[issuerid][playerClass] == CLASS_FBI || Player[issuerid][playerClass] == CLASS_SECRETSERVICE)
{
if(Player[playerid][playerClass] == CLASS_CIVILIAN || Player[playerid][playerClass] == CLASS_FIREFIGHTER || Player[playerid][playerClass] == CLASS_MEDIC)
{
if (Player[playerid][playerWantedLevel] == 0)
{
new Float:theirHealth;
GetPlayerHealth(playerid, theirHealth);
SetPlayerHealth(playerid, theirHealth - 0);
}
}
}
Just an example,you should take a look at this
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage|
or
https://sampforum.blast.hk/showthread.php?tid=462189
Re: Anti-DM Help (CNR) -
humayunaftabkhan02 - 22.04.2016
Hi there, thank you so much. OnPlayerTakeDamage was what I needed. Thank you for your help!
I'll try it when I'm on my laptop.