OnDialogResponse - Punish the KillerID
#1

Hey all,
i have a question.

I create an OnDialogResponse for all victims who are killed by the teammates. All things work.

ID 1 Kills ID 0 -> the gui is open at id 0. than the id 0 want to punish the killer (id 1) (-$5000) the killer, but he took the money himself.

ID 0 Kills ID 1 -> the gui is open at id 1. than the id 0 want to punish the killer (id 0) (-$5000) the killer. That works.

LoL?

Код:
	if(dialogid == Bestrafen)
	{
	  new killerid;
	  new Killername[MAX_PLAYERS],string[256],string1[256];
	  GetPlayerName(killerid, Killername, sizeof(Killername));
	  if(response
	  {
	    if(listitem == 0)
	    {
			GivePlayerMoney(killerid, -5000);
	    }
	    return 1;
...
Reply
#2

killerid will always be zero because you just created it. Find a way to transfer it from OnPlayerDeath to that if
Reply
#3

Quote:
Originally Posted by dice7
killerid will always be zero because you just created it. Find a way to transfer it from OnPlayerDeath to that if
indeed, that's also why id 0 will always be punished cause killerid is always 0, even if id24 kills id45, id 0 will be punished
Reply
#4

Top of script:
pawn Код:
new JustKilledBy[MAX_PLAYERS];
OnPlayerConnect:

pawn Код:
JustKilledBy[playerid] = 999;
OnPlayerDeath:

pawn Код:
JustKilledBy[playerid] = killerid;
and Dialog:

pawn Код:
if(dialogid == Bestrafen)
    {
      new Killername[MAX_PLAYERS],string[256],string1[256];
      GetPlayerName(JustKilledBy[playerid], Killername, sizeof(Killername));
      if(response
      {
        if(listitem == 0)
        {
            GivePlayerMoney(JustKilledBy[playerid], -5000);
            JustKilledBy[playerid] = 999;
        }
        return 1;
Reply
#5

Quote:
Originally Posted by Miokie*
pawn Код:
JustKilledBy[playerid] = 999;
It's better if you assign INVALID_PLAYER_ID to the 'JustKilledBy'.
Reply
#6

Why not make "new IsPlayerSeeingMenu[MAX_PLAYERS]" you could make it work, and do "if(IsPlayerSeeingMenu(playerid) == 1)" and Take Money etc kill em whatever you want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)