SA-MP Forums Archive
Help Anti-Drive By - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Anti-Drive By (/showthread.php?tid=465944)



Help Anti-Drive By - kbalor - 25.09.2013

Hi guys. I would like to make an anti drive by in a spawn point but in different way.

Example: Let say I'm in a spawn point (A platform), And one of my friend is inside a vehicle and he was trying to kill me or any player that is inside a platform by shooting. I want to make him throw away right off the platform without any command (Like a Jedi force)

Maybe this will help IsPlayerInRangeOfPoint, IsPlayerInVehicle

If Player 1 (is in platform spawn point) and Player 2 with vehicle (is in platform spawn point shooting Player 1) then Jedi force the player 2 out off the platform.

Thanks alot. Looking forward to hear your reply. May the force be with you.


Re: Help Anti-Drive By - JamesH - 25.09.2013

I didn't get the platform idea.

Do you want a static area for the driving by to be prohibited?

And for the throwing you can use this :

pawn Код:
stock Force(playerid)
{
    new Float:Position[3];
    GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
    SetPlayerPos(playerid, Position[0]+3, Position[1]+3, Position[2]+3);
    TogglePlayerControlAble(playerid, true);
        SendClientMessage(playerid, color, "You have been thrown away by a strange force.");
       
}



Re: Help Anti-Drive By - kbalor - 25.09.2013

Quote:
Originally Posted by JamesH
Посмотреть сообщение
I didn't get the platform idea.

Do you want a static area for the driving by to be prohibited?

And for the throwing you can use this :

pawn Код:
stock Force(playerid)
{
    new Float:Position[3];
    GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
    SetPlayerPos(playerid, Position[0]+3, Position[1]+3, Position[2]+3);
    TogglePlayerControlAble(playerid, true);
        SendClientMessage(playerid, color, "You have been thrown away by a strange force.");
       
}
The platform is the Spawn Point or Area. Like a helicopter platform.

Thanks for the script. I will try it later coz I'm in my work right now. I would also like to know how it will know if the player2 that is in a vehicle shooting the player1 who is onfoot?

Also It will be like a force push without teleporting to other places.

Sample is: I'm standing in a circle force shield. When you try to get closer you will be only pushed away.


Re: Help Anti-Drive By - JamesH - 25.09.2013

About that circule you can use the stock I gave you
[/pawn] If(IsPlayerInRangeOfPoint(playerid, 5.0, x,y,z)) Force(playerid); [/pawn]

As for the "player2" shooting from a vehicle you can use
pawn Код:
OnPlayerKeyStateChange
And then check if the player is hold a weapon and clicking FIRE while he close to the "Force" stock.


Re: Help Anti-Drive By - kbalor - 25.09.2013

Thanks but I got little confused. Can anyone make a simple script for this?

Thank you very much. Looking forwards.