SetPlayerTeam - question related this -
BoboRi - 28.11.2011
So, I have a question related to
https://sampwiki.blast.hk/wiki/SetPlayerTeam
It writes that "Players on the same team can not kill each other unless they use a knife. "
Can I disable this so players in the team x can kill players from the same team? And in wich way I can disable this.
Thank you for helping =)
Re: SetPlayerTeam - question related this -
grand.Theft.Otto - 28.11.2011
Well team kill won't work if you use SetPlayerTeam.
You can try using this include (OnPlayerShootPlayer):
https://sampforum.blast.hk/showthread.php?pid=937824#pid937824
And if playerid is aiming / shooting at targetid (on your own team), set targetid's health to zero.
Re: SetPlayerTeam - question related this -
Johnson_boy - 29.11.2011
Or drop the SetPlayerTeam function and use some other variable for defining teams.
Re: SetPlayerTeam - question related this -
BoboRi - 29.11.2011
What variable I could use if not the SetPlayerTeam for setting the team of the player?
Re: SetPlayerTeam - question related this -
Johnson_boy - 29.11.2011
I'd suggest PVars.
You can define your teams like
Код:
#define TEAM_X 0
#define TEAM_Y 1
#define TEAM_Z 2
then you can use this for setting teams
Код:
SetPVarInt(playerid, "team", TEAM_X);
and for checking team
Код:
if(GetPVarInt(playerid, "team") == TEAM_X)
I prefer PVars to normal variables because the ease of use (no need to define them) and they can also be reached from filterscripts + they are reseted automatically on disconnect, just what we want in this case. But this is just one example, there are many many ways of setting teams.
Re: SetPlayerTeam - question related this -
BoboRi - 29.11.2011
ok thank you very much =)
Re: SetPlayerTeam - question related this -
BoboRi - 29.11.2011
Oh yes, one more question, how can I make the default spawn and skin for this team?
Re: SetPlayerTeam - question related this -
MP2 - 29.11.2011
https://sampwiki.blast.hk/wiki/AddPlayerClass
Or if you want it team based
https://sampwiki.blast.hk/wiki/OnPlayerSpawn
https://sampwiki.blast.hk/wiki/SetPlayerPos
https://sampwiki.blast.hk/wiki/SetPlayerSkin
Re: SetPlayerTeam - question related this -
BoboRi - 29.11.2011
so something like this:
if(GetPVarInt(playerid, "team") == TEAM_X)
and here then the SetPlayerSkin ?
Re: SetPlayerTeam - question related this -
MP2 - 29.11.2011
You could do that, yes. A switch would probably be better though.
pawn Код:
switch(GetPVarInt(playerid, "team"))
{
case TEAM_X:
{
SetPlayerPos(playerid, x, y, z);
SetPlayerFacingAngle(playerid, a);
SetPlayerInterior(playerid, int);
}
case TEAM_Y:
{
SetPlayerPos(playerid, x, y, z);
SetPlayerFacingAngle(playerid, a);
SetPlayerInterior(playerid, int);
}
case TEAM_Z:
{
SetPlayerPos(playerid, x, y, z);
SetPlayerFacingAngle(playerid, a);
SetPlayerInterior(playerid, int);
}
}