ID:1758985
 
Keywords: movement, player, stop
(See the best response by PolskiPolakPL.)
Code:
TakeDmg(D)
Hp = Hp - D
if(Hp < 1)
view() << "[src] fell gravely unconscious"//styling of this part is removed so it dose not make post red xD
//stop move
unconscious = !unconscious



Stop player movement

here is a small snippet if my code that handles taking damage
basically i want the player to be knocked unconscious then they can be ether
Saved, killed or looted and then killed etc

the problem i am having is i don't know how to stop the player from moving(it would need to go in where //stop move is) a small code example would be very much appreciated i find i learn quicker by seeing code and being able to pull it apart and play with it working thank you in advance!
</1>
Best response
I thing good way is

mob/Move()
if(src.icon_state=="Knocked") return//if mob icon_state=="Knocked", then mob cant move.
return ..()

and in your code you must change mob icon_state

mob/proc
TakeDamage(var/mob/M,var/DMG)
if(src.HP<=0) {src<<"Your HP is lower than 0!";return}
src.HP-=DMG
oview(src)<<"[M] attacked you for [DMG] damage."
src.KnockedOut()


KnockedOut()
if(src.icon_state=="Knocked") return
if(src.HP<=1) src.icon_state="Knocked"


Sorry for my poor english.
Thanks this post really helped but the ! mark oparator is not needed and breaks things ?

Move()
if(src.icon_state=="x_x") return
return ..()
In response to Fxstriker
It definitely isn't needed.
Oh, sorry! i know. I edited this code and i forgot remove "!". sorry...
Thanks again, you gave me the right idea of how to proceed with things :)