SA-MP Forums Archive
Anti Vehicle-Repair. - 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: Anti Vehicle-Repair. (/showthread.php?tid=538937)



Anti Vehicle-Repair. - AfikAtashga - 25.09.2014

Hey, i started to develop an anti-cheat.
In Anti-Health hack i used with OnPlayerTakeDamage to check if play fallen, Get heat or something else,
but i cant do it in vehicle.
I can make a check if player shooting, has i did. But if player crash into a wall?

Don't tell me about OnVehicleDamageStatusUpdate because this public not called in VEHICLE HEALTH CHANGES.
And don't tell me to do timer, because it just don't work.

Help?


Re: Anti Vehicle-Repair. - AfikAtashga - 25.09.2014

UP..


Re: Anti Vehicle-Repair. - Jefff - 25.09.2014

OnVehicleDamageStatusUpdate and try to use GetVehicleHealth(vehicleid, &Float:health);


Re: Anti Vehicle-Repair. - AfikAtashga - 25.09.2014

Quote:
Originally Posted by Jefff
Посмотреть сообщение
OnVehicleDamageStatusUpdate and try to use GetVehicleHealth(vehicleid, &Float:health);
Do even read what i wrote? I SAID THAT OnVehicleDamageStatusUpdate This does not include vehicle health changes


Re: Anti Vehicle-Repair. - Hanger - 25.09.2014

Timers work. The Only Way Is Timer - TOWIT


Re: Anti Vehicle-Repair. - Jefff - 25.09.2014

or OnPlayerUpdate


Re: Anti Vehicle-Repair. - AfikAtashga - 25.09.2014

Quote:
Originally Posted by Jefff
Посмотреть сообщение
or OnPlayerUpdate
And what should i made over there? It's not even close to what i need.
I need a public that has a same work of OnPlayerTakeDamage but for vehicle. So i can detect on player crash to something or something else.

Quote:
Originally Posted by Hanger
Посмотреть сообщение
Timers work. The Only Way Is Timer - TOWIT
And what i'll do in this timer?


Re: Anti Vehicle-Repair. - Jefff - 25.09.2014

Example

pawn Код:
new Float:vHealth[MAX_VEHICLES];
new OneSecond[MAX_PLAYERS];
OnPlayerUpdate

pawn Код:
static timee, ID;

timee = gettime();

if(OneSecond[playerid] < timee)
{
    OneSecond[playerid] = timee;
    ID = GetPlayerVehicleID(playerid);
    if(ID)
    {
        static Float:vHP;
        GetVehicleHealth(ID, vHP);
        if(vHP != vHealth[ID])
        {
            vHealth[ID] = vHP;
            // health changes
        }
    }
}



Re: Anti Vehicle-Repair. - Jimmy0wns - 25.09.2014

This would work if you had a gas station script that checks if you're near a gas station, check if the value is suddenly 100/1000 and check if he's at a gas station or not. If not, ban the player.


Re: Anti Vehicle-Repair. - AfikAtashga - 25.09.2014

Quote:
Originally Posted by Jimmy0wns
Посмотреть сообщение
This would work if you had a gas station script that checks if you're near a gas station, check if the value is suddenly 100/1000 and check if he's at a gas station or not. If not, ban the player.
Quote:
Originally Posted by Jefff
Посмотреть сообщение
Example

pawn Код:
new Float:vHealth[MAX_VEHICLES];
new OneSecond[MAX_PLAYERS];
OnPlayerUpdate

pawn Код:
static timee, ID;

timee = gettime();

if(OneSecond[playerid] < timee)
{
    OneSecond[playerid] = timee;
    ID = GetPlayerVehicleID(playerid);
    if(ID)
    {
        static Float:vHP;
        GetVehicleHealth(ID, vHP);
        if(vHP != vHealth[ID])
        {
            vHealth[ID] = vHP;
            // health changes
        }
    }
}
Those ways doesn't work.
The code you gave is to detect when health changed, but not if it become from crash, or fix or something else.
AGAIN, I need something like OnPlayerTakeDamage, for vehicle.