[Include] Vehicle Mod Crasher v1.0: Easily block crashers from your server!
#1

Hey everyone,

A new type of attack (new 4 me anyway) have appeard in my server.
Some people used this attack, which allows them to add components to their vehicles even when they aren't in a garage, and also, add A LARGE AMOUNT of them at once; which causing crashes to players streamed with the hacker.

In fact, if you'll check it, you'll find that the hacker just stands with a vehicle on a specific position and crashing every player around him.

So, I developed a solution. A new include file which can be used to block players from modding their vehicles out of a garage or modding too much at once.

Some important notes:
- This solution will not block AddVehicleComponent. Any type of modding from a garage or gamemode function will work fine.
- I've tested it on my server which contains around the 100 players for a day. Mistakes in the script wasn't detected.
- A large credit goes to AAvivB for helping me discovering the hack and testing the script.
- The fact that the topic header contains "v1.0" doesn't mean there will be next versions. Just in the case that any bugs will be found, i'll update the script and the version.

Install:
1) Add the include file to your server: http://pastebin.com/xjEqreHC or http://sa-mp.co.il/amit/scripts/vmc.inc
2) #include it
3) At the top of your script OnVehicleMod add one of the following codes, it doesn't really matter which one:
pawn Код:
if(VMC_OnVehicleMod(playerid,vehicleid,componentid)) return 1;
or
pawn Код:
assert !VMC_OnVehicleMod(playerid,vehicleid,componentid);
4) In OnEnterExitModShop, add:
pawn Код:
VMC_OnEnterExitModShop(playerid,enterexit);
5) You're (almost) done. The script should work in your server now. However, there's one another thing you can do to REALLY optimize the script and prevent lags:
6) In each AddVehicleComponent of your gamemode, add a parameter of playerid, which is the player who driving the vehicle. It isn't required but it will totally prevent some lags that could affect the server.
For example, if I had:
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/nitro",true) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
        return 1;
    }
    return 0;
}
I'll replace the AddVehicleComponent line with:
pawn Код:
AddVehicleComponent(GetPlayerVehicleID(playerid),1010,playerid);
Now you're done.

I didn't discovered any bugs, but if you'll anyway find something, report in this topic.
Reply
#2

Looks nice.
Maybe I'll give it a try.
Reply
#3

pretty good one
Reply
#4

Quote:
Originally Posted by Amit_B
Посмотреть сообщение
So, I developed a solution. A new include file which can be used to block players from modding their vehicles out of a garage or modding too much at once.
and if i want them to mode their vehicle out of garage ?
Reply
#5

Useful script, thanks Amit!
Reply
#6

Quote:
Originally Posted by xkirill
Посмотреть сообщение
and if i want them to mode their vehicle out of garage ?
Quote:
Originally Posted by Amit_B
- This solution will not block AddVehicleComponent. Any type of modding from a garage or gamemode function will work fine.
As long as you don't want them to mode their vehicle using hacks, you should use the script.
Reply
#7

Very nice!
Reply
#8

VERY nice! I've heard about this type of crashing too. It gets pretty frustrating after a while of getting crashed. THANKS for this man!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)