Score vehicle killer
#1

Is there any way to score a player who kills a vehicle that a another player sitting in as a driver/passenger with any weapon and vehicle?

I mean, if im sitting in a heli/plane/car, and you shoot at my vehicle with a gun or a tank/hunter/rustler, you get +1 in score when my vehicle explode with me inside it.
Reply
#2

I'm not sure if SA-MP detects the player who damaged the vehicle but if it does, you might want to use the "OnVehicleDeath" callback (I remember reading somewhere that it had a killerid parameter or something).
Reply
#3

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, vehicleid))
        {
            SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
        }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Adil
Посмотреть сообщение
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, vehicleid))
        {
            SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
        }
    }
    return 1;
}
Thanks! i have been looking for this like 100 years,
But it would be much better if you get the score when vehicle health is like 150-200 so you dont need to shoot all the time until vehicle blows, bc i was testing this, if you stop shoot when healt is like 300, you dont get any score when it blows.

And one more question, when you kill ur self, why does ID 0 gets the score? and then i dont mean just this code,
i use this
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)