Brutally Wounded System -
AidanRO - 08.05.2017
Hello, I'd like to know what I am doing wrong with my system. Long-story-short I just wanted to create a brutally wounded system, a basic one. So, it goes like this: I set every player to be on the same team so I can use custom damages for every weapon for better handling and so on. I introduced the Deagle and had it to do -25 damage per shot. When the player has 25 HP or less, he would be put in an animation and frozen onto the ground. The first problem itself is that the player can't move his camera (and this is kinda annoying for me tbh) because of the TogglePlayerControlable, and the second problem is that once the player gets shot again (because he's brutally wounded, he'd get killed after being shot one more time) he would be shown for other players as he stopped from doing his animation.
TL; DR: I want to fix the TogglePlayerControllable issue so the player will be able to move his camera. And I want to fix the animation problem where he'd be shown as stopping his animation for the other players (aka just standing).
Код:
public OnPlayerTakeDamage( playerid, issuerid, Float: amount, weaponid, bodypart ){
new
Float: health,
Float: armour ;
GetPlayerHealth( playerid, health ) ;
GetPlayerArmour( playerid, armour ) ;
if( health > 25 ){
if( GetPlayerWeapon( issuerid ) == 24 ){
SetPlayerHealth( playerid, health-25 ) ;
}}else if( health <= 25 && GetIntVar( playerid, "BrutallyWounded" ) == 0 ) {
TogglePlayerControllable( playerid, 0 ) ;
ApplyAnimation( playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 1, 1, 300000, 1 ) ;
SetIntVar( playerid, "BrutallyWounded", 1 ) ;
SCM( playerid, -1, "DEBUG: You are now in BW mode." ) ;
SCM( issuerid, -1, "DEBUG: Your victim is now in BW mode." ) ;
}
return 1;
}
public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ ) {
if( hittype == BULLET_HIT_TYPE_PLAYER ){
new
Float: health,
Float: armour ;
GetPlayerHealth( hitid, health ) ;
GetPlayerArmour( hitid, armour ) ;
if( health <= 25 && GetIntVar( hitid, "BrutallyWounded" ) == 1 ) {
SetIntVar( hitid, "BrutallyWounded", 2 ) ;
SCM( hitid, -1, "DEBUG: You are now dead." ) ;
SCM( playerid, -1, "DEBUG: Player is now dead." ) ;
}
}
return 1;
}
Re: Brutally Wounded System -
DTV - 08.05.2017
As for the first issue, you'd have to find a include/plugin that has a function like TogglePlayerControllable but only freezes the player and not their camera. You could also try making a function yourself that does what you want, but I've never tried it so I can't help you there.
For the second one, I'm not too sure due to possible sync issues, but you could try replacing it with this.
pawn Код:
ApplyAnimation( playerid, "WUZI", "CS_Dead_Guy", 4.1, 0, 0, 1, 1, 0, 1 ) ; //putting 0 for the timer will make it a never ending loop
Re: Brutally Wounded System -
Kane - 08.05.2017
Use OnPlayerUpdate.
Check if the player is in BrutallyWounded and call the animation. Using that, you can remove TogglePlayerControllable and they won't be able to move.
That's how I do it on my script n it works fine without problems.
Re: Brutally Wounded System -
AidanRO - 08.05.2017
@DTV 's fix worked for the animation problem. As for the OnPlayerUpdate fix that you suggested, Arthur, wouldn't the animation replay over and over? I mean, it would look like the player loops through the animation over and over. (standing, going down, standing, going down)
Re: Brutally Wounded System -
Kane - 08.05.2017
No, it doesn't do that.
Re: Brutally Wounded System -
AidanRO - 08.05.2017
Thanks a lot. The problem has been fixed entirely. Thanks to DTV and Arthur. +rep to both of you.