SA-MP Forums Archive
OnVehicleDeath - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP DL Edition (https://sampforum.blast.hk/forumdisplay.php?fid=92)
+--- Forum: SA-MP 0.3.DL (https://sampforum.blast.hk/forumdisplay.php?fid=90)
+--- Thread: OnVehicleDeath (/showthread.php?tid=645838)



OnVehicleDeath - Romz - 05.12.2017

Hello,
When a cheater attempts to make a respawn for vehicles (falsely call callback OnVehicleDeath), we can catch a cheater but can not prevent a respawn. I think that this is a global problem at the moment and we can not do anything about it.
I suggest adding for OnVehicleDeath the ability to prevent respawn if the value 0 is returned.

Code:
public OnVehicleDeath(vehicleid, killerid)
{
	new Float:health;
	GetVehicleHealth(vehicleid, health);
	if(health >= 250.0)
	{
		return 0; // we prevent respawn
	}
	return 1;
}
Video: https://www.youtube.com/watch?v=9QnbkqBbcQI

@Kalcor, please do not ignore this proposal, it is very important.


Re: OnVehicleDeath - beckzy - 05.12.2017

Quote:
Originally Posted by Romz
View Post
Hello,
When a cheater attempts to make a respawn for vehicles (falsely call callback OnVehicleDeath), we can catch a cheater but can not prevent a respawn. I think that this is a global problem at the moment and we can not do anything about it.
I suggest adding for OnVehicleDeath the ability to prevent respawn if the value 0 is returned.

Code:
public OnVehicleDeath(vehicleid, killerid)
{
	new Float:health;
	GetVehicleHealth(vehicleid, health);
	if(health >= 250.0)
	{
		return 0; // we prevent respawn
	}
	return 1;
}
@Kalcor, please do not ignore this proposal, it is very important.
I'm just wondering, what is a vehicle's health value after it enters water? OnVehicleDeath is called when a vehicle enters water, but I'm not sure if the health value is less than 250.0?


Re: OnVehicleDeath - Romz - 05.12.2017

Quote:
Originally Posted by BeckzyBoi
View Post
I'm just wondering, what is a vehicle's health value after it enters water? OnVehicleDeath is called when a vehicle enters water, but I'm not sure if the health value is less than 250.0?
When transport falls into the water, health remains the same.


Re: OnVehicleDeath - beckzy - 05.12.2017

Quote:
Originally Posted by Romz
View Post
When transport falls into the water, health remains the same.
Then in that case returning 0 in OnVehicleDeath if health is >= 250.0 won't really work, unless you don't want vehicles that fall in water to respawn.


Re: OnVehicleDeath - Romz - 05.12.2017

Using ColAndreas in this case will be more accurate.

Code:
public OnVehicleDeath(vehicleid, killerid)
{
	new Float:health, Float:depth, Float:vehicledepth;
	GetVehicleHealth(vehicleid, health);
	if(health >= 250.0 && !CA_IsVehicleInWater(vehicleid, depth, vehicledepth))
	{
		return 0; // we prevent respawn
	}
	return 1;
}
Code:
stock CA_IsVehicleInWater(vehicleid, &Float:depth, &Float:vehicledepth)
{
	new Float:x, Float:y, Float:z, Float:retx[10], Float:rety[10], Float:retz[10], Float:retdist[10], modelids[10];
	GetVehiclePos(vehicleid, x, y, z);
	new collisions = CA_RayCastMultiLine(x, y, z + 1000.0, x, y, z - 1000.0, retx, rety, retz, retdist, modelids, 10);
	if(collisions)
	{
		for(new i = 0; i < collisions; i++)
		{
			if(modelids[i] == WATER_OBJECT)
			{
				depth = INFINITY;

				for(new j = 0; j < collisions; j++)
				{
					if(retz[j] < depth)
					depth = retz[j];
				}

				depth = retz[i] - depth;
				if(depth < 0.001 && depth > -0.001)
				depth = 100.0;
				vehicledepth = retz[i] - z;

				if(vehicledepth < -2.0)
				return 0;

				return 1;
			}
		}
	}
	return 0;
}



Re: OnVehicleDeath - beckzy - 05.12.2017

I wouldn't know how these hacks work, so I'm just curious - do the vehicles actually explode or just respawn? I've seen hackers IG exploding vehicles, but I'm not sure if that's the hack you're referring to?


Re: OnVehicleDeath - Romz - 05.12.2017

Quote:
Originally Posted by BeckzyBoi
View Post
I wouldn't know how these hacks work, so I'm just curious - do the vehicles actually explode or just respawn? I've seen hackers IG exploding vehicles, but I'm not sure if that's the hack you're referring to?
I can record more detailed videos of how hackers do this. Would you like me to make a video?


Re: OnVehicleDeath - Romz - 05.12.2017

Video:

(Link)

PS: I do not use cheats myself, cheats help me in writing anticheat.


Re: OnVehicleDeath - Jelly23 - 05.12.2017

https://github.com/urShadow/Pawn.Rak...tiVehicleSpawn

Returning 0 at OnVehicleDeathRequest will prevent them from re-spawning.


Re: OnVehicleDeath - Romz - 05.12.2017

Quote:
Originally Posted by Jelly23
View Post
https://github.com/urShadow/Pawn.Rak...tiVehicleSpawn

Returning 0 at OnVehicleDeathRequest will prevent them from re-spawning.
I do not want to use a plug-in with a memory hack for 1 opportunity. Moreover, there is no guarantee that this plug-in will work after every update of the server version.


Re: OnVehicleDeath - Locky_ - 05.12.2017

Did you debug just this callback or others?


Re: OnVehicleDeath - Romz - 05.12.2017

Quote:
Originally Posted by Locky_
Посмотреть сообщение
Did you debug just this callback or others?
I did not quite understand the essence of the question.


Re: OnVehicleDeath - Locky_ - 05.12.2017

Quote:
Originally Posted by Romz
Посмотреть сообщение
I did not quite understand the essence of the question.
From what I saw in the video, when using cheating, OnVehicleDeath is called.
Usually cheatings call other callbacks. Example: OnPlayerStateChange

So I asked if you consulted the output of other callbacks when cheating is used.


Re: OnVehicleDeath - Romz - 05.12.2017

Quote:
Originally Posted by Locky_
Посмотреть сообщение
From what I saw in the video, when using cheating, OnVehicleDeath is called.
Usually cheatings call other callbacks. Example: OnPlayerStateChange

So I asked if you consulted the output of other callbacks when cheating is used.
Only OnVehicleDeath is called. When I catch a cheater, I kick him from the server. But all the same the vehicles respawn in a few seconds and this can not be stopped.


Re: OnVehicleDeath - stabker - 05.12.2017

Similar problem with this https://sampforum.blast.hk/showthread.php?tid=611060