SA-MP Forums Archive
OnPlayerShootPlayer Question - 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: OnPlayerShootPlayer Question (/showthread.php?tid=276658)



OnPlayerShootPlayer Question - Tigerbeast11 - 14.08.2011

I am using an OnPlayerShootPlayer include. I wanted a one shot, one kill gamemode. Here is my script:

pawn Код:
public OnPlayerShootPlayer(Shooter,Target,Float:HealthLost,Float:ArmourLost)
{
    SetPlayerHealth(Target,0);
    SetPlayerScore(Shooter,GetPlayerScore(Shooter)+1);
    GivePlayerMoney(Shooter,200);
    return 1;
}
The problem is, when I set the Target's health to 0, it wont give the Shooter a +1 kill as the health was SET to zero... In other words, it won't count as a kill for the Shooter... Is there anyway to fix this?


Re: OnPlayerShootPlayer Question - Darnell - 14.08.2011

Try posting on the include's thread.


Re: OnPlayerShootPlayer Question - Tigerbeast11 - 14.08.2011

I could, but it was a bit full. Since this is a discussion about scripting, I decided to post it here...


Re: OnPlayerShootPlayer Question - Sergei - 14.08.2011

I would use OnPlayerDeath callback to give score and money
If everything is allright, it should be called right after you set health to 0.


Re: OnPlayerShootPlayer Question - Tigerbeast11 - 14.08.2011

Quote:
Originally Posted by Sergei
Посмотреть сообщение
I would use OnPlayerDeath callback to give score and money
If everything is allright, it should be called right after you set health to 0.
I understand you point but I don't know how to give the shooter the credit for the kill...


Re: OnPlayerShootPlayer Question - =WoR=Varth - 15.08.2011

You mean the shooter don't get +1 score and money with your code?


Re: OnPlayerShootPlayer Question - Tigerbeast11 - 15.08.2011

No, I mean on the deathlist, it isnt a kill for the shooter.


Re: OnPlayerShootPlayer Question - Finn - 15.08.2011

One shot one kill?

Isn't this done with "instagib 1" in the server.cfg?

Edit: I suggest using OnPlayerDeath callback for setting the scores.