27.09.2014, 02:01
(
Последний раз редактировалось EnforcerDon; 28.09.2014 в 08:36.
)
I have a problem that is really bugging me, and ****** doesn't seem to have answers.
I want to prevent a player dying when they are in a rhino (tank), because if you shoot a HS missile at the tank, it will kill the player, despite them being in the vehicle. I have "OnPlayerTakeDamage" set up so that when a player takes damage, and they are inside a rhino, their health will be restored to what it was.
However, if the HS missile is well aimed, it will take all of the players health in one go, and the player will die before their health is restored, despite the fact that the rhino may not have blown up.
Effectively, what I wan't to do is make it such that when a player is in a rhino, they are untouchable until either they exit it, or someone blows the rhino.
This problem is really bugging me, and I will rep++ anyone who can help me find a decent solution.
I want to prevent a player dying when they are in a rhino (tank), because if you shoot a HS missile at the tank, it will kill the player, despite them being in the vehicle. I have "OnPlayerTakeDamage" set up so that when a player takes damage, and they are inside a rhino, their health will be restored to what it was.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
print("damage taken");
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid != INVALID_VEHICLE_ID){
new modelid = GetVehicleModel(vehicleid);
if(modelid == 432){
print("in vehicle");
new Float: health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, (health + amount));
}
}
return 1;
}
Effectively, what I wan't to do is make it such that when a player is in a rhino, they are untouchable until either they exit it, or someone blows the rhino.
This problem is really bugging me, and I will rep++ anyone who can help me find a decent solution.