SA-MP Forums Archive
Making an Anti DM system - 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: Making an Anti DM system (/showthread.php?tid=556090)



Making an Anti DM system - FunnyBear - 09.01.2015

Hey,

I'm currently scripting a CNR server and I was wondering how I can make an Anti DM system. I already have teams and stuff, but I want to restrict like Cops killing civillians (or any other team) only killing wanted players.

How am I able to do this?

Thanks


Re: Making an Anti DM system - ball - 09.01.2015

callback OnPlayerTakeDamage and function GetPlayerTeam or use scripted variables.


Re: Making an Anti DM system - FunnyBear - 09.01.2015

Quote:
Originally Posted by ball
Посмотреть сообщение
callback OnPlayerTakeDamage and function GetPlayerTeam or use scripted variables.
Could you please explain a little bit more?


Re: Making an Anti DM system - FunnyBear - 09.01.2015

Any help?


Re: Making an Anti DM system - bgedition - 09.01.2015

Use this https://sampforum.blast.hk/showthread.php?tid=195439


Re: Making an Anti DM system - FunnyBear - 09.01.2015

Quote:
Originally Posted by bgedition
Посмотреть сообщение
Can you make it just using the current SA:MP functions and not any includes?


Re: Making an Anti DM system - bgedition - 09.01.2015

May be use OnPlayerTakeDamage or OnPlayerTargetPlayer


Re: Making an Anti DM system - FunnyBear - 09.01.2015

Quote:
Originally Posted by bgedition
Посмотреть сообщение
May be use OnPlayerTakeDamage or OnPlayerTargetPlayer
I'm not sure if this is right, please correct me if I'm wrong. Would something like this work?

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(!IsALawEnforcement(issuerid) && gTeam[playerid] == TEAM_CIV )
    {
        return 0;
    }
    return 1;
}



Re: Making an Anti DM system - bgedition - 09.01.2015

I will you give example:

pawn Код:
public OnPlayerTargetPlayer(playerid) {
    new targetid = GetPlayerTargetPlayer(playerid);
    if(IsPolice(playerid)) {
        if(GetPlayerWantedLevel(targetid) == 0) {
            SendClientMessage(playerid, /*color*/, "[ATTENTION]: This player is not suspected. You can't kill it.");
        }
    }
    return 1;
}
I'm not shure for this but try it


Re: Making an Anti DM system - FunnyBear - 09.01.2015

Quote:
Originally Posted by bgedition
Посмотреть сообщение
I will you give example:

pawn Код:
public OnPlayerTargetPlayer(playerid) {
    new targetid = GetPlayerTargetPlayer(playerid);
    if(IsPolice(playerid)) {
        if(GetPlayerWantedLevel(targetid) == 0) {
            SendClientMessage(playerid, /*color*/, "[ATTENTION]: This player is not suspected. You can't kill it.");
        }
    }
    return 1;
}
If you replace the ATTENTION message with return 0, that would not allow the player to shoot the other player, right?