public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hitid == gTeam[playerid] || hitid == GetPlayerTeam(playerid))
{
GameTextForPlayer(playerid, "~r~Do not teamkill!", 1000, 5);
return 0;
}
return 1;
}
public OnPlayerDeath( playerid, killerid, reason ) // This is called when a player deaths. { if ( killerid != INVALID_PLAYER_ID ) // If the killerid are NOT an invalid player { // Then if ( GetPlayerTeam( killerid ) == GetPlayerTeam( playerid ) ) // If killerid's team == playerid's team ( who has been killed ) { // Then SetPlayerHealth( killerid, -1 ); // Kills the killer ( Setting the health to -1 ). SendClientMessage( killerid, -1, "No teamkilling." ); // Sends a message to the killer with a white colour ( -1 ), with the message " No teamkilling. ". GivePlayerMoney( killerid, - 5000 ); // Take $5000 from the killerid, because teamkilling, } else // Another team killed the player { SendClientMessage( killerid, -1, "Nice shot!" ); // Sends a message to the killer with a white colour ( -1 ) with the message "Nice Shot! ". GivePlayerMoney( killerid, 5000 ); // Gives the killerid $5000. } } SendDeathMessage( killerid, playerid, reason ); // Sends a death message about the killerid is killing the player, with the reason ( At the middle right of your game, can be toggled by pressing F9 ). return 1; // This means the callback is executed succesfully. }
Hope this helps
Код:
public OnPlayerDeath( playerid, killerid, reason ) // This is called when a player deaths. { if ( killerid != INVALID_PLAYER_ID ) // If the killerid are NOT an invalid player { // Then if ( GetPlayerTeam( killerid ) == GetPlayerTeam( playerid ) ) // If killerid's team == playerid's team ( who has been killed ) { // Then SetPlayerHealth( killerid, -1 ); // Kills the killer ( Setting the health to -1 ). SendClientMessage( killerid, -1, "No teamkilling." ); // Sends a message to the killer with a white colour ( -1 ), with the message " No teamkilling. ". GivePlayerMoney( killerid, - 5000 ); // Take $5000 from the killerid, because teamkilling, } else // Another team killed the player { SendClientMessage( killerid, -1, "Nice shot!" ); // Sends a message to the killer with a white colour ( -1 ) with the message "Nice Shot! ". GivePlayerMoney( killerid, 5000 ); // Gives the killerid $5000. } } SendDeathMessage( killerid, playerid, reason ); // Sends a death message about the killerid is killing the player, with the reason ( At the middle right of your game, can be toggled by pressing F9 ). return 1; // This means the callback is executed succesfully. } |
You are definitely not comparing betw3en YOUR team and the guy who is being shot what you are doing is comparing between your team and the shot player id not his gTeam. sorry for spalling mistkaes on phone r8 now. |
// FROM:
if(hitid == gTeam[playerid] || hitid == GetPlayerTeam(playerid))
// TO:
if(GetPlayerTeam(playerid) == GetPlayerTeam(hitid))