Car Ramming Prevention - 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: Car Ramming Prevention (
/showthread.php?tid=520896)
Car Ramming Prevention -
DJ_Shocker - 20.06.2014
Can someone give me an idea on how to accomplish this? I'm looking for a way to prevent car ramming/car parking on my DM server.
I'd like the driver to be slapped out as soon as a player is rammed with the drivers vehicle. I can't seem to get this right.
Re: Car Ramming Prevention -
Bek_Loking - 20.06.2014
Ugh. I don't know quite how to pull that off, but I know how to punish a player if he does a driveby.
If you need that PM me.
Re: Car Ramming Prevention -
DJ_Shocker - 21.06.2014
I'm really needing the Anti-Car Ram/Car Park. I've seen videos of TDM servers doing this but....I can't seemt o get it right.
Re: Car Ramming Prevention -
Threshold - 21.06.2014
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) //Remove 'bodypart' if not using 0.3z
{
if(issuerid != INVALID_PLAYER_ID)
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(GetPlayerState(issuerid) == PLAYER_STATE_DRIVER)
{
if(weaponid == 49 || weaponid == 50)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(issuerid, x, y, z);
SetPlayerPos(issuerid, x, y, z + 5); //Slap the carparker
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z + 3); //Slap the player so they are no longer being carparked
SendClientMessage(issuerid, -1, "Carparking/Ramming is forbidden on this server.");
}
}
}
}
return 1;
}
There are probably better methods than this and I'm not saying mine is the best alternative, but this code should have some effect.