Keeping a player and a car alive.
#1

Ok so obviously I'm not gonna reveal the script entire, so please bare with me while I explain my problem as detailed as possible.

I made a Derby DM area, in which players can shoot eachother with cars. Shooting is done by creating an explosion in front of the car thus destroying anything in that spot. This works fine if you immediately want to kill the player/car, which I don't want to do!

I want players to be able to "lose" car armour, which is 100% at first, but when they get hit by an explosion from another player they lose 20% armour, this goes on untill they have 0% armour left in which case they will blow up next time they get hit.

Every time a player gets hit by the explosion the above is done & (heres the problem) the car gets repaired. But in most cases the car blows up anyways (even though its health is set back to 1000). Is there a way to keep this car alive? Also when the explosion hits exactly where the driver is sitting in the car the driver dies.

Any useful feedback would be highly appreciated.

Heres the code for the timer (gets called every 3 seconds)
Код:
forward KCT(playerid);
public KCT(playerid)
{
    if(GetPVarInt(playerid, "dmzone") == 0)
	{
	 	KillTimer(killCounterTimer[playerid]);
		return 1;
	}
	if(!GetPVarInt(playerid, "derby")) return 0; if(!IsPlayerInAnyVehicle(playerid)) return 0;
	SetPlayerHealth(playerid, 100);
	new Float:health;
	GetVehicleHealth(GetPlayerVehicleID(playerid), health);
	if((health <300) && (killCounter[playerid] < 5))
	{
		killCounter[playerid]++;
 		SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
 		new carHealth, str[32];
		carHealth = 100-(20*killCounter[playerid]);
		ChangeVehicleColor(GetPlayerVehicleID(playerid), ColorHealth[killCounter[playerid]], ColorHealth[killCounter[playerid]]);
  		format(str, sizeof(str), "~y~Car Armour: ~g~%d%", carHealth);
		GameTextForPlayer(playerid, str, 5000, 4);
		return 1;
	}
	return 0;
}
Reply
#2

Use a external explosion. I think theres one that doesn't damage players or a external way of finding the characters infront of the players and that.
Reply
#3

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
Use a external explosion. I think theres one that doesn't damage players or a external way of finding the characters infront of the players and that.
I tried explosions without a physical blast, but they don't damage the car either.
Reply
#4

pawn Код:
CreateExplosion(Float:X, Float:Y, Float:Z, 13, Float:radius)
CreateExplosion(Float:X, Float:Y, Float:Z, 12, Float:radius)
And

pawn Код:
SetVehicleHealth
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)