22.01.2013, 21:55
2 problems still...
1)i is always 0 in that loop.
2) killerid is always 255
How do I get correct id of killer (player who shot or rammed that car)? I figured OnPlayerDeath gets called with 65535 killer id automatically which means those who die will loose score but killer don't get any. My intention is to increase score of player who caused wheel to explode by number of players who died in explosion.
1)i is always 0 in that loop.
2) killerid is always 255
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
new string[200], killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
format(string,sizeof(string),"OnVehicleDeath: vehicleid:%d killerid:%d -> %s",vehicleid, killerid, killer);
foreach(new i : Player)
{
new vehID = GetPlayerVehicleID(i);
if(vehID == vehicleid)
{
new veh_pl[200];
new name[30];
GetPlayerName(i,name,30);
format(veh_pl,sizeof(veh_pl),"OnVehicleDeath -> pl_id = %i (%s)",i,name);
DebugMsg(-1,0xFFFFFF,veh_pl);
}
}
DebugMsg(-1,0xFFFFFF,string);
return 1;
}