a player cant kill his teammates how?
#1

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

better use:

SetPlayerTeam
Reply
#3

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

ah didnt knew thnx guys

but where to use the setplayerteam?
Reply
#5

OnPlayerSpawn

if(gteam[playerid] == /*yourteam*/) {
SetPlayerTeam(playerid, /*your team id*/);

showed you in short.
Reply
#6

ok added thnx i will check if it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)