SA-MP Forums Archive
Score vehicle killer - 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: Score vehicle killer (/showthread.php?tid=269166)



Score vehicle killer - cruising - 15.07.2011

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.


Re: Score vehicle killer - Miguel - 15.07.2011

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


Re: Score vehicle killer - Adil - 15.07.2011

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



Re: Score vehicle killer - cruising - 16.07.2011

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