Little help
#1

Hey so i have this problem that when a player get killed from someone it doesnt add +1 death to his count.
but when he dies from an explostion or something it does.

Код:
    if ( killerid != INVALID_PLAYER_ID )
    	return PlayerInfo[killerid][pKills]++;

    PlayerInfo[playerid][pDeaths]++;
this is my code at onplayerdeath.
Reply
#2

Quote:
Originally Posted by rambalili2
Посмотреть сообщение
Hey so i have this problem that when a player get killed from someone it doesnt add +1 death to his count.
but when he dies from an explostion or something it does.

Код:
    if ( killerid != INVALID_PLAYER_ID )
    	return PlayerInfo[killerid][pKills]++;

    PlayerInfo[playerid][pDeaths]++;
this is my code at onplayerdeath.
Use this

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
      if (killerid != INVALID_PLAYER_ID)
      {
             PlayerInfo[killerid][pKills]++;
             PlayerInfo[playerid][pDeaths]++;      
      }
      return 1;
}
Reply
#3

I just had to put it at the top thanks tho I fixed it.
Reply
#4

Quote:
Originally Posted by K0P
Посмотреть сообщение
Use this

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
      if (killerid != INVALID_PLAYER_ID)
      {
             PlayerInfo[killerid][pKills]++;
             PlayerInfo[playerid][pDeaths]++;      
      }
      return 1;
}
@K0P, too fast xD

On topic: The reason here is, that in your code you are trying to increase player death variable after you've returned
PlayerInfo[killerid][pKills]++. The reason for why was it increasing death varaible when an explosion happend since there's no killer so, statement "killerid != INVALID_PLAYER_ID" won't run and the code will directly hop onto increasing deaths.
Reply
#5

Yep I've noticed that, thanks for the explanation though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)