SA-MP Forums Archive
OnDialogResponse - Punish the KillerID - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnDialogResponse - Punish the KillerID (/showthread.php?tid=110456)



OnDialogResponse - Punish the KillerID - SureShot - 26.11.2009

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;
...


Re: OnDialogResponse - Punish the KillerID - dice7 - 26.11.2009

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


Re: OnDialogResponse - Punish the KillerID - ExoSanty - 26.11.2009

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


Re: OnDialogResponse - Punish the KillerID - miokie - 26.11.2009

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;



Re: OnDialogResponse - Punish the KillerID - Correlli - 26.11.2009

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


Re: OnDialogResponse - Punish the KillerID - AKA_Cross - 26.11.2009

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.