Detect damage (fire,explosion,fall)
#1

I was making a anti cheat, to remove INV/life hack...
So i made this new health (on server side):
Код:
new vida[MAX_PLAYERS];
Using OnPlayerGiveDamage i've chaged all weapon damage, but now i have a problem...
There is 3 things left:
- Player on Fire damage (fire like when you get a damage from molotov or get on fire after car explosion)
- Player explosion damage (car,rpg all explosions)
- Fall damage

Anyone know how to detect this 3 ways, because my server just removing vida[playerid] OnPlayerGiveDamage and i need to change it...

If someone have the same problem or want to make on this way to remove hacks i've made this callback to remove health on fall (it's a shit, but better then nothing)
Код:
DanoQueda(playerid) {
	new danoqueda, dmgstring[10], anim = GetPlayerAnimationIndex(playerid);
	if(anim == 1029) { danoqueda = 10; }
	else if(anim == 1208) { danoqueda = 20; }
	else if(anim == 1129) { danoqueda = 5; }
	if(danoqueda > 0) {
		vida[playerid] -= danoqueda;
		ultimoplayerquemedeudano[playerid] = playerid;
		ultimaarmaquemedeudano[playerid] = 54;
		ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff", 4.1, 0, 1, 1, 0, 0);
		SetTimerEx("StopAnim", 1500, false, "i", playerid);
	}
}
Reply
#2

You can use OnPlayerTakeDamage and check if he received damage from a fire source like, molotov is ID 18, 37 is flamethrower.
Reply
#3

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
You can use OnPlayerTakeDamage and check if he received damage from a fire source like, molotov is ID 18, 37 is flamethrower.
He was mean if player is on fire like this:
Reply
#4

- Debug OnPlayerTakeDamage to see what SA:MP gives to you when a player is set to fire or damaged by an explosion.
- For fall damage you have to use OnPlayerUpdate and work with player velocity.

You can use this: https://github.com/oscar-broman/samp-weapon-config
You'll find some bugs, but most of them are easy to fix.
Reply
#5

I found a way to detect it, if someone got the same problem
Here is how i've fixed:
Код:
OnPlayerTakeDamage.
Код:
	if(weaponid == 54) {
		// fall
	}
	else if(weaponid == 51) { // explosгo
		// explosion
	}
	else if(weaponid == 37) { // ta pegando fogo bixo
		// player onfire
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)