[Tutorial] Anti Drive-By
#1

Hi. Today I'm gonna learn you how to protect your server against drive-by. First, open your gamemode and search(CTRL+F) "public OnPlayerDeath". This callback is called everytime someone dies. You must find something like this:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}
We see 3 arguments there :
Код:
    •playerid - the id of the one that just died.
    •killerid - the id of the killer
    •reason - we don't need this now
We will use the IsPlayerInAnyVehicle function to check if the killer was in any vehicle when he killed the player. Like this:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehicle(killerid))
    {
    }
    return 1;
}
Done, now let's do something about that. We will kick the player and inform him about why he's been kicked:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerInAnyVehicle(killerid))
    {
        SendClientMessage(killerid, 0xFF0000FF, "You have been kicked because you killed someone from the car(drive-by)");
        Kick(killerid);
    }
    return 1;
}
Done. If you have any problem just tell me.
Reply


Messages In This Thread
Anti Drive-By - by DiGiTaL_AnGeL - 05.03.2013, 13:03
Re: Anti Drive-By - by bensmart469 - 05.03.2013, 13:05
Re: Anti Drive-By - by DiGiTaL_AnGeL - 05.03.2013, 13:13
Re: Anti Drive-By - by burnfire - 05.03.2013, 13:22
Re: Anti Drive-By - by Johndaonee - 05.03.2013, 18:58
Re: Anti Drive-By - by DiGiTaL_AnGeL - 05.03.2013, 19:07
Re: Anti Drive-By - by SuperViper - 06.03.2013, 14:18
Re: Anti Drive-By - by RajatPawar - 06.03.2013, 14:22
Re: Anti Drive-By - by DiGiTaL_AnGeL - 06.03.2013, 15:49
Re: Anti Drive-By - by Dan.. - 17.03.2013, 09:22

Forum Jump:


Users browsing this thread: 2 Guest(s)