11.10.2010, 08:21
(
Последний раз редактировалось Sinner; 11.10.2010 в 08:45.
)
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)
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; }