SetPlayerTeam - Team Damage Enabled
#1

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.
Reply
#2

where you are using SetPlayerTeam ??
Reply
#3

AddPlayerClassEx automatically sets the player's team. GetPlayerTeam retrieves the proper team.
Reply
#4

to use AddPlayerClassEx You must also use SetPlayerTeam
Reply
#5

Why do you assume that? GetPlayerTeam returns the correct team. AddPlayerClassEx was made for a reason.
Reply
#6

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.
Reply
#7

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.
Reply
#8

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)
Reply
#9

GetPlayerTeam is returning the proper teams though.
Reply
#10

https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage

These callbacks will help you to prevent it!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)