14.06.2012, 08:17
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
Hopefully I have posted this in the right section, correct me if im wrong, Thanks.
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;
}