21.08.2010, 05:12
Full code at 2 warning's:
Код:
public VehicleDamageToPlayerHealth(playerid, vehicleid) { if (IsPlayerInVehicle(playerid,vehicleid)) { if(Seatbelt[playerid] == 1) { GetVehicleHealth(vehicleid, VehicleHealthStack[vehicleid][0]); if (floatcmp(VehicleHealthStack[vehicleid][0], VehicleHealthStack[vehicleid][1]) == -1) { GetPlayerHealth(playerid, VehicleHealthStack[vehicleid][2]); SetPlayerHealth(playerid, floatsub(VehicleHealthStack[vehicleid][2], 6)); if(GetPlayerHealth(playerid) >= 1) { SendClientMessage(playerid,COLOR_CORAL,"You are shook up from the collision."); SendClientMessage(playerid,COLOR_CORAL,"Luckily, you were wearing your seatbelt and may continue driving."); } else { SendClientMessage(playerid,COLOR_CORAL,"Your stamina was in bad condition and the force of the collision knocked you out."); GameTextForPlayer(playerid,"~r~Out ~w~cold",4000,1); } } VehicleHealthStack[vehicleid][1] = VehicleHealthStack[vehicleid][0]; return 1; } else { GetVehicleHealth(vehicleid, VehicleHealthStack[vehicleid][0]); if (floatcmp(VehicleHealthStack[vehicleid][0], VehicleHealthStack[vehicleid][1]) == -1) { GetPlayerHealth(playerid, VehicleHealthStack[vehicleid][2]); SetPlayerHealth(playerid, floatsub(VehicleHealthStack[vehicleid][2], 45)); if(GetPlayerHealth(playerid) >= 1) { SendClientMessage(playerid,COLOR_CORAL,"You are shook up from the collision."); SendClientMessage(playerid,COLOR_CORAL,"You can not continue driving, as you are frozen from shock. Buckle up, next time."); TogglePlayerControllable(playerid, 0); TimerStack = SetTimerEx("DisablePlayerKnockout",3500,1,"i",playerid); } else { SendClientMessage(playerid,COLOR_CORAL,"Your stamina was in bad condition and the force of the collision knocked you out."); GameTextForPlayer(playerid,"~r~Out ~w~cold",4000,1); } } VehicleHealthStack[vehicleid][1] = VehicleHealthStack[vehicleid][0]; return 1; } } return 1; }