OnPlayerShootPlayer Question
#1

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?
Reply
#2

Try posting on the include's thread.
Reply
#3

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

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.
Reply
#5

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...
Reply
#6

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)