• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Not receiving damage when player fell onto the ground
#1
I get this error


Code:
C:\Users\User\Desktop\rsrp\gamemodes\RSRP.pwn(1361) : warning 202: number of arguments does not match definition

C:\Users\User\Desktop\rsrp\gamemodes\RSRP.pwn(1378) : warning 213: tag mismatch




Code:
forward OnPlayerFall(playerid);
forward CalculateDamage(Float:fall_height);

public OnPlayerFall(playerid) {
    new Float:fall_height;
    GetPlayerDistanceFromPoint(playerid, 2.0, 2.0, 2.0, fall_height);

    new damage = CalculateDamage(fall_height);

    // Apply damage to the player
    SetPlayerHealth(playerid, GetPlayerHealth(playerid) - damage);

    // You can also send a message to the player informing them about the damage
    SendClientMessage(playerid, COLOR_RED, "You took damage from the fall!");
    return 1;
}

// 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
    return (fall_height - 2.0) * 2 + 5; // Damage increases linearly with fall height beyond 2 meters
}



please help to fix
  Reply


Messages In This Thread
Not receiving damage when player fell onto the ground - by Sizy - 2024-05-01, 02:49 AM

Forum Jump: