PDA

View Full Version : Warnning: express has no effect


Mavis100
15/05/2014, 02:10 PM
public OnVehicleHealthChange(vehicleid, Float:vehicle_newhealth, Float:vehicle_oldhealth)
{
new
myArray[92], lasthealth;
if(vehicle_newhealth < vehicle_oldhealth)
{
foreach(Player, u)
{
lasthealth == (vehicle_health_loss - vehicle_newhealth);
if(IsPlayerInVehicle(u, vehicleid) && GetPlayerState(u) == PLAYER_STATE_DRIVER)
{
if(vehicle_newhealth > 550 && vehicle_newhealth < 649)
{
format(myArray, sizeof(myArray), "damage @ vehicleID:%i, newhealth:%.3f, oldhealth:%.3f, difference:%.3f, BatteryL: %d EngineL:%d", vehicleid, vehicle_newhealth, vehicle_oldhealth, (vehicle_oldhealth - vehicle_newhealth), VehicleInfo[vehicleid][carBatteryL], VehicleInfo[vehicleid][carEngineL]);
SendClientMessage(u, 0xFFFFFFFF, myArray);
VehicleInfo[vehicleid][carBatteryL] -= (lasthealth/125.0);
VehicleInfo[vehicleid][carEngineL] -= (lasthealth/150.0);
}
else if(vehicle_newhealth > 390 && vehicle_newhealth < 549)
{
format(myArray, sizeof(myArray), "damage @ vehicleID:%i, newhealth:%.3f, oldhealth:%.3f, difference:%.3f, BatteryL: %d EngineL:%d", vehicleid, vehicle_newhealth, vehicle_oldhealth, (vehicle_oldhealth - vehicle_newhealth), VehicleInfo[vehicleid][carBatteryL], VehicleInfo[vehicleid][carEngineL]);
SendClientMessage(u, 0xFFFFFFFF, myArray);
VehicleInfo[vehicleid][carBatteryL] -= (lasthealth/100.0);
VehicleInfo[vehicleid][carEngineL] -= (lasthealth/125.0);
}
else if(vehicle_newhealth > 250 && vehicle_newhealth < 389)
{
format(myArray, sizeof(myArray), "damage @ vehicleID:%i, newhealth:%.3f, oldhealth:%.3f, difference:%.3f, BatteryL: %d EngineL:%d", vehicleid, vehicle_newhealth, vehicle_oldhealth, (vehicle_oldhealth - vehicle_newhealth), VehicleInfo[vehicleid][carBatteryL], VehicleInfo[vehicleid][carEngineL]);
SendClientMessage(u, 0xFFFFFFFF, myArray);
VehicleInfo[vehicleid][carBatteryL] -= (lasthealth/75.0);
VehicleInfo[vehicleid][carEngineL] -= (lasthealth/100.0);
VehicleInfo[vehicleid][carBroken] = 1;
}
break;
}
}
}
return true;
}

Mavis100
15/05/2014, 02:21 PM
lasthealth and vehicle_health_loss is not a float

Mavis100
15/05/2014, 03:38 PM
BUMP

BroZeus
15/05/2014, 03:46 PM
which line has the error please specify it

caoraivoso3
15/05/2014, 03:58 PM
lasthealth == (vehicle_health_loss - vehicle_newhealth);

to
lasthealth = (vehicle_health_loss - vehicle_newhealth);


an error that i see

Mavis100
15/05/2014, 06:13 PM
lasthealth == (vehicle_health_loss - vehicle_newhealth);

to
lasthealth = (vehicle_health_loss - vehicle_newhealth);


an error that i see

new error: warning 213: tag mismatch
Here is definition of vehicle_health_loss: new vehicle_health_loss = 1000;

ball
15/05/2014, 06:16 PM
Check this.

lasthealth = vehicle_health_loss - floatround(vehicle_newhealth);

Mavis100
15/05/2014, 06:23 PM
Check this.

lasthealth = vehicle_health_loss - floatround(vehicle_newhealth);

It says never used lasthealth

Konstantinos
15/05/2014, 06:43 PM
Declare "lasthealth" as float.