[FilterScript] Prevent AFK Drivers Bug
#1

There is a SA-MP bug, that when someone goes AFK in a vehicle, and a player who does not have them streamed in comes and gets in the car.

So when the other player is back from AFK, both players are driving the same vehicle ID, but different vehicles localy

While making my anti cheat system I saw that without preventing this bug, vehicle health cheat systems would be spammed and ban innocent players. Other hacks such as the CLEO cheats that make people very quickly be a vehicle driver to move the vehicle are also prevented by this system.

This can be both a Filter script or a game mode, as the only code used goes into OnPlayerUpdate

pawn Код:
#include <a_samp>

public OnFilterScriptInit() {
    print("AFK Driver Protection Started");
    return 1;
}
public OnFilterScriptExit() {
    print("AFK Driver Protection Stopped");
    return 1;
}
public OnPlayerUpdate(playerid) {
    new playerState=GetPlayerState(playerid);
    if (playerState == PLAYER_STATE_DRIVER) {
        new vehicleid = GetPlayerVehicleID(playerid);
        if (vehicleid>0) {
            for (new plid=0; plid<MAX_PLAYERS; plid++) {
                if (plid!=playerid) {
                    if (IsPlayerConnected(plid)) {
                        if(!IsPlayerNPC(plid)) {
                            if (GetPlayerState(plid)==PLAYER_STATE_DRIVER) {
                                if (GetPlayerVehicleID(plid)==vehicleid) {
                                    kick = true;
                                    RemovePlayerFromVehicle(plid);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (kick) RemovePlayerFromVehicle(playerid);
    return 1;
}
Hopefully I have posted this in the right section, correct me if im wrong, Thanks.
Reply


Messages In This Thread
Prevent AFK Drivers Bug - by Grimrandomer - 14.06.2012, 08:17
AW: Prevent AFK Drivers Bug - by Nanory - 14.06.2012, 12:33
Re: Prevent AFK Drivers Bug - by Master_Gangster - 14.06.2012, 15:39
Re: Prevent AFK Drivers Bug - by Littlehelper - 14.06.2012, 15:54
Re: Prevent AFK Drivers Bug - by Faisal_khan - 14.06.2012, 16:08
Re: Prevent AFK Drivers Bug - by Niko_boy - 14.06.2012, 17:35
Re: Prevent AFK Drivers Bug - by Master_Gangster - 14.06.2012, 18:03
Re: Prevent AFK Drivers Bug - by RedWingz - 14.06.2012, 18:39
Respuesta: AW: Prevent AFK Drivers Bug - by [DOG]irinel1996 - 14.06.2012, 19:47
AW: Prevent AFK Drivers Bug - by Extremo - 14.06.2012, 19:52

Forum Jump:


Users browsing this thread: 1 Guest(s)