Results 1 to 5 of 5
  1. #1
    zylixel's Avatar
    Join Date
    Feb 2017
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0
    My Mood
    Confused

    Detecting Player Motion

    Is there any way to detect if the player is in motion? For Example, if the player is not in motion, give them Damaging?

  2. #2
    FlutterM4rk's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Posts
    365
    Reputation
    16
    Thanks
    228
    My Mood
    Sleepy
    if the player stopped sending move packets since the last tick (you might want to add a grace period) => motion stopped (take away buff)
    if the player sends move packets constantly => in motion
    if the player didn't send a move packet last tick, but he sent one just now => motion starting (apply buff)
    this is very inefficient btw, i just told you the core of it, there are many optimizations that could be done (like making the whole thing not tick based, or at least stopping the loop while the player isn't in motion)

  3. #3
    SlickEashy's Avatar
    Join Date
    Jul 2014
    Gender
    male
    Location
    Under the Ocean
    Posts
    213
    Reputation
    21
    Thanks
    521
    My Mood
    Relaxed
    Quote Originally Posted by FlutterM4rk View Post
    if the player stopped sending move packets since the last tick (you might want to add a grace period) => motion stopped (take away buff)
    if the player sends move packets constantly => in motion
    if the player didn't send a move packet last tick, but he sent one just now => motion starting (apply buff)
    this is very inefficient btw, i just told you the core of it, there are many optimizations that could be done (like making the whole thing not tick based, or at least stopping the loop while the player isn't in motion)
    There is an issue with that, the player sends a move packet every tick even if the player didn't move.

  4. #4
    Extain's Avatar
    Join Date
    Feb 2015
    Gender
    male
    Posts
    139
    Reputation
    10
    Thanks
    13
    Basically just create a variable called lastLocation, set it to the position before the player started moving, and check if lastLocation = position for a certain amount of time. Then, apply the buff, else remove the buff.

  5. #5
    Invader_Zim's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Location
    Atlas 2
    Posts
    546
    Reputation
    10
    Thanks
    300
    My Mood
    Tired
    Quote Originally Posted by zylixel View Post
    Is there any way to detect if the player is in motion? For Example, if the player is not in motion, give them Damaging?
    Where are you trying to implement this? It can easily be created as a behavior, if you're trying to make an ability then best of luck.

    My weapon is a backpack.

Similar Threads

  1. [Detected] Red and Blue player models [Never detected] By kila58 | Beta
    By kila58 in forum Counter-Strike 2 Hacks
    Replies: 173
    Last Post: 04-26-2014, 03:09 AM
  2. [Help Request] Player height and User aiming location detection(Pro-Bot)(Java)
    By lolkittens in forum Call of Duty Modern Warfare 3 Help
    Replies: 0
    Last Post: 02-03-2012, 01:49 PM
  3. [Release] Stupid MAT players make Automaton Detected!
    By NaZi~C0DerZ~ in forum Mission Against Terror Discussions
    Replies: 35
    Last Post: 07-12-2011, 03:52 AM
  4. [Question]How to detect if the player hits ground?
    By NOOBJr in forum Combat Arms Coding Help & Discussion
    Replies: 12
    Last Post: 03-16-2011, 06:02 AM
  5. [Help] Detecting player hits and timers!
    By master131 in forum Call of Duty Modern Warfare 2 Help
    Replies: 0
    Last Post: 08-24-2010, 06:28 PM