how do i do this? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how do i do this? (
/showthread.php?tid=391268)
how do i do this? -
Deaglez - 10.11.2012
how do I make the Following team being Anti teamkill by the humans?
Is it like this?:
pawn Код:
if(gTeam[playerid] == TEAM_BLOODLINE)
{
new string[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof(string), "BLOODLINE ANNOUNCE: %s is now on-duty.", name);
SendClientMessageToAll(0xD40412FF, string);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
SetPlayerSkin(playerid, blskins[random(3)]);
SetPlayerTeam(playerid, 2); // This onee
SetPlayerTeam(playerid, 1); // and this one
}
Re: how do i do this? -
Lordzy - 10.11.2012
By using SetPlayerTeam, I think it works as an anti-teamkill too. Or else, you could try something like this:
pawn Код:
new team1[MAX_PLAYERS], team2[MAX_PLAYERS]; //Creating two team global variables.
public OnPlayerTakeDamage(playerid, issueried, Float:amount, weaponid)
{
if(Team1[issuerid] == 1 && Team1[playerid] == 1) //If issuer and the player is in same team.
{
new Float:hp[MAX_PLAYERS];
GetPlayerHealth(playerid, hp[playerid]);
SetPlayerHealth(playerid, hp[playerid]); //So, here it gives balance and the player won't die.
}
return 1;
}
//I believe this could work.
Re: how do i do this? -
Deaglez - 10.11.2012
Is that only for 1 team?
I want to make it 2 team anti-team kills?
BTW Thanks. REp 1
PLS help
Im not a very good scripter
Re: how do i do this? -
Lordzy - 10.11.2012
Here's it
pawn Код:
new team1[MAX_PLAYERS], team2[MAX_PLAYERS]; //Creating two team global variables.
public OnPlayerTakeDamage(playerid, issueried, Float:amount, weaponid)
{
if(Team1[issuerid] == 1 && Team1[playerid] == 1) //If issuer and the player is in same team.
{
new Float:hp[MAX_PLAYERS];
GetPlayerHealth(playerid, hp[playerid]);
SetPlayerHealth(playerid, hp[playerid]); //So, here it gives balance and the player won't die.
}
else if(Team2[issuerid] == 1 && Team2[playerid] == 1) //If issuer and the player is in same team.
{
new Float:hp[MAX_PLAYERS];
GetPlayerHealth(playerid, hp[playerid]);
SetPlayerHealth(playerid, hp[playerid]); //So, here it gives balance and the player won't die.
}
return 1;
}
public OnPlayerUpdate(playerid)
{
if(Team1[playerid] == 1) return Team2[playerid] = 0;
if(Team2[playerid] == 1) return Team1[playerid] = 1;
return 1;
}
/*You can setplayer's team in this case like this:
Team1[playerid] = 1; //Then player is in team1.
Team2[playerid] = 1; //Then player is in team2.
*/