Assigning kills to players -
stormchaser206 - 13.07.2012
Hello,
I have this thing where the army can blow up the criminals with a missile...
How can i assign the kills to the player?
Thanks,
stormchaser206
Re: Assigning kills to players -
Captain_Mani - 13.07.2012
OnPlayerDeath?
I don't know actually, but under OnPlayerDeath, make a script with (killerid)?
Re: Assigning kills to players -
stormchaser206 - 13.07.2012
I know under OnPlayerDeath, but the code?
Re: Assigning kills to players -
Kitten - 13.07.2012
Use,
pawn Код:
if(reason == 51)
{
/// your code
}
OnPlayerDeath.
https://sampwiki.blast.hk/wiki/Weapons
Re: Assigning kills to players -
stormchaser206 - 13.07.2012
Quote:
Originally Posted by Kitten
|
I don't get it kind of.
Re: Assigning kills to players -
Captain_Mani - 13.07.2012
Which type of missile is it?
RPG or HS Rocket?
Re: Assigning kills to players -
clarencecuzz - 13.07.2012
It really doesn't matter... they're both the same.
If you're trying to find out HOW to kill them, try using: CreateExplosion(X, Y, Z, Radius);
Or you could use SetPlayerHealth and set to 0 etc.
Re: Assigning kills to players -
vIBIENNYx - 13.07.2012
Seeing as there is no way to actually relate the killer and the victim using native functions (For explosions at least) you would need to do the following:
Create a variable that would change depending on who send the missle, for example, if it is some kind of turret, you would need to find out who is firing the turret by declaring and using:
Firedturret = playerid;
Then you need to find out which player died using the reason code that Kitten gave you and in this you would find out which playerid used the turret and manually assign the kill to the players statistics.
This is a way of doing it with no code, if you need any more help just post what code you have that's relevant and I'll give you a hand.
Re: Assigning kills to players -
stormchaser206 - 13.07.2012
Would this work?:
pawn Код:
if(NearStrike[playerid] == 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(UsedStrike[i] == 1)
{
UsedStrike[i] = 0;
SendDeathMessage(i, playerid, 51);
format(string, sizeof(string),"-| %s(%d) has been killed by %s(%d)'s missile strike |-", name, playerid, name2, i);
SendClientMessageToAll(COLOR_BLUE, string);
GivePlayerMoney(i, 2500);
SetPlayerScore(i, GetPlayerScore(i) + 2);
PlayerInfo[i][Kills]++;
}
}
}
Re: Assigning kills to players -
vIBIENNYx - 14.07.2012
Declare "UsedStrike" as "UsedStrike" rather than "UsedStrike[MAX_PLAYERS]"
pawn Код:
if(NearStrike[playerid] == 1)
{
SendDeathMessage(UsedStrike, playerid, 51);
format(string, sizeof(string),"-| %s(%d) has been killed by %s(%d)'s missile strike |-", name, playerid, name2, UsedStrike);
SendClientMessageToAll(COLOR_BLUE, string);
GivePlayerMoney(UsedStrike, 2500);
SetPlayerScore(UsedStrike, GetPlayerScore(UsedStrike) + 2);
PlayerInfo[UsedStrike][Kills]++;
UsedStrike = 0;
}
When you are assigning the "UsedStrike" variable, assign "playerid" rather than "1" it just saves making a for loop..