Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
		
		
		
		05.12.2017, 07:12 
(
 Last edited by Romz; 05/12/2017 at 07:54 AM.
)
	
	 
	
		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.
	
		
	
 
 
	
	
	
		
	Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
	
		
Quote:
| 
					Originally Posted by BeckzyBoi  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.
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
	
		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;
}
 
	
		
	
 
 
	
	
	
		
	Posts: 1,290
	Threads: 69
	Joined: Dec 2006
	
Reputation: 
0
	 
	
	
		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?
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
	
		
Quote:
| 
					Originally Posted by BeckzyBoi  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?
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
	
		Video:
PS: I do not use cheats myself, cheats help me in writing anticheat.
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
	
		
Quote:
| 
					Originally Posted by Jelly23   | 
 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.
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,605
	Threads: 61
	Joined: Jul 2012
	
Reputation: 
0
	 
	
	
		Did you debug just this callback or others?
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
	
		
Quote:
| 
					Originally Posted by Locky_  Did you debug just this callback or others? | 
 I did not quite understand the essence of the question.
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,042
	Threads: 46
	Joined: Jun 2013
	
	
 
	
	
		
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.