SetPlayerTeam - Team Damage Enabled -
SuperViper - 02.04.2013
Includes: BlueG R7 MySQL, Sscanf, Foreach, ZCMD
Plugins: BlueG R7 MySQL, Sscanf, Whirlpool
The issue: Team members can damage each other
Video: [ame]http://youtube.com/watch?v=Q5e4dqvzOAs&feature=*******[/ame]
I'm using
AddPlayerClassEx to set the player's team:
pawn Код:
for(new teamIndex; teamIndex < 2; teamIndex++)
{
for(new skinIndex; skinIndex < SKIN_AMOUNT; skinIndex++)
{
teamClasses[teamIndex][skinIndex] = AddPlayerClassEx(teamIndex, teamSkins[teamIndex][skinIndex], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
}
This is my command to see the teams as you can see in the video:
pawn Код:
COMMAND:teams(playerid, params[])
{
new clientMessage[128];
format(clientMessage, sizeof(clientMessage), "[TEAMS] Player 0: %d, Player 1: %d", GetPlayerTeam(0), GetPlayerTeam(1));
SendClientMessageToAll(-1, clientMessage);
return 1;
}
This returns the proper values.
As you can see in the first part of the video where we're on different teams, we take damage normally. In the second part where we're both blue, we still take damage from shooting each other even though we're on the same team, confirmed by
/teams.
Respuesta: SetPlayerTeam - Team Damage Enabled -
Parka - 02.04.2013
where you are using
SetPlayerTeam ??
Re: SetPlayerTeam - Team Damage Enabled -
SuperViper - 02.04.2013
AddPlayerClassEx automatically sets the player's team.
GetPlayerTeam retrieves the proper team.
Respuesta: SetPlayerTeam - Team Damage Enabled -
Parka - 02.04.2013
to use
AddPlayerClassEx You must also use
SetPlayerTeam
Re: SetPlayerTeam - Team Damage Enabled -
SuperViper - 02.04.2013
Why do you assume that?
GetPlayerTeam returns the correct team.
AddPlayerClassEx was made for a reason.
Respuesta: SetPlayerTeam - Team Damage Enabled -
Parka - 02.04.2013
AddPlayerClassEx(teamid, skin, Float, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
teamid The team you want the player to spawn in.
SetPlayerTeam(playerid, teamid);
teamid The team to put the player in. Use NO_TEAM to remove the player from any team.
Note: Players can not damage/kill players on the same team unless they use a knife to slit their throat.
Re: SetPlayerTeam - Team Damage Enabled -
SuperViper - 02.04.2013
So what's your point?
AddPlayerClassEx assigns the team automatically, which is proven in my
GetPlayerTeam results. Don't reply here if you don't know what you're talking about.
Re: SetPlayerTeam - Team Damage Enabled -
RajatPawar - 02.04.2013
How about this for a theory - AddPlayerClassEx get's executed on the start, shouldn't that be a factor in this, while you change the things ingame? Try this - Both of you spawn with the same team AT FIRST (when you connect) and then try killing each other. (vague theory)
Re: SetPlayerTeam - Team Damage Enabled -
SuperViper - 02.04.2013
GetPlayerTeam is returning the proper teams though.
Re: SetPlayerTeam - Team Damage Enabled -
Konstantinos - 02.04.2013
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
These callbacks will help you to prevent it!