• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Not receiving damage when player fell onto the ground
#7
(2024-05-04, 02:28 PM)Sizy Wrote: I get this error C:\Users\User\Desktop\rsrp\gamemodes\RSRP.pwn(61243) : warning 213: tag mismatch

from this line // Function to calculate damage based on fall height
public CalculateDamage(Float:fall_height) {
    if (fall_height <= 0.0) return 0;
    if (fall_height <= 2.0) return 5; // Minimum damage if fall height is less than or equal to 2 meters

this one below
    return (fall_height - 2.0) * 2 + 5; // Damage increases linearly with fall height beyond 2 meters

This line here returns float, but it should return only integers, to change that use floatround(), what converts float to integer.
Code:
floatround((fall_height - 2.0) * 2 + 5);

or if you want to return floats
Code:
forward Float:CalculateDamage
public Float:CalculateDamage
  Reply


Messages In This Thread
RE: Not receiving damage when player fell onto the ground - by carl_anderson - 2024-05-05, 09:24 AM

Forum Jump: