[UNSOLVED]Find Out Who Killed Who.
#1

Couldn't find anything like checking who killed who.

I want to make it so if they are not in a deathmatch and they kill anyone that they will get auto kicked from the server. Useful for annoying people killing in stunts and to get rid of hackers.


public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid[killed] killerid && PlayerIsInDM(playerid) == false;
{
Kick(playerid);
}
}

Obviously it wouldn't be close to that code at all but how would I do this?



//EDIT when a player say suicides it just says "KICKED: has been auto kicked by console."


Code:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM[playerid] == false)
  {
        new string [128];
        new pName2[MAX_PLAYER_NAME];
        GetPlayerName(killerid, pName2, sizeof(pName2));
        format(string, sizeof(string), "KICKED: %s has been auto kicked by console.", pName2);
        SendClientMessageToAll(COLOR_RED, string);
    Kick(killerid);
  }
Reply
#2

I Think what this solve u problem.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM(playerid) == true)
  {
     Kick(killerid);
  }
}
Reply
#3

Quote:
Originally Posted by CyNiC_
I Think what this solve u problem.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM(playerid) == true)
  {
    Kick(killerid);
  }
}
Eh, he wants it outside of a Deathmatch zone.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM(playerid) == false)
  {
     Kick(killerid);
  }
}
Reply
#4

Quote:
Originally Posted by Sky4D
Quote:
Originally Posted by CyNiC_
I Think what this solve u problem.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM(playerid) == true)
  {
    Kick(killerid);
  }
}
Eh, he wants it outside of a Deathmatch zone.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM(playerid) == false)
  {
    Kick(killerid);
  }
}
A little fault, nice guy.
Reply
#5

Quote:
Originally Posted by CyNiC_
Quote:
Originally Posted by Sky4D
Quote:
Originally Posted by CyNiC_
I Think what this solve u problem.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM(playerid) == true)
  {
    Kick(killerid);
  }
}
Eh, he wants it outside of a Deathmatch zone.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM(playerid) == false)
  {
    Kick(killerid);
  }
}
A little fault, nice guy.
Precisely why I didn't criticize you.
Reply
#6

I can't believe I couldn't figure that out. Thank you very much cynic. Also I only realized the true had to be a false after testing lol.



//EDIT when a player say suicides it just says "KICKED: has been auto kicked by console."


Code:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM[playerid] == false)
  {
        new string [128];
        new pName2[MAX_PLAYER_NAME];
        GetPlayerName(killerid, pName2, sizeof(pName2));
        format(string, sizeof(string), "KICKED: %s has been auto kicked by console.", pName2);
        SendClientMessageToAll(COLOR_RED, string);
    Kick(killerid);
  }
Reply
#7

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM[killerid] == false)
  {
new string [128];
new pName2[MAX_PLAYER_NAME];
GetPlayerName(killerid, pName2, sizeof(pName2));
format(string, sizeof(string), "KICKED: %s has been auto kicked by console.", pName2);
SendClientMessageToAll(COLOR_RED, string);
    Kick(killerid);
  }
Reply
#8

Quote:
Originally Posted by Giacomand
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(PlayerIsInDM[killerid] == false)
  {
new string [128];
new pName2[MAX_PLAYER_NAME];
GetPlayerName(killerid, pName2, sizeof(pName2));
format(string, sizeof(string), "KICKED: %s has been auto kicked by console.", pName2);
SendClientMessageToAll(COLOR_RED, string);
    Kick(killerid);
  }
This is somewhat better but it won't check for suicide.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    // Added check for INVALID_PLAYER_ID and cleaned up the code:
    if(killerid != INVALID_PLAYER_ID && !PlayerIsInDM[killerid])
    {
        new
            sMsg[128];
       
        GetPlayerName(killerid, sMsg, MAX_PLAYER_NAME);
       
        format(sMsg, sizeof(sMsg), "KICKED: %s has been auto kicked by console.", sMsg);
        SendClientMessageToAll(COLOR_RED, sMsg);

        Kick(killerid);
    }
}
Reply
#9

Is there a way to make it so it ignores deaths like explosions or someone killing someone with a car because both can be accidental.
Reply
#10

Quote:
Originally Posted by [SU
BP13 ]
Is there a way to make it so it ignores deaths like explosions or someone killing someone with a car because both can be accidental.
I have this in my GM, this is the part that checks for explosions, and which type of explosion it was. You can probably figure out how to use this in the above code.

pawn Код:
if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
                {
                    switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
                    {
                        case 425:
                        {
                            reasonMsg = "Hunter Rockets";
                        }
                        case 432:
                        {
                            reasonMsg = "Rhino Turret";
                        }
                        case 520:
                        {
                            reasonMsg = "Hydra Rockets";
                        }
                        default:
                        {
                            reasonMsg = "Explosion";
                        }
                    }
                }
                else
                {
                    reasonMsg = "Explosion";
                }
            }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)