dude listen when i hit My team mates i can't kill them but when i headshot them they dies without sending a death message like it won't show adrien killed luis and reason it will show adrien is dead reason without killer so team script works but headshot script has bugs
Posts: 137
Threads: 23
Joined: Jul 2014
Reputation:
0
I made a condition there... OnPlayerTakeDamage (maybe) works even on teammates. So you have to use that condition to avoid that.
(btw... If I understand correctly, you want to stop that team-killing, yea?)
#sorryForMyEnglish,It'sBest.
Posts: 122
Threads: 25
Joined: Aug 2016
Reputation:
0
Players in the same team shouldn't take damage if they shoot each other with the usage of SetPlayerTeam. Check your script and try again, maybe you have used gTeam[playerid] instead of SetPlayerTeam.
i use SetPlayerTeam not gteam :v
Posts: 1,506
Threads: 13
Joined: Jun 2015
30.11.2016, 08:15
(
Последний раз редактировалось Logic_; 30.11.2016 в 11:40.
)
PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID) // issuerid/ the one who uses the weapon isn't invalid.
{
if(GetPlayerTeam(playerid) != GetPlayerTeam(issuerid)) // checking teams are not same
{
if(weaponid == 34 && bodypart == 9) // checking the weapon and body part
{
new str[90];
format(str, sizeof(str), "%s has headshotted %s", pName(issuerid), pName(playerid));
SendClientMessageToAll(0x5BC178FF, str);
SetPlayerHealth(playerid, 0.0); // We will always use float integer because health is in float!
}
}
}
return 1;
}
pName(playerid)
{
new nameZ[MAX_PLAYER_NAME + 1];
GetPlayerName(playerid, nameZ, sizeof(nameZ));
return nameZ;
}
Should be like this.
Posts: 1,506
Threads: 13
Joined: Jun 2015
Quote:
Originally Posted by TheRohlikar
Isn't that same ? I mean.. is there a difference between his code and yours ?
|
Oops, didn't look at the whole code.
Quote:
Originally Posted by adrianlouise
first things yes it's the same team -_-
when i put this
// CODE HERE //
i get this error
Код:
577) : error 025: function heading differs from prototype
Line 577 is the first line (onplayertakedamage)
|
Are you using YSI?