SA-MP Forums Archive
How to detect this? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to detect this? (/showthread.php?tid=620327)



How to detect this? - Unrea1 - 29.10.2016

Hello how about ...

I was thinking how to make a system, which consists is to throw a smoke bomb (weapon id 17) and the person who is close to it is applied animation when you check spray paint the face of a character (which by the way, I'm also looking for entertainment but can not find it). Thanks in advance.


Re: How to detect this? - SickAttack - 29.10.2016

Have you tried anything?


Respuesta: How to detect this? - Unrea1 - 29.10.2016

Nope, I do not know how to detect smoke bomb :/


Respuesta: How to detect this? - Unrea1 - 29.10.2016

Up !


Re: How to detect this? - Dignity - 29.10.2016

Check for damages done by weapon ID 17?


Respuesta: Re: How to detect this? - Unrea1 - 29.10.2016

Quote:
Originally Posted by Dignity
Посмотреть сообщение
Check for damages done by weapon ID 17?
That's the problem, smoke bomb does not cause damage.


Re: How to detect this? - ThatFag - 29.10.2016

Well as far as i know you can make damage for it.
check the weapon if the player has an smoke bomb then set it health to X amount you want to take .. or you dont want that.


Re: How to detect this? - Gammix - 29.10.2016

Only way i can think right now is making a physics simulation when player throws the bomb. Also taking care of player actually throwing the bomb and at how much force which can be checked using OnPlayerKeyStateChange and OnPlayerUpdate. You can use physics include for simulation purpose.


Respuesta: Re: How to detect this? - Unrea1 - 29.10.2016

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Only way i can think right now is making a physics simulation when player throws the bomb. Also taking care of player actually throwing the bomb and at how much force which can be checked using OnPlayerKeyStateChange and OnPlayerUpdate. You can use physics include for simulation purpose.
I think you've given me an idea, but...

Using this function, for example, how many meters or centimeters would have to increase for each update OnPlayerUpdate?

Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
	// Created by ******

	new Float:a;

	GetPlayerPos(playerid, x, y, a);
	GetPlayerFacingAngle(playerid, a);

	if (GetPlayerVehicleID(playerid)) {
	    GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
	}

	x += (distance * floatsin(-a, degrees));
	y += (distance * floatcos(-a, degrees));
}



Re: How to detect this? - Spmn - 29.10.2016

You should calculate the distance based on a formula:
Код:
DIST = (LMBReleaseTime-LMBPressTime) * X;
rather than increasing distance at every player update