[FilterScript] Extreme Simple/Efficient Anti-Driveby
#1

Alright I've been checking through some Anti-Driveby scripts and most(of what I've seen) use stuff like OnPlayerEnterVehicle or storing guns in big Variables. Now I've come up with the most Memory friendly and easiest solution and I'm sure your gonna like it.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER)
	{
		new Weapons[13];
		new Ammo[13];
		for(new slot = 0; slot != 13; slot++)
		{
			new wep, ammo;
			GetPlayerWeaponData(playerid, slot, wep, ammo);
			if(slot != 4)
			{
				GetPlayerWeaponData(playerid, slot, Weapons[slot], Ammo[slot]);
			}
		}
		ResetPlayerWeaponsEx(playerid);
		for(new slot = 0; slot != 13; slot++)
		{
			GivePlayerWeapon(playerid, Weapons[slot], Ammo[slot]);
		}
	}
	return 1;
}
That's all! You don't actualy have to wait for the person to get out of their car. You can simply take it and instantly give it back. The player will then receive his gun back as soon as he is fully out of the vehicle.
(I'm not sure if this works in versions before 0.3b)

If you have a function called "RemovePlayerWeapon(playerid, weaponid)", you can make this script even shorter.
This is how it looks in my server:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER)
	{
	    new gun,ammo;
	    GetPlayerWeaponData(playerid, 4, gun, ammo);
	    RemovePlayerWeapon(playerid, gun);
	    GivePlayerWeapon(playerid, gun, 35578);//I use infinite ammo in my server
	}
	return 1;
}
Life can be that simple
Reply
#2

Wow thats great. I'll be using the second one as I have the RemovePlayerWeapon function. Thanks.
Reply
#3

It does work from my testing and its such a simple way to go about it. It just removes it and gives it back so you don't have to do loops or timers or whatever.
Reply
#4

This does not work on 0.3C! It only works in versions up to 0.3b.
Reply
#5

Hey, thanks for copying and pasting this. I have seen it elsewhere on this forum, all you did was re-post it!
Reply
#6

No I wrote this myself, but it's a common way of doing it.
Doesn't matter anymore anyways, cause now it's just SetPlayerArmedWeapon(playerid, 0);

Ever thought that maybe they copy/pasted it off me?
Reply
#7

This is plagiarism.
Reply
#8

Quote:
Originally Posted by Germanator
Посмотреть сообщение
No I wrote this myself, but it's a common way of doing it.
Doesn't matter anymore anyways, cause now it's just SetPlayerArmedWeapon(playerid, 0);

Ever thought that maybe they copy/pasted it off me?
Actually, you may of written the code yourself (which I doubt), but the text you used on your thread (to explain it, etc) was copied from another location. It's either VERY similar, or dead on.
Reply
#9

Mind posting a link to where the original tutorial is?
Reply
#10

Use search ^, nice script anyway
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)