Permalink
Browse files

Only change the health of the player next to a bomb if godmode is dis…

…abled.
  • Loading branch information...
xhoogland committed Feb 6, 2017
1 parent a72a841 commit e885c34425b96891dec394ed4da458bcbeb166af
Showing with 15 additions and 10 deletions.
  1. +15 −10 pawn/Elements/Player/BombShop.pwn
@@ -105,7 +105,6 @@ CBomb__CheckPlayer(i)
}
#endif
- // Player using their /inf car can't add a bomb because of abuse
if (!IsPlayerInMainWorld(i)) {
ShowBoxForPlayer(i, "Sorry, the BombShop is only available in the main world. Use /world 0!");
RemovePlayerFromBombShop(i);
@@ -487,7 +486,7 @@ CBomb__EngineCheck(playerid,vehicleid,i)
DisarmVehicle(vehicleid,1,i); // explode the vehicle ;)
new str[256];
format(str,256,"Your vehicle engine bomb exploded on %s.",PlayerName(playerid));
- SetPlayerHealth(playerid, 0);
+ SetPlayerHealthIfGodmodeDisabled(playerid, 0);
if (playerid != VehicleBomb[vehicleid][armer]) {
validKillerId[playerid] = VehicleBomb[vehicleid][armer];
@@ -878,28 +877,28 @@ DisarmVehicle(vehicleid, explode=1, i=-1)
switch(VehicleBomb[vehicleid][ExplosionType])
{
case EXPLODE_TYPE_SMALL: {
- SetPlayerHealth(i, hp-40);
+ SetPlayerHealthIfGodmodeDisabled(i, hp-40);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
}
}
case EXPLODE_TYPE_MEDIUM: {
- SetPlayerHealth(i, hp-80);
+ SetPlayerHealthIfGodmodeDisabled(i, hp-80);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
}
}
case EXPLODE_TYPE_LARGE: {
- SetPlayerHealth(i, 0);
+ SetPlayerHealthIfGodmodeDisabled(i, 0);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
}
}
case EXPLODE_TYPE_MASSIVE: {
- SetPlayerHealth(i, 0);
+ SetPlayerHealthIfGodmodeDisabled(i, 0);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
@@ -928,28 +927,28 @@ DisarmVehicle(vehicleid, explode=1, i=-1)
switch(VehicleBomb[vehicleid][ExplosionType])
{
case EXPLODE_TYPE_SMALL: {
- SetPlayerHealth(i, hp-40);
+ SetPlayerHealthIfGodmodeDisabled(i, hp-40);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
}
}
case EXPLODE_TYPE_MEDIUM: {
- SetPlayerHealth(i, hp-80);
+ SetPlayerHealthIfGodmodeDisabled(i, hp-80);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
}
}
case EXPLODE_TYPE_LARGE: {
- SetPlayerHealth(i, 0);
+ SetPlayerHealthIfGodmodeDisabled(i, 0);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
}
}
case EXPLODE_TYPE_MASSIVE: {
- SetPlayerHealth(i, 0);
+ SetPlayerHealthIfGodmodeDisabled(i, 0);
if (i != VehicleBomb[vehicleid][armer]) {
validKillerId[i] = VehicleBomb[vehicleid][armer];
validReasonId[i] = WEAPON_EXPLOSION;
@@ -1002,3 +1001,9 @@ IsVehicleBombShopValid(vehicleid)
}
return 1;
}
+
+// Helper function which changes the health of a player in case godmode is DISABLED
+SetPlayerHealthIfGodmodeDisabled(playerId, Float:healthAmount) {
+ if (!g_bPlayerGodmode[playerId])
+ SetPlayerHealth(playerId, healthAmount);
+}

0 comments on commit e885c34

Please sign in to comment.