killing
#1

how can i make it like when someone kill another person he get +10 score, i tried it myself but i get everytime errors.
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  if(IsPlayerConnected(killerid))
  {
    new score = GetPlayerScore(killerid);
    SetPlayerScore(killerid, score+10);
  }
  return 1;
}
Reply
#3

Remi that code will give the player who died +10 points.

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  new playercash;
	if(killerid == INVALID_PLAYER_ID) {
    SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    ResetPlayerMoney(playerid);
	} else {
	  	SendDeathMessage(killerid,playerid,reason);
			SetPlayerScore(killerid,GetPlayerScore(killerid)+10);
   	}
 	return 1;
}
Reply
#4

Quote:
Originally Posted by diesulke
Remi that code will give the player who died +10 points.
No, it won't. He's using 'killerid' param, not 'playerid'.
Reply
#5

Indeed. What you're doing diesulke, does exactly the same as my script.
Reply
#6

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  new playercash;
    if(killerid == INVALID_PLAYER_ID) {
    SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
    ResetPlayerMoney(playerid);
    } else {
        SendDeathMessage(killerid,playerid,reason);
            SetPlayerScore(killerid,GetPlayerScore(killerid)+10);
            GameTextForPlayer(playerid, "+10!",3000,4);
    }
    return 1;
}

i have it now like that but when i kill someone, get the person wich i killed seen +10 as gametext, can you please set that to the killer?
Reply
#7

Because there is 'playerid' param in the GameTextForPlayer function, it should be 'killerid'.
Reply
#8

Why is this useful ?
pawn Код:
if(killerid == INVALID_PLAYER_ID) {
    SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
It's the same as
pawn Код:
if(a == 5)
{printf("5");}
else
{printf("%d", a);}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)