21.08.2014, 10:57
I know this is probably a messy code, because I've never tried something like this before, but I just tried XD
So, the problem;
When a player dies, and he's in a Hydra, there should be a kill message, which Hydra pilot killed that Hydra pilot, but for some reason, nothing is happening. I've seen some videos on *******, in which people have created, that if you shoot a hydra, a death message comes etc.. so it is possible.
Code;
E: did some minor changes, still not working :l
So, the problem;
When a player dies, and he's in a Hydra, there should be a kill message, which Hydra pilot killed that Hydra pilot, but for some reason, nothing is happening. I've seen some videos on *******, in which people have created, that if you shoot a hydra, a death message comes etc.. so it is possible.
Code;
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
for(new line=0; line < 6; line++) TextDrawHideForPlayer(playerid, BoxMsg[line]);
SendDeathMessage(killerid, playerid, reason);
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z);
if(GetVehicleModel(vehicleid) == 520)
{
new target, attacker;
new
Float:fPX, Float:fPY, Float:fPZ,
Float:fVX, Float:fVY, Float:fVZ
;
//const Float:fScale = 10.0;
foreach(Player, i)
{
if(IsPlayerInAnyVehicle(i) && IsPlayerInRangeOfPoint(i, 20, X, Y, Z))
{
attacker = i;
GetPlayerCameraPos(i, fPX, fPY, fPZ);
GetPlayerCameraFrontVector(i, fVX, fVY, fVZ);
if(IsPlayerInRangeOfPoint(i, 10, fVX, fVY, fVZ)) target = i; break;
}
}
OnPlayerDeath(target, attacker, 51);
}
}
return 1;
}