a player cant kill his teammates how? - 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: a player cant kill his teammates how? (
/showthread.php?tid=374299)
a player cant kill his teammates how? -
niels44 - 02.09.2012
hey guys,
im back xD and im working on a new GM but now my question:
how to make it that when someone shoots at another player from the same team that the player wont loose health? so when for example i shoot my teammate my teammate wont loose ANY health..
also another question:
if i kill someone from the other team i get money and score, i already made that, but now how to fix it that when i use /kill or i just die cuz i crash with plane or etc that i WONT get money and score? i tried alot things but didnt worked yet... anyways this is the code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
// zorgt ervoor dat als je iemand doodschiet dan krijgt diegene $5000 en 1 score erbij
if(playerid == killerid) return 0;
if(killerid == playerid) return 0;
GivePlayerMoney(killerid, 5000);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
GameTextForPlayer(playerid, "~g~+ $5000 money~n~~r~+ 1 score", 2000, 3);
return 1;
}
Greets Niels
Re: a player cant kill his teammates how? - Jarnu - 02.09.2012
better use:
SetPlayerTeam
Re: a player cant kill his teammates how? -
mamorunl - 02.09.2012
For your second one:
pawn Код:
if(killerid == INVALID_PLAYERID) return 0;
Should work if I recall correctly.
For you first one, Jarnu answered it a bit but in a pretty rude way..
SetPlayerTeam has a built-in feature that takes care of teamkills.
Re: a player cant kill his teammates how? -
niels44 - 02.09.2012
ah didnt knew thnx guys
but where to use the setplayerteam?
Re: a player cant kill his teammates how? - Jarnu - 02.09.2012
OnPlayerSpawn
if(gteam[playerid] == /*yourteam*/) {
SetPlayerTeam(playerid, /*your team id*/);
showed you in short.
Re: a player cant kill his teammates how? -
niels44 - 02.09.2012
ok added

thnx i will check if it works