Removing teamkill - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Removing teamkill (
/showthread.php?tid=174734)
Removing teamkill -
Face9000 - 06.09.2010
Hi all,i use LSTDM V.2 and i need to remove team kills.
This is the OnPlayerDeath
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
new playercash;
new string[255], pname[24];
new killedplayer[MAX_PLAYER_NAME];
GivePlayerMoney(killerid, 500);
playercash = GetPlayerMoney(playerid);
if(gTeam[killerid] == gTeam[playerid])
{
SendClientMessage(killerid, COLOR_ORANGE, "TEAMKILLING NOT ALLOWED!");
SetPlayerHealth(killerid, 100);
GetPlayerName(killerid, pname, 24);
format(string, 255, "%s(%d) has been warned for team killing!", pname, killerid);
SendClientMessageToAll(COLOR_ORANGE, string);
}
if(killerid == INVALID_PLAYER_ID)
{
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
}
else
{
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
{
GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
GivePlayerMoney(killerid, bounty[playerid]);
bounty[playerid] = 0;
}
if(playercash > 0)
{
GivePlayerMoney(killerid, playercash);
}
}
return 1;
}
Thanks
Re: Removing teamkill -
iggy1 - 06.09.2010
pawn Код:
SetPlayerTeam(playerid,NO_TEAM);
To remove anti-team kill (^^removes player from all teams).
And just set players on the same team to stop team kills.
https://sampwiki.blast.hk/wiki/SetPlayerTeam
Re: Removing teamkill -
Face9000 - 06.09.2010
Where i need to add/remove that code?
Re: Removing teamkill -
iggy1 - 06.09.2010
I'm not sure how youre GM does things, but id set the players to a team in 'onplayerspawn' using 'SetPlayerTeam' then people in the same team
cant kill each other. Then if you wish to enable team damage use 'SetPlayerTeam(playerid,NO_TEAM);' when or where you need to.
Re: Removing teamkill -
playbox12 - 06.09.2010
Quote:
Originally Posted by Logitech90
Where i need to add/remove that code?
|
Try OnPlayerConnect, or OnPlayerSpawn (I'd recommend the first)
Re: Removing teamkill -
iggy1 - 06.09.2010
You would need to do something like this to disable team kills, obviously swap the defines to suit the teams in your GM.
pawn Код:
#define TEAM_COPS 0
#define TEAM_MEDICS 1
//top under includes
pawn Код:
public OnPlayerSpawn(playerid)
{
if(GetPlayerSkin(playerid) == 187 || 130)//i know these are not copskins but cnt b bothered looking up :)
{
SetPlayerTeam(playerid,TEAM_COPS);
}
if(GetPlayerSkin(playerid) == 400 || 401)
{
SetPlayerTeam(playerid,TEAM_MEDICS);
}
return 1;
}
Re: Removing teamkill -
Face9000 - 06.09.2010
mmm k thanks for the help