Detect invincible vehicle ?
#1

Hi guys,

I want to know if there is a reliable way to detect whether a vehicle (with one player driving) is invincible?

Thank you all for your replies
Reply
#2

Well, most likely you have to check it's HP first. If it's greater than 1000.0, then the player should be banned. However, a smarter hack might use the vehicle's HP to it's advantage(so the hack can't be detected), and if the vehicle's HP it's less than 1000.0, it immediatly repairs/restores the vehicle's health back to 1000.0(so, yeah, same as the previous hack, just smarter).

In that case you should script a timer FOR EACH individual vehicle in the server(don't loop through them in a single timer). First of all, you're first checking if the vehicle has a driver. When you find the desired vehicle, check it's HP. If it's less than 1000, then store that variable(or somehow remember the vehicle). When the timer executes again for that vehicle, if it's HP is 1000, then you should ban the player. HOWEVER, you also need to check if they are not in range of modding garages, or Pay n Sprays. You might ban him for sparying his vehicle. So, yeah, seems hard, but it's not that hard.
Reply
#3

something like this?
pawn Код:
new Timer;
CheckVehicle(vehid)
{
     new Float:health;
    GetVehicleHealth(vehid, health);
     SetVehicleHealth(vehicleid, 998);
     if(Timer !-1) KillTimer(Timer);
     Timer = SetTimerEx("Check", 1200, false,"ii",vehicleid,health);//give it 1 sec to change
}
forward Check(vehid,oldhealth);
public Check(vehid,oldhealth){
    new Float:health;
    GetVehicleHealth(vehid, health);
    if(health<=998 && health >= 980)
    {
        SetVehicleHealth(vehid, oldhealth);
        return 1;//vehicle's Health not changed!
    }else{
        return 0;//vehicle's Health changed!
    }
}
Reply
#4

You can see vehicles health and if its bigger then 999.9
Reply
#5

I figured out how to detect when the player returns to the life his vehicle but what I want is a way to detect when the player takes the example colission with another vehicle but the vehicle does not lose life.

I hope you understand!
Reply
#6

You lot don't understand his question.

He wants to make it so if people shoot his car / he crashes it and he doesn't get damaged = hacks.

Although I think it is pretty impossible. ^
Reply
#7

pawn Код:
new Float:vehiclehealth[MAX_VEHICLES];
new Float:playerhealth[MAX_PLAYERS];
new Float:playerarmor[MAX_PLAYERS];

forward CheckPlayerGodMode(playerid);
public CheckPlayerGodMode(playerid)
{
    new Float:health, Float:armor, Float:vehhealth;
    new veh = GetPlayerVehicleID(playerid);
    GetVehicleHealth(veh, vehhealth);
    if(vehiclehealth[veh] != vehhealth)
    {
        GetPlayerHealth(playerid,health);
        GetPlayerArmour(playerid,armor);
        if((playerhealth[playerid] == health) || (playerarmor[playerid] == armor))
        {
            //Player has godmode. What to do?
        }
        else
        {
            //player doesn't cheat
        }
        playerhealth[playerid] = health;
        playerarmor[playerid] = armor;
        return 1;
    }
    vehiclehealth[veh] = vehhealth;
    return 1;
}
NOT TESTED!
Also, this script is simple so if anyone repairs the car in a pay'n'spray, it would show up as cheat. Fix:

switch
pawn Код:
if(vehiclehealth[veh] != vehhealth)
to
pawn Код:
if(vehiclehealth[veh] > vehhealth)
Reply
#8

The problem is that the life of my vehicle and the same as the player's life (I script a derby)
Reply
#9

so, the player has MAX 1000 health ?
because the vehicle cant have MAX 100 as it will explode straight away.

if that's the case the code should work
Reply
#10

Код:
forward UpdateVieVehicule();
public UpdateVieVehicule()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
		{
            new Float:health;
            GetVehicleHealth(GetPlayerVehicleID(i),health);
            health = (health - 250.0) * (100.0/ 750.0);
            SetPlayerHealth(i,health);
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)