OnPlayerFall

Started by Nihongo^, Jul 23, 2023, 07:40 AM

Previous topic - Next topic

Nihongo^

In 0.3, there's a function named "OnPlayerFall."

when a player fell down ( from the building or someone shot him with Stuby or shotgun etc.)

I just realized that 0.4 no longer supports it; I would like to ask if there is any alternative to this function.

I use it, but nothing seems to appear.


}
function onPlayerFall(player)
{
    MessagePlayer("You fall down");
}

 

Nihongo^


vitovc

not works as fall from building but works with bike fall or explosion fall
function onPlayerActionChange(player, old_action, new_action){
  if(42 == new_action){
    ::MessagePlayer("You fall down", player);
  }
}
...::: vice city :::...

habi

Quote from: vitovc on Jul 23, 2023, 01:33 PMfunction onPlayerActionChange(player, old_action, new_action){
  if(42 == new_action){
    ::MessagePlayer("You fall down", player);
  }
}
Why you used :: ?
I think it is not needed as you are not inside any class.

Nihongo^

#4
Quote from: vitovc on Jul 23, 2023, 01:33 PMnot works as fall from building but works with bike fall or explosion fall
function onPlayerActionChange(player, old_action, new_action){
  if(42 == new_action){
    ::MessagePlayer("You fall down", player);
  }
}
Thanks its work,
There's a lot of action id's
may i know the list?

newAction == 12
newAction == 13
and what to do for falling from buildings?
etc

vitovc

#5
Quote from: Nihongo^ on Jul 23, 2023, 02:44 PMThanks its work,
There's a lot of action id's
may i know the list?

newAction == 12
newAction == 13
and what to do for falling from buildings?
etc
There is no action ID for falling from building. So you have to code that yourself by some logic.
  0 - none
  1 - normal
  12 - aiming (fpv)
  16 - shooting/attack
  17 - cold weapon attack (not bullets)
  24 - running to car to sit-in (before onPlayerEnteringVehicle event) - its found by me (vito)
  41 - jumping
  42 - lying on ground
  43 - getting up
  44 - jumping from vehicle
  50 - driving
  54 - dying
  55 - wasted
  58 - entering vehicle
  60 - exiting vehicle
Quote from: habi on Jul 23, 2023, 02:03 PMWhy you used :: ?
I think it is not needed as you are not inside any class.
maybe but usually I code as objects/tables so I keep using :: for everything from root table, also for global variables in functions/events.I think it should be faster since its not looking for local one before.
...::: vice city :::...

habi

Quote from: vitovc on Jul 24, 2023, 06:42 AMmaybe but usually I code as objects/tables so I keep using :: for everything from root table, also for global variables in functions/events. I think it should be faster since its not looking for local one before.
oh okay

2b2ttianxiu

maybe i can make a good combat tracker and then detect death evade or death message