SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 06/08/2011, 04:29 PM   #1
KoczkaHUN
Huge Clucker
 
KoczkaHUN's Avatar
 
Join Date: Jan 2010
Posts: 498
Reputation: 100
Default Anti ESC Bug

Anti Escape Bug FilterScript 0.1
I think everyone know the esc-vehicle bug, when you are a passenger, you press escape (or minimize the game).
The driver drives 100 kilometres, gets out of the vehicle, and you're in the vehicle. But when you press escape again, to see where you are, you get teleported back to where you were before you pressed escape (with the vehicle).

With this filterscript, you can now get rid of those situations. The vehicle will be set to the position where it was when the driver got out from that.

Bugs:
Because the method, the vehicle will set to that certain position where it was when the driver got out.
Therefore, if the vehicle was in the air, and has fallen down, it will be teleported back in the air.
If the driver has jumped out of the running vehicle, it will be teleported back to that position.
If someone pushed or shooted the vehicle away, the vehicle will be teleported back to the original position.

Will these be fixed?
I don't think it could be done without a timer which checks for the vehicle datas in each X ms.

pawn Code:
#define FILTERSCRIPT
#include <a_samp>
#if !defined OnUnoccupiedVehicleUpdate
    #error "Include is not up to date, OnUnoccupiedVehicleUpdate callback not found. Please update to 0.3c R5 or higher."
#endif

enum E_VEH_ENUM { E_VEH_DRIVER, E_VEH_PLACED, Float:E_VEH_X, Float:E_VEH_Y, Float:E_VEH_Z, Float:E_VEH_ROT };
new vehicles[MAX_VEHICLES][E_VEH_ENUM];
new pvehicle[MAX_PLAYERS];

forward VEH_UnPlace(vehicleid); public VEH_UnPlace(vehicleid) vehicles[vehicleid][E_VEH_PLACED] = 0;

public OnFilterScriptInit()
{
    // version check
    new pv[10], pt[2], t = 0;
    GetServerVarAsString("version", pv, 10);
    strmid(pt, pv, 2, 3);
    if (strval(pt) < 3)
    {
        printf("[!] Your server version (%s) is likely not compatible with Anti ESC Vehicle Bug FS. Please update to 0.3c R5 or higher!", pv);
    }
    else
    {
        if (strval(pt) == 3) t = 1;
        strmid(pt, pv, 3, 4);
        if (pt[0] < 'c' && t == 1)
        {
            printf("[!] Your server version (%s) is likely not compatible with Anti ESC Vehicle Bug FS. Please update to 0.3c R5 or higher!", pv);
        }
        else
        {
            strmid(pt, pv, 6, 7);
            if (strval(pt) < 5 && t == 1)
            {
                printf("[!] Your server version (%s) is likely not compatible with Anti ESC Vehicle Bug FS. Please update to 0.3c R5 or higher!", pv);
            }
        }
    }
    for (new i = 0; i < MAX_VEHICLES; i++)
    {
        vehicles[i][E_VEH_DRIVER] = INVALID_VEHICLE_ID;
    }

    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (GetPlayerVehicleSeat(i) == 0)
        {
            vehicles[GetPlayerVehicleID(i)][E_VEH_DRIVER] = i;
            pvehicle[i] = GetPlayerVehicleID(i);
        }
    }
   
    print("\n Anti ESC Vehicle Bug FS initialized.");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n Anti ESC Vehicle Bug FS deloaded.");
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    vehicles[vehicleid][E_VEH_DRIVER] = INVALID_PLAYER_ID;
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    vehicles[vehicleid][E_VEH_PLACED] = 1;
    vehicles[vehicleid][E_VEH_DRIVER] = INVALID_PLAYER_ID;
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER)
    {
        new vehid = GetPlayerVehicleID(playerid);
        vehicles[vehid][E_VEH_DRIVER] = playerid;
        vehicles[vehid][E_VEH_PLACED] = 0;
        pvehicle[playerid] = vehid;
    }
    else
    {
        if (oldstate == PLAYER_STATE_DRIVER)
        {
            new vehid = pvehicle[playerid];
            pvehicle[playerid] = INVALID_VEHICLE_ID;
            vehicles[vehid][E_VEH_DRIVER] = INVALID_PLAYER_ID;
            GetVehiclePos(vehid, vehicles[vehid][E_VEH_X], vehicles[vehid][E_VEH_Y], vehicles[vehid][E_VEH_Z]);
            GetVehicleZAngle(vehid, vehicles[vehid][E_VEH_ROT]);
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    pvehicle[playerid] = INVALID_VEHICLE_ID;
    return;
}

public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat)
{
    if (passenger_seat < 1) return;
    if (vehicles[vehicleid][E_VEH_DRIVER] != INVALID_PLAYER_ID) return;
    if (vehicles[vehicleid][E_VEH_PLACED]) return;
    SetVehiclePos(vehicleid, vehicles[vehicleid][E_VEH_X], vehicles[vehicleid][E_VEH_Y], vehicles[vehicleid][E_VEH_Z]);
    SetVehicleZAngle(vehicleid, vehicles[vehicleid][E_VEH_ROT]);
    vehicles[vehicleid][E_VEH_PLACED] = 1;
    SetTimerEx("VEH_UnPlace", 10000, 0, "i", vehicleid);
}
__________________
uıɐƃɐ oɔsǝʇ uı pɹɐoqʎǝʞ ʎnq ʇou llıʍ ı
-
Quote:
Originally Posted by WackoX
If i steal a television at a store, am i still legal if i put a sign on it saying "COPYRIGHT © ELECTRONIC STORE"?
Quote:
[20:46:02] <balintx> What is the output of this PAWN code? printf("%d", random(100));
[20:46:11] <JaTochNietDan> WHO THE FUCK KNOWS
-

Last edited by KoczkaHUN; 06/08/2011 at 07:43 PM. Reason: fixed a possible bug while loading filterscript with drivers in cars.
KoczkaHUN is offline   Reply With Quote
Old 06/08/2011, 04:32 PM   #2
FireCat
High-roller
 
FireCat's Avatar
 
Join Date: Jul 2010
Posts: 2,322
Reputation: 609
Default Re: Anti ESC Bug

Oh nice fix
FireCat is offline   Reply With Quote
Old 06/08/2011, 04:38 PM   #3
IstuntmanI
High-roller
 
IstuntmanI's Avatar
 
Join Date: Mar 2009
Location: Romania
Posts: 1,801
Reputation: 375
Default Re: Anti ESC Bug

I didn't know this bug xD, anyway, nice work
__________________


IstuntmanI is offline   Reply With Quote
Old 06/08/2011, 04:40 PM   #4
!!--Ryder_RO--!!
Big Clucker
 
Join Date: Jun 2011
Location: Romania
Posts: 110
Reputation: 21
Default Re: Anti ESC Bug

I did not know this bug Bravo for the work
__________________
Hi ^^
!!--Ryder_RO--!! is offline   Reply With Quote
Old 06/08/2011, 07:16 PM   #5
letters
Little Clucker
 
Join Date: May 2011
Posts: 48
Reputation: 0
Default Re: Anti ESC Bug

I guess it's usefull
letters is offline   Reply With Quote
Old 06/08/2011, 07:18 PM   #6
ServerRestart
Big Clucker
 
ServerRestart's Avatar
 
Join Date: Jul 2011
Location: California
Posts: 186
Reputation: 0
Default Re: Anti ESC Bug

Oh, nice :P
ServerRestart is offline   Reply With Quote
Old 06/08/2011, 07:24 PM   #7
WoodPecker
Huge Clucker
 
WoodPecker's Avatar
 
Join Date: Apr 2009
Location: Tree
Posts: 427
Reputation: 47
Default Re: Anti ESC Bug

Nice filterscript but im not going to use it since the new project im scripting doesnt have much vehicles, anyway i think this one will help alot people to avoid this exploit, +rep for the good work.
WoodPecker is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Anti-Flood / Anti-Repeat + High Ping Kicker KoczkaHUN Filterscripts 21 25/01/2014 09:44 PM
[FilterScript] [FS]Zadmin2.0|Admin System + Anticheat + Anti-flood + Anti high ping [ZFM]Zuc Filterscripts 32 18/06/2012 05:29 PM
[FilterScript] [K.A.S] Knight's Anti Cheat (Anti: Armas, Spam, DB, MaxPing, Palavrões, Money Hack) The Knight Lançamentos/Releases 5 05/05/2011 03:41 AM


All times are GMT. The time now is 02:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.