Anti DeathMatch (OnPlayerTakeDamage) -
[rG]Cold - 08.11.2014
pawn Код:
if(gTeam[issuerid] == TEAM_COP || gTeam[playerid] == TEAM_CIVIL && GetPlayerWantedLevel(playerid) <=4)
{
GetPlayerHealth(playerid, hp);
GetPlayerArmour(playerid, armour);
if(GetPlayerWeapon(issuerid)) SetPlayerHealth(playerid, hp-0); SetPlayerArmour(playerid, armour-0);
}
For those that didn't understand what i am trying to do here,the answer is simple: i am trying to stop cops from killing innocent players with a wanted level below 4.
This is working 90% but it actually makes the civilians lose their health,if you use a weapon that shoots bullets fast,such as M4,MP5,etc.
So can anyone help me fix this? Fix as there won't be any health loss?
Thanks in advance.
Respuesta: Anti DeathMatch (OnPlayerTakeDamage) -
EzeHermes - 08.11.2014
Try using SetPlayerTeam (
https://sampwiki.blast.hk/wiki/SetPlayerTeam).
Re: Anti DeathMatch (OnPlayerTakeDamage) -
[rG]Cold - 08.11.2014
I don't need to use SetPlayerTeam on this one.
Re: Anti DeathMatch (OnPlayerTakeDamage) -
Banana_Ghost - 09.11.2014
pawn Код:
if(gTeam[issuerid] == TEAM_COP || gTeam[playerid] == TEAM_CIVIL && GetPlayerWantedLevel(playerid) <=4)
{
new Float:hp, Float:armour;
GetPlayerHealth(playerid, hp);
GetPlayerArmour(playerid, armour);
SetPlayerHealth(playerid, hp-0);
SetPlayerArmour(playerid, armour-0);
}
try this and let me know if it works.
Re: Anti DeathMatch (OnPlayerTakeDamage) -
Quickie - 09.11.2014
pawn Код:
if(gTeam[issuerid] == TEAM_COP || gTeam[playerid] == TEAM_CIVIL && GetPlayerWantedLevel(playerid) <=4)
{
new Float:hp, Float:armour;
GetPlayerHealth(playerid, hp);
GetPlayerArmour(playerid, armour);
SetPlayerHealth(playerid, hp+amount);
SetPlayerArmour(playerid, armour+amount);
}
more bugs might come so show ur whole onplayertakedamage
Re: Anti DeathMatch (OnPlayerTakeDamage) -
Banana_Ghost - 09.11.2014
Quote:
Originally Posted by Quickie
pawn Код:
if(gTeam[issuerid] == TEAM_COP || gTeam[playerid] == TEAM_CIVIL && GetPlayerWantedLevel(playerid) <=4) { new Float:hp, Float:armour; GetPlayerHealth(playerid, hp); GetPlayerArmour(playerid, armour); SetPlayerHealth(playerid, hp+amount); SetPlayerArmour(playerid, armour+amount); }
more bugs might come so show ur whole onplayertakedamage
|
I forgot to add the amount lol. Thanks for that.
Re: Anti DeathMatch (OnPlayerTakeDamage) -
DavidBilla - 09.11.2014
Do this under OnPlayerWeaponShot
pawn Код:
if(hittype==BULLET_HIT_TYPE_PLAYER)
{
if(gTeam[playerid] == TEAM_COP || gTeam[hitid] == TEAM_CIVIL && GetPlayerWantedLevel(hitid) <=4) return 0;
}
Re: Anti DeathMatch (OnPlayerTakeDamage) -
Pottus - 09.11.2014
Quote:
Originally Posted by DavidBilla
Do this under OnPlayerWeaponShot
pawn Код:
if(hittype==BULLET_HIT_TYPE_PLAYER) { if(gTeam[playerid] == TEAM_COP || gTeam[hitid] == TEAM_CIVIL && GetPlayerWantedLevel(hitid) <=4) return 0; }
|
That won't work 100 percent of the time because a shot doesn't have to register a hit to be a hit on client.
Re: Anti DeathMatch (OnPlayerTakeDamage) -
dominik523 - 09.11.2014
EDIT: Nevermind. Didn't see the last post.
Re: Anti DeathMatch (OnPlayerTakeDamage) -
Sasino97 - 09.11.2014
Quote:
Originally Posted by Banana_Ghost
pawn Код:
if(gTeam[issuerid] == TEAM_COP || gTeam[playerid] == TEAM_CIVIL && GetPlayerWantedLevel(playerid) <=4) { new Float:hp, Float:armour; GetPlayerHealth(playerid, hp); GetPlayerArmour(playerid, armour); SetPlayerHealth(playerid, hp-0); SetPlayerArmour(playerid, armour-0); }
try this and let me know if it works.
|
Why
-0 o_O what sense does it make?