[Pawn] Not receiving damage when player fell onto the ground - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] Not receiving damage when player fell onto the ground (/showthread.php?tid=2707) |
Not receiving damage when player fell onto the ground - Sizy - 2024-05-01 I get this error Code: C:\Users\User\Desktop\rsrp\gamemodes\RSRP.pwn(1361) : warning 202: number of arguments does not match definition Code: forward OnPlayerFall(playerid); please help to fix RE: Not receiving damage when player fell onto the ground - Sizy - 2024-05-01 anyone guys? RE: Not receiving damage when player fell onto the ground - carl_anderson - 2024-05-03 open up documentation https://www.open.mp/docs/scripting/functions/GetPlayerDistanceFromPoint you have Code: GetPlayerDistanceFromPoint(playerid, 2.0, 2.0, 2.0, fall_height); Code: new Float:fall_height = GetPlayerDistanceFromPoint(playerid, 2.0, 2.0, 2.0); also this code doesnt make sense, cause why you want to find player distance from 2.0, 2.0, 2.0 point? RE: Not receiving damage when player fell onto the ground - Sizy - 2024-05-04 uhmm can you please type the whole correct code so i can just copy and paste? RE: Not receiving damage when player fell onto the ground - carl_anderson - 2024-05-04 (2024-05-04, 11:49 AM)Sizy Wrote: uhmm can you please type the whole correct code so i can just copy and paste?Do you have reading disability? RE: Not receiving damage when player fell onto the ground - Sizy - 2024-05-04 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 RE: Not receiving damage when player fell onto the ground - carl_anderson - 2024-05-05 (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 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 RE: Not receiving damage when player fell onto the ground - Sizy - 2024-05-05 it doesn't work in game bro, what should I do to this Code: forward OnPlayerFall(playerid); RE: Not receiving damage when player fell onto the ground - carl_anderson - 2024-05-05 (2024-05-05, 10:56 AM)Sizy Wrote: it doesn't work in game bro, what should I do to this Well you autogenerated this code with chatGpt and it doesn't work for obvious reasons. First you should think what you want to achieve even. You want to detect, when player is falling, so how you would achieve that? There is actually many ways todo it, but yeah you should yourself first think how todo it. Maybe you can look what animation player has. So steps are Create timer or use OnPlayerUpdate call. Check player animation. - open.mp/docs/scripting/functions/GetPlayerAnimationIndex - https://www.open.mp/docs/scripting/resources/animations If animation equals falling, then apply damage for example RE: Not receiving damage when player fell onto the ground - carl_anderson - 2024-05-05 Created code, what you can try for falling detection Code: // indicates if player is falling or not RE: Not receiving damage when player fell onto the ground - Sizy - 2024-05-06 check my PM bro |