[FilterScript] [FS] Spikes ~ Create Realistic Road Spikes!
#1

Spikes
What does it do?
With a simple press of a button of your choice(default 'C') you can place realistic road Spikes where ever you want.
Also includes an automatic spike destroy timer at 60 seconds so theres not spikes placed everywhere, and also anti-spike spam so people can only place one spike each every 60 seconds.


Video
Not the best filming but I did it controlling the players both at the same time.


How to use
Download the file(below).
Extract and paste the .amx into your filterscripts folder.
Add 'Spikes' to your server.cfg

Editing the Spike key/Destroy time:
Find these two lines in the FS
pawn Code:
#define DestroyTime 60000
#define MAKESPIKE KEY_CROUCH
Change the "KEY_CROUCH" to your choice of player key. https://sampwiki.blast.hk/wiki/GetPlayerKeys#Key_List one of these.
Change the 60000 to your choice of time in ms. 1000 = 1 second, 10000 = 10 seconds etcetera.

Download

http://www.solidfiles.com/d/h5T6/

Bugs
Only know of some compiling bugs which are 3 tag mismatches on the UpdateVehicleDamageStatus line, but works perfectly fine.
Not a bug but just a heads up, the message "Spikes Placed!" will come up twice if you leave the key as 'C' because you press it twice to stand up.
Any more bugs please reply I'll try fix them
Reply
#2

Nice
Reply
#3

What if someone drives into it backwards?
Reply
#4

Quote:
Originally Posted by Joe Staff
What if someone drives into it backwards?
Then that's a problem, I didn't want to pop all the cars tires because it will make it hard to drive but also because most people will drive forward.
Reply
#5

Quote:
Originally Posted by V1ceC1ty
... most people will drive forward.
Well I'm not most people! MWAHAHA *Drives around town backwards*



You could also determine if the player is driving backwards by checking their velocity in relation to their angle.
Reply
#6

Wow This is really nice, great job, I am definetly using this.
Reply
#7

Here Vice, just took it from my a_angles include and messed around with it a bit:

Code:
stock IsPlayerVehicleFacingPos(playerid, Float:pX, Float:pY, Float:dOffset)
{

	new
		Float:pA,
		Float:X,
		Float:Y,
		Float:Z,
		Float:ang;

	if(!IsPlayerConnected(playerid) || !GetPlayerState(playerid) != 2) return false;

	GetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
	GetVehicleZAngle(GetPlayerVehicleID(playerid), pA);

	if( Y > pY ) ang = (-acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);
	else if( Y < pY && X < pX ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 450.0);
	else if( Y < pY ) ang = (acos((X - pX) / floatsqroot((X - pX)*(X - pX) + (Y - pY)*(Y - pY))) - 90.0);

	if(AngleInRangeOfAngle(-ang, pA, dOffset)) return true;

	return false;

}

stock AngleInRangeOfAngle(Float:a1, Float:a2, Float:range)
{
	a1 -= a2;
	if((a1 < range) && (a1 > -range)) return true;

	return false;
}
Just use it in this fashion:
Code:
if(IsPlayerVehicleFacingPos(playerid, x, y, 180.0))
{
// pop front tires
}
else
{
// pop back tires
}
Or do what Joe said and just check their vehicle's velocity.
Reply
#8

Quote:
Originally Posted by Tannz0rz
Here Vice, just took it from my a_angles include and messed around with it a bit:
Might update it later thanks
Reply
#9

Nice script ill check it out
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)