[FilterScript] [Filterscript] Speed Boost for 0.3
#1

Speed Boost Filterscript
Here is a little filterscript for the stunters out there... it allows you to use speed boost on any vehicle by pressing the horn key (note some vehicles cannot be boosted very fast, for example the rhino tank).

You can customise the speed boost applied by typing /setspeedboost (/ssb).

_________________________________________________

I realise it is quite basic but I hope it will help some of the new scripters.

Direct Download AMX File (compiled):
http://www.gamerxserver.com/downloads/SpeedBoost.amx

Direct Download PAWN File (source code):
http://www.gamerxserver.com/downloads/SpeedBoost.pwn

Any questions? Please post.

Reply
#2

Haha awesome
Reply
#3

nice i had the same idea to :P
Reply
#4

nice
Reply
#5

ah yeah the new possibilities in 0.3 are awesome
well done
Reply
#6

D:\SERVER~1.MP\SERVER~1.3RC\FILTER~1\SPEEDB~2.PWN( 180) : error 017: undefined symbol "SetVehicleVelocity"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Error why Matite
Reply
#7

LOL!
Already done
http://forum.sa-mp.com/index.php?topic=122079.msg749377
Reply
#8

That script is on GamerX Euro?
Nice work
Reply
#9

Nice work!!
Reply
#10

DUDE this focking awesome!!
Reply
#11

Quote:
Originally Posted by brett7
nice i had the same idea to :P
Reply
#12

great job! love speed boosts!
Reply
#13

very good!
there is a lot that people can do with this.
Reply
#14

Hahaha thx alot :P I gona have SPEED PARTY
Reply
#15

C:\Documents and Settings\WINXP\Escritorio\bost.pwn(127) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
why? xD


// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Vehicle Speed Boost FilterScript for SAMP 0.3
// 2nd September 2009
// By Matite
// Special thanks to kc!
// v1.0.1
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Includes...
// -----------
// SAMP
#include <a_samp>
// -----------------------------------------------------------------------------
// Defines...
// ----------
// Used for messages sent to the player
#define COLOR_MESSAGE_YELLOW 0xFFDD00AA
// -----------------------------------------------------------------------------
// Variables...
// ------------
// Stores the players speed boost factor
// (it is set to the default of 1.5 when the FS is loaded or when a player connects)
new Float:SpeedBoostMultiplier[MAX_PLAYERS];
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------


public OnFilterScriptInit()
{
// Print to server console
print("\n-------------------------------------------------");
print(" Speed Boost Filterscript for SAMP 0.3 by Matite");
print("-------------------------------------------------\n");

// Loop
for (new i = 0; i < MAX_PLAYERS; i++)
{
// Check if player is connected and not a NPC
if (IsPlayerConnected(i) && !IsPlayerNPC(i))
{
// Set the default speed boost for each player
SpeedBoostMultiplier[i] = 1.5;
}
}

// Exit here
return 1;
}

// -----------------------------------------------------------------------------


public OnFilterScriptExit()
{
// Print to server console
print("\n------------------------------------------------");
print(" Unloaded Speed Boost Filterscript for SAMP 0.3");
print("------------------------------------------------\n");
// Exit here
return 1;
}
// -----------------------------------------------------------------------------

public OnPlayerCommandText(playerid, cmdtext[])
{
// Create variables
new cmd[256];
new idx;

// Get the command
cmd = strtok(cmdtext, idx);

// Check command typed
if (strcmp(cmd, "/setspeedboost", true) == 0 || strcmp(cmd, "/ssb", true) == 0)
{
// Create string variables
new strBoostMultiplier[256];
new strTempString[256];

// Get the vaue typed
strBoostMultiplier = strtok(cmdtext, idx);

// Check a boost factor was supplied
if (!strlen(strBoostMultiplier))
{
// Send message and exit here
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "** Usage: /setspeedboost <SpeedBoostMultiplier>");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Allows you to set the speed boost multiplier that is applied when you press the horn key.");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Accepted speed boost multiplier values are between 1.0 and 3.0");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The shortcut for this command is: /ssb");
format(strTempString,sizeof(strTempString), "* Your current speed boost multiplier is: %0.2f", SpeedBoostMultiplier[playerid]);
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);
return 1;
}

// Check the boost factor supplied is numeric
if (!IsNumeric2(strBoostMultiplier))
{
// Send message and exit here
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "** Usage: /setspeedboost <BoostMultiplier>");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Allows you to set the speed boost multiplier that is applied when you press the horn key.");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Accepted speed boost multiplier values are between 1.0 and 3.0");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The shortcut for this command is: /ssb");
format(strTempString,sizeof(strTempString), "* Your current speed boost multiplier is: %0.2f", SpeedBoostMultiplier[playerid]);
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);
return 1;
}


// Convert to float
new Float:BoostMultiplier = floatstr(strBoostMultiplier);

// Check speed boost multiplier is not too high or low
if (BoostMultiplier < 1.0 || BoostMultiplier > 3.0)
{
// Send message and exit here
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must enter a speed boost multiplier between 1.0 and 3.0");
return 1;
}

// Store the new speed boost multiplier value for the player

// Format and send message

SpeedBoostMultiplier[playerid] = BoostMultiplier;
format(strTempString,sizeof(strTempString), "* You set your speed boost multiplier to %0.2f", SpeedBoostMultiplier[playerid]);
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);

// Exit here
return 1;
}

// Exit here and return 0 (the command was not processed here)
return 0;
}


// -----------------------------------------------------------------------------

public OnPlayerConnect(playerid)
{
// Set the default speed boost for the player
// (the previous player may of changed it)
SpeedBoostMultiplier[playerid] = 1.5;

// Send message
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Speed Boost v1.01 by Matite - type /ssb to set your speed boost factor.");

// Exit here
return 1;
}
// -----------------------------------------------------------------------------


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
// Check if the player is in any vehicle and is the driver
if (IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
// Check for the HORN key (Crouch key is the same as the horn key)
if (newkeys & KEY_CROUCH)
{
// Create variables
new Float:vx, Float:vy, Float:vz;

// Get the vehicles velocity
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);

// Check the values are not too high already
if (floatabs(vx) < 3 && floatabs(vy) < 3 && floatabs(vz) < 3)
{
// Boost the vehicle speed
SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * SpeedBoostMultiplier[playerid], vy * SpeedBoostMultiplier[playerid], vz * SpeedBoostMultiplier[playerid]);
}

// Exit here
return 1;
}
}

// Exit here
return 1;
}


// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

// -----------------------------------------------------------------------------

IsNumeric2(const string[])
{
// Is Numeric Check 2
// ------------------
// By DracoBlue... handles negative numbers

new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+' && string[i]!='.') // Not a number,'+' or '-' or '.'
|| (string[i]=='-' && i!=0) // A '-' but not first char.
|| (string[i]=='+' && i!=0) // A '+' but not first char.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+' || string[0]=='.')) return false;
return true;
}

// -----------------------------------------------------------------------------
// --------------------------------------------------------------
Reply
#16

did same thing just for bunneh hop..
Reply
#17

C:\Users\SnipeR4\Desktop\SpeedBoost.pwn(4 : error 017: undefined symbol "IsPlayerNPC"
C:\Users\SnipeR4\Desktop\SpeedBoost.pwn(174) : error 017: undefined symbol "GetVehicleVelocity"
C:\Users\SnipeR4\Desktop\SpeedBoost.pwn(180) : error 017: undefined symbol "SetVehicleVelocity"

And the link for amx download is not running
Reply
#18

Quote:
Originally Posted by winczek1
C:\Users\SnipeR4\Desktop\SpeedBoost.pwn(4 : error 017: undefined symbol "IsPlayerNPC"
C:\Users\SnipeR4\Desktop\SpeedBoost.pwn(174) : error 017: undefined symbol "GetVehicleVelocity"
C:\Users\SnipeR4\Desktop\SpeedBoost.pwn(180) : error 017: undefined symbol "SetVehicleVelocity"

And the link for amx download is not running
You are not using 0.3 includes
Reply
#19

Nice ..
Reply
#20

Wow, it's awesome. I needed it, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)