Untitled diff

Created Diff never expires
409 removals
608 lines
212 additions
418 lines
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.0.1"
#include <sourcemod>
#include <sourcemod>


#pragma semicolon 1
bool
#pragma newdecls required
speedo[MAXPLAYERS]
#define PLUGIN_VERSION "1.0.0"
, velocimeter[MAXPLAYERS];
Handle
SpeedOMeter
, VelociMeter;
int
g_iClientSpeedoColour[MAXPLAYERS]
, g_iClientSpeedoColourCustom[MAXPLAYERS][3]
, g_iClientVelocimeterColour[MAXPLAYERS]
, g_iClientVelocimeterColourCustom[MAXPLAYERS][3];

//SPEEDO:
enum {
SPEEDO_NORMAL
, SPEEDO_BLUE
, SPEEDO_LIGHT
, SPEEDO_DARK
, SPEEDO_GREEN
, SPEEDO_RED
, SPEEDO_CUSTOM
, SPEEDO_RAINBOW
}
//VELOCIMETER:
enum {
VELOCIMETER_NORMAL
, VELOCIMETER_BLUE
, VELOCIMETER_LIGHT
, VELOCIMETER_DARK
, VELOCIMETER_GREEN
, VELOCIMETER_RED
, VELOCIMETER_CUSTOM
, VELOCIMETER_RAINBOW
}


public Plugin myinfo = {
public Plugin myinfo = {
name = "Speedometer",
name = "Speedometer",
author = "CrancK (modified for Tempus)",
author = "CrancK (modified for Tempus)",
description = "Speedometer",
description = "Speedometer",
version = PLUGIN_VERSION,
version = PLUGIN_VERSION,
url = ""
url = ""
};
};


//Description: speedo + velocimeter
public void OnPluginStart() {

//SPEEDO:
bool speedo[MAXPLAYERS];
Handle SpeedOMeter;

int g_iClientSpeedoColour[MAXPLAYERS];
int g_iClientSpeedoColourCustom[MAXPLAYERS][3];

#define SPEEDO_NORMAL 0
#define SPEEDO_BLUE 1
#define SPEEDO_LIGHT 2
#define SPEEDO_DARK 3
#define SPEEDO_GREEN 4
#define SPEEDO_RED 5
#define SPEEDO_CUSTOM 6
#define SPEEDO_RAINBOW 7


//VELOCIMETER:
bool velocimeter[MAXPLAYERS];
Handle VelociMeter;

int g_iClientVelocimeterColour[MAXPLAYERS];
int g_iClientVelocimeterColourCustom[MAXPLAYERS][3];

#define VELOCIMETER_NORMAL 0
#define VELOCIMETER_BLUE 1
#define VELOCIMETER_LIGHT 2
#define VELOCIMETER_DARK 3
#define VELOCIMETER_GREEN 4
#define VELOCIMETER_RED 5
#define VELOCIMETER_CUSTOM 6
#define VELOCIMETER_RAINBOW 7


public void OnPluginStart()
{
CreateConVar("sm_speedo_version", PLUGIN_VERSION, "Speedometer Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
CreateConVar("sm_speedo_version", PLUGIN_VERSION, "Speedometer Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
RegConsoleCmd("sm_speedo", Command_Speedo);
RegConsoleCmd("sm_speedo", Command_Speedo);
RegConsoleCmd("sm_speedoblue", Speedo_Blue);
RegConsoleCmd("sm_speedoblue", Speedo_Blue);
RegConsoleCmd("sm_speedolight", Speedo_Light);
RegConsoleCmd("sm_speedolight", Speedo_Light);
RegConsoleCmd("sm_speedodark", Speedo_Dark);
RegConsoleCmd("sm_speedodark", Speedo_Dark);
RegConsoleCmd("sm_speedogreen", Speedo_Green);
RegConsoleCmd("sm_speedogreen", Speedo_Green);
RegConsoleCmd("sm_speedored", Speedo_Red);
RegConsoleCmd("sm_speedored", Speedo_Red);
RegConsoleCmd("sm_speedocustom", Speedo_Custom);
RegConsoleCmd("sm_speedocustom", Speedo_Custom);
RegConsoleCmd("sm_speedorainbow", Speedo_Rainbow);
RegConsoleCmd("sm_speedorainbow", Speedo_Rainbow);
SpeedOMeter = CreateHudSynchronizer();
SpeedOMeter = CreateHudSynchronizer();



RegConsoleCmd("sm_velocimeter", Command_VelociMeter);
RegConsoleCmd("sm_velocimeter", Command_VelociMeter);
RegConsoleCmd("sm_velocimeterblue", Velocimeter_Blue);
RegConsoleCmd("sm_velocimeterblue", Velocimeter_Blue);
RegConsoleCmd("sm_velocimeterlight", Velocimeter_Light);
RegConsoleCmd("sm_velocimeterlight", Velocimeter_Light);
RegConsoleCmd("sm_velocimeterdark", Velocimeter_Dark);
RegConsoleCmd("sm_velocimeterdark", Velocimeter_Dark);
RegConsoleCmd("sm_velocimetergreen", Velocimeter_Green);
RegConsoleCmd("sm_velocimetergreen", Velocimeter_Green);
RegConsoleCmd("sm_velocimeterred", Velocimeter_Red);
RegConsoleCmd("sm_velocimeterred", Velocimeter_Red);
RegConsoleCmd("sm_velocimetercustom", Velocimeter_Custom);
RegConsoleCmd("sm_velocimetercustom", Velocimeter_Custom);
RegConsoleCmd("sm_velocimeterrainbow", Velocimeter_Rainbow);
RegConsoleCmd("sm_velocimeterrainbow", Velocimeter_Rainbow);
VelociMeter = CreateHudSynchronizer();
VelociMeter = CreateHudSynchronizer();
}
}


public void OnClientPutInServer(int client)
public void OnClientPutInServer(int client) {
{
speedo[client] = false;
speedo[client] = false;
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
g_iClientSpeedoColourCustom[client][0] = 255;
g_iClientSpeedoColourCustom[client][0] = 255;
g_iClientSpeedoColourCustom[client][1] = 50;
g_iClientSpeedoColourCustom[client][1] = 50;
g_iClientSpeedoColourCustom[client][2] = 50;
g_iClientSpeedoColourCustom[client][2] = 50;


velocimeter[client] = false;
velocimeter[client] = false;
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
g_iClientVelocimeterColourCustom[client][0] = 20;
g_iClientVelocimeterColourCustom[client][0] = 20;
g_iClientVelocimeterColourCustom[client][1] = 255;
g_iClientVelocimeterColourCustom[client][1] = 255;
g_iClientVelocimeterColourCustom[client][2] = 20;
g_iClientVelocimeterColourCustom[client][2] = 20;
}
}


//----------------------------------SPEEDO----------------------------------
//----------------------------------SPEEDO----------------------------------


public Action Command_Speedo(int client, int args)
public Action Command_Speedo(int client, int args) {
{
speedo[client] = !speedo[client];
if(!speedo[client]){
ReplyToCommand(client, "Speedo %s", speedo[client] ? "On": "Off");
speedo[client] = true;
ReplyToCommand(client, "Speedo ON");
}
else{
speedo[client] = false;
ReplyToCommand(client, "Speedo OFF");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


public Action Speedo_Blue(int client, int args)
public Action Speedo_Blue(int client, int args) {
{
g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_BLUE) ? SPEEDO_NORMAL : SPEEDO_BLUE;
if (g_iClientSpeedoColour[client] == SPEEDO_BLUE)
ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_BLUE) ? "default" : "blue");
{
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
ReplyToCommand(client, "Speedo is default");
}
else{
g_iClientSpeedoColour[client] = SPEEDO_BLUE;
ReplyToCommand(client, "Speedo is blue");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


public Action Speedo_Light(int client, int args)
public Action Speedo_Light(int client, int args) {
{
g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_LIGHT) ? SPEEDO_NORMAL : SPEEDO_LIGHT;
if (g_iClientSpeedoColour[client] == SPEEDO_LIGHT)
ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_LIGHT) ? "default" : "lighter");
{
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
ReplyToCommand(client, "Speedo is default");
}
else{
g_iClientSpeedoColour[client] = SPEEDO_LIGHT;
ReplyToCommand(client, "Speedo is lighter");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


public Action Speedo_Dark(int client, int args)
public Action Speedo_Dark(int client, int args) {
{
g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_DARK) ? SPEEDO_NORMAL : SPEEDO_DARK;
if (g_iClientSpeedoColour[client] == SPEEDO_DARK)
ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_DARK) ? "default" : "darker");
{
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
ReplyToCommand(client, "Speedo is default");
}
else{
g_iClientSpeedoColour[client] = SPEEDO_DARK;
ReplyToCommand(client, "Speedo is darker");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


public Action Speedo_Green(int client, int args)
public Action Speedo_Green(int client, int args) {
{
g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_GREEN) ? SPEEDO_NORMAL : SPEEDO_GREEN;
if (g_iClientSpeedoColour[client] == SPEEDO_GREEN)
ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_GREEN) ? "default" : "green");
{
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
ReplyToCommand(client, "Speedo is default");
}
else{
g_iClientSpeedoColour[client] = SPEEDO_GREEN;
ReplyToCommand(client, "Speedo is green");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


public Action Speedo_Red(int client, int args)
public Action Speedo_Red(int client, int args) {
{
g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_RED) ? SPEEDO_NORMAL : SPEEDO_RED;
if (g_iClientSpeedoColour[client] == SPEEDO_RED)
ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_RED) ? "default" : "red");
{
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
ReplyToCommand(client, "Speedo is default");
}
else{
g_iClientSpeedoColour[client] = SPEEDO_RED;
ReplyToCommand(client, "Speedo is red");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


public Action Speedo_Custom(int client, int args)
public Action Speedo_Custom(int client, int args) {
{
if (args < 3) {
if (args < 3)
ReplyToCommand(client, "Please enter three numbers");
{
return Plugin_Handled;
ReplyToCommand(client, "Please enter three numbers");
return Plugin_Handled;
}
}
bool bRedZeroCheck = true;
bool
bool bGreenZeroCheck = true;
bRedZeroCheck = true
bool bBlueZeroCheck = true;
, bGreenZeroCheck = true
, bBlueZeroCheck = true;
char arg1[4];
char
char arg2[4];
arg1[4]
char arg3[4];
, arg2[4]
, arg3[4];
//char sInputCheck[3][3];
//char sInputCheck[3][3];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
GetCmdArg(2, arg2, sizeof(arg2));
GetCmdArg(3, arg3, sizeof(arg3));
GetCmdArg(3, arg3, sizeof(arg3));
/*for (int i = 0; i > 3; i++){
/*for (int i = 0; i > 3; i++){
sInputCheck[i][i] = arg1[i];
sInputCheck[i][i] = arg1[i];
sInputCheck[i][i] = arg2[i];
sInputCheck[i][i] = arg2[i];
sInputCheck[i][i] = arg3[i];
sInputCheck[i][i] = arg3[i];
}
}
*/
*/
if (!StrEqual(arg1[0], "0")){
if (!StrEqual(arg1[0], "0")) {
bRedZeroCheck = false;
bRedZeroCheck = false;
}
}
if (!StrEqual(arg2[0], "0")){
if (!StrEqual(arg2[0], "0")) {
bGreenZeroCheck = false;
bGreenZeroCheck = false;
}
}
if (!StrEqual(arg3[0], "0")){
if (!StrEqual(arg3[0], "0")) {
bBlueZeroCheck = false;
bBlueZeroCheck = false;
}
}
int red = StringToInt(arg1);
int
int green = StringToInt(arg2);
red = StringToInt(arg1)
int blue = StringToInt(arg3);
, green = StringToInt(arg2)
, blue = StringToInt(arg3);
//Print for testing
//Print for testing
//ReplyToCommand(client, "arg1: %s, arg2: %s, arg3: %s || red: %d, green: %d, blue: %d red b: %b green b: %b blue //b: %b", arg1, arg2, arg3, red, green, blue, bRedZeroCheck, bGreenZeroCheck, bBlueZeroCheck);
//ReplyToCommand(client, "arg1: %s, arg2: %s, arg3: %s || red: %d, green: %d, blue: %d red b: %b green b: %b blue //b: %b", arg1, arg2, arg3, red, green, blue, bRedZeroCheck, bGreenZeroCheck, bBlueZeroCheck);
if ((red == 0 && bRedZeroCheck == false)
if ((red == 0 && bRedZeroCheck == false)
|| (green == 0 && bGreenZeroCheck == false)
|| (green == 0 && bGreenZeroCheck == false)
|| (blue == 0 && bBlueZeroCheck == false))
|| (blue == 0 && bBlueZeroCheck == false)) {
{
ReplyToCommand(client, "Please enter in numbers");
ReplyToCommand(client, "Please enter in numbers");
return Plugin_Handled;
return Plugin_Handled;
}
}
if ((red >=0 && red <=255) && (green >=0 && green <=255) && (blue >=0 && blue <=255))
if ((0 <= red <= 255) && (0 <= green <= 255) && (0 <= blue <= 255)) {
{
g_iClientSpeedoColour[client] = SPEEDO_CUSTOM;
g_iClientSpeedoColour[client] = SPEEDO_CUSTOM;
ReplyToCommand(client, "Speedo is now (%d, %d, %d)", red, green, blue);
ReplyToCommand(client, "Speedo is now (%d, %d, %d)", red, green, blue);
g_iClientSpeedoColourCustom[client][0] = red;
g_iClientSpeedoColourCustom[client][0] = red;
g_iClientSpeedoColourCustom[client][1] = green;
g_iClientSpeedoColourCustom[client][1] = green;
g_iClientSpeedoColourCustom[client][2] = blue;
g_iClientSpeedoColourCustom[client][2] = blue;
return Plugin_Handled;
return Plugin_Handled;
}
}
else {
ReplyToCommand(client, "Please enter numbers between 0 and 255");
ReplyToCommand(client, "Please enter numbers between 0 and 255");
return Plugin_Handled;
return Plugin_Handled;
}
}
}


public Action Speedo_Rainbow(int client, int args)
public Action Speedo_Rainbow(int client, int args) {
{
g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW) ? SPEEDO_NORMAL : SPEEDO_RAINBOW;
if (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW)
ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW) ? "default" : "fabulous");
{
g_iClientSpeedoColour[client] = SPEEDO_NORMAL;
ReplyToCommand(client, "Speedo is default");
}
else{
g_iClientSpeedoColour[client] = SPEEDO_RAINBOW;
ReplyToCommand(client, "Speedo is fabulous");
}
return Plugin_Handled;
return Plugin_Handled;
}
}



//----------------------------------VELOCIMETER----------------------------------
//----------------------------------VELOCIMETER----------------------------------


//toggling velocimeter using command
//toggling velocimeter using command
public Action Command_VelociMeter(int client, int args)
public Action Command_VelociMeter(int client, int args) {
{
velocimeter[client] = !velocimeter[client];
if(!velocimeter[client])
ReplyToCommand(client, "Velocimeter %s", velocimeter[client] ? "ON" : "OFF");
{
velocimeter[client] = true;
ReplyToCommand(client, "VelociMeter ON");

} else {

velocimeter[client] = false;
ReplyToCommand(client, "VelociMeter OFF");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


//velocimeter blue [VALUE = 1]
//velocimeter blue [VALUE = 1]
public Action Velocimeter_Blue(int client, int args)
public Action Velocimeter_Blue(int client, int args) {
{
g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE) ? VELOCIMETER_NORMAL : VELOCIMETER_BLUE;
//if client's velocimeter is already blue, make it default color
ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE) ? "default" : "blue");
if (g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE)
{
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
ReplyToCommand(client, "Velocimeter is default");

//otherwise make client's velocimeter blue
} else {

g_iClientVelocimeterColour[client] = VELOCIMETER_BLUE;
ReplyToCommand(client, "Velocimeter is blue");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


//velocimeter light [VALUE = 2]
//velocimeter light [VALUE = 2]
public Action Velocimeter_Light(int client, int args)
public Action Velocimeter_Light(int client, int args) {
{
g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT) ? VELOCIMETER_NORMAL : VELOCIMETER_LIGHT;
//if client's velocimeter is already light, make it default color
ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT) ? "default" : "lighter");
if(g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT)
{
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
ReplyToCommand(client, "Velocimeter is default");

//otherwise make client's velocimeter light
} else {

g_iClientVelocimeterColour[client] = VELOCIMETER_LIGHT;
ReplyToCommand(client, "Velocimeter is lighter");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


//velocimeter dark [VALUE = 3]
//velocimeter dark [VALUE = 3]
public Action Velocimeter_Dark(int client, int args)
public Action Velocimeter_Dark(int client, int args) {
{
g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_DARK) ? VELOCIMETER_NORMAL : VELOCIMETER_DARK;
//if client's velocimeter is already dark, make it default color
ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_DARK) ? "default" : "darker");
if (g_iClientVelocimeterColour[client] == VELOCIMETER_DARK)
{
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
ReplyToCommand(client, "Velocimeter is default");

//otherwise make client's velocimeter light
} else {

g_iClientVelocimeterColour[client] = VELOCIMETER_DARK;
ReplyToCommand(client, "Velocimeter is darker");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


//velocimeter green [VALUE = 4]
//velocimeter green [VALUE = 4]
public Action Velocimeter_Green(int client, int args)
public Action Velocimeter_Green(int client, int args) {
{
g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN) ? VELOCIMETER_NORMAL : VELOCIMETER_GREEN;
//if client's velocimeter is already green, make it default color
ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN) ? "default" : "green");
if (g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN)
{
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
ReplyToCommand(client, "Velocimeter is default");

//otherwise make client's velocimeter green
} else {

g_iClientVelocimeterColour[client] = VELOCIMETER_GREEN;
ReplyToCommand(client, "Velocimeter is green");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


//velocimeter red [VALUE = 5]
//velocimeter red [VALUE = 5]
public Action Velocimeter_Red(int client, int args)
public Action Velocimeter_Red(int client, int args) {
{
g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_RED) ? VELOCIMETER_NORMAL : VELOCIMETER_RED;
//if client's velocimeter is already red, make it default color
ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_RED) ? "default" : "red");
if (g_iClientVelocimeterColour[client] == VELOCIMETER_RED)
{
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
ReplyToCommand(client, "Velocimeter is default");

//otherwise make client's velocimeter red
} else {

g_iClientVelocimeterColour[client] = VELOCIMETER_RED;
ReplyToCommand(client, "Velocimeter is red");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


//velocimeter custom [VALUE = 6]
//velocimeter custom [VALUE = 6]
public Action Velocimeter_Custom(int client, int args)
public Action Velocimeter_Custom(int client, int args) {
{
//if client does not give valid RGB values
//if client does not give valid RGB values
if (args < 3)
if (args < 3) {
{
ReplyToCommand(client, "Please enter three numbers");
ReplyToCommand(client, "Please enter three numbers");
return Plugin_Handled;
return Plugin_Handled;
}
}
bool bRedZeroCheckV = true;
bool
bool bGreenZeroCheckV = true;
bRedZeroCheckV = true
bool bBlueZeroCheckV = true;
, bGreenZeroCheckV = true
, bBlueZeroCheckV = true;
char Varg1[4];
char
char Varg2[4];
Varg1[4]
char Varg3[4];
, Varg2[4]
, Varg3[4];
GetCmdArg(1, Varg1, sizeof(Varg1));
GetCmdArg(1, Varg1, sizeof(Varg1));
GetCmdArg(2, Varg2, sizeof(Varg2));
GetCmdArg(2, Varg2, sizeof(Varg2));
GetCmdArg(3, Varg3, sizeof(Varg3));
GetCmdArg(3, Varg3, sizeof(Varg3));
if(!StrEqual(Varg1[0], "0"))
if (!StrEqual(Varg1[0], "0")) {
{
bRedZeroCheckV = false;
bRedZeroCheckV = false;
}
}


if(!StrEqual(Varg2[0], "0"))
if (!StrEqual(Varg2[0], "0")) {
{
bGreenZeroCheckV = false;
bGreenZeroCheckV = false;
}
}


if(!StrEqual(Varg3[0], "0"))
if (!StrEqual(Varg3[0], "0")) {
{
bBlueZeroCheckV = false;
bBlueZeroCheckV = false;
}
}
int Vred = StringToInt(Varg1);
int
int Vgreen = StringToInt(Varg2);
Vred = StringToInt(Varg1)
int Vblue = StringToInt(Varg3);
, Vgreen = StringToInt(Varg2)
, Vblue = StringToInt(Varg3);


if((Vred == 0 && bRedZeroCheckV == false)
if ((Vred == 0 && bRedZeroCheckV == false)
|| (Vgreen == 0 && bGreenZeroCheckV == false)
|| (Vgreen == 0 && bGreenZeroCheckV == false)
|| (Vblue == 0 && bBlueZeroCheckV == false))
|| (Vblue == 0 && bBlueZeroCheckV == false)) {
{
ReplyToCommand(client, "Please enter in numbers");
ReplyToCommand(client, "Please enter in numbers");
return Plugin_Handled;
return Plugin_Handled;
}
}
if((Vred >=0 && Vred <=255) && (Vgreen >=0 && Vgreen <=255) && (Vblue >=0 && Vblue <=255))
if ((0 <= Vred <= 255) && (0 <= Vgreen <= 255) && (0 <= Vblue <= 255)) {
{
g_iClientVelocimeterColour[client] = VELOCIMETER_CUSTOM;
g_iClientVelocimeterColour[client] = VELOCIMETER_CUSTOM;
ReplyToCommand(client, "Velocimeter is now (%d, %d, %d)", Vred, Vgreen, Vblue);
ReplyToCommand(client, "Velocimeter is now (%d, %d, %d)", Vred, Vgreen, Vblue);
g_iClientVelocimeterColourCustom[client][0] = Vred;
g_iClientVelocimeterColourCustom[client][0] = Vred;
g_iClientVelocimeterColourCustom[client][1] = Vgreen;
g_iClientVelocimeterColourCustom[client][1] = Vgreen;
g_iClientVelocimeterColourCustom[client][2] = Vblue;
g_iClientVelocimeterColourCustom[client][2] = Vblue;
return Plugin_Handled;
return Plugin_Handled;

}
} else {
ReplyToCommand(client, "Please enter numbers between 0 and 255");

return Plugin_Handled;
ReplyToCommand(client, "Please enter numbers between 0 and 255");
return Plugin_Handled;
}
}
}


//velocimeter rainbow [VALUE = 7]
//velocimeter rainbow [VALUE = 7]
public Action Velocimeter_Rainbow(int client, int args)
public Action Velocimeter_Rainbow(int client, int args) {
{
//if client's velocimeter is already rainbow, make it default color
//if client's velocimeter is already rainbow, make it default color
if (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW)
g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) ? VELOCIMETER_NORMAL : VELOCIMETER_RAINBOW;
{
ReplyToCommand(client, "Velocimeter is default", (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) ? "default" : "fabulous");
g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL;
ReplyToCommand(client, "Velocimeter is default");

//otherwise make client's velocimeter fabulous
} else {

g_iClientVelocimeterColour[client] = VELOCIMETER_RAINBOW;
ReplyToCommand(client, "Velocimeter is fabulous");
}
return Plugin_Handled;
return Plugin_Handled;
}
}


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


//calculating speed/velocity and displaying on screen
//calculating speed/velocity and displaying on screen
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) {
{
float
float currentVel[3], currentSpd, currentVelo;
currentVel[3]
, currentSpd
, currentVelo;
GetEntPropVector(client, Prop_Data, "m_vecVelocity", currentVel);
GetEntPropVector(client, Prop_Data, "m_vecVelocity", currentVel);
currentSpd = SquareRoot( (currentVel[0]*currentVel[0]) + (currentVel[1]*currentVel[1]) );
currentSpd = SquareRoot((currentVel[0]*currentVel[0]) + (currentVel[1]*currentVel[1]));
currentVelo = SquareRoot( (currentVel[0]*currentVel[0])+(currentVel[1]*currentVel[1])+(currentVel[2]*currentVel[2]) );
currentVelo = SquareRoot((currentVel[0]*currentVel[0])+(currentVel[1]*currentVel[1])+(currentVel[2]*currentVel[2]));
//SPEEDO TEXT:
//SPEEDO TEXT:
if(speedo[client])
if (speedo[client]) {
{
if (g_iClientSpeedoColour[client] == SPEEDO_BLUE) {
if (g_iClientSpeedoColour[client] == SPEEDO_BLUE){
SetHudTextParams(-1.0, 0.67, 1.0, 50, 100, 200, 255);
SetHudTextParams(-1.0, 0.67, 1.0, 50, 100, 200, 255);
}
}
else if (g_iClientSpeedoColour[client] == SPEEDO_LIGHT){
else if (g_iClientSpeedoColour[client] == SPEEDO_LIGHT) {
SetHudTextParams(-1.0, 0.67, 1.0, 255, 255, 255, 255);
SetHudTextParams(-1.0, 0.67, 1.0, 255, 255, 255, 255);
}
}
else if (g_iClientSpeedoColour[client] == SPEEDO_DARK){
else if (g_iClientSpeedoColour[client] == SPEEDO_DARK) {
SetHudTextParams(-1.0, 0.67, 1.0, 25, 25, 25, 255);
SetHudTextParams(-1.0, 0.67, 1.0, 25, 25, 25, 255);
}
}
else if (g_iClientSpeedoColour[client] == SPEEDO_GREEN){
else if (g_iClientSpeedoColour[client] == SPEEDO_GREEN) {
SetHudTextParams(-1.0, 0.67, 1.0, 50, 200, 0, 255);
SetHudTextParams(-1.0, 0.67, 1.0, 50, 200, 0, 255);
}
}
else if (g_iClientSpeedoColour[client] == SPEEDO_RED){
else if (g_iClientSpeedoColour[client] == SPEEDO_RED) {
SetHudTextParams(-1.0, 0.67, 1.0, 255, 0, 0, 255);
SetHudTextParams(-1.0, 0.67, 1.0, 255, 0, 0, 255);
}
}
else if (g_iClientSpeedoColour[client] == SPEEDO_CUSTOM){
else if (g_iClientSpeedoColour[client] == SPEEDO_CUSTOM) {
SetHudTextParams(-1.0, 0.67, 1.0,
SetHudTextParams(
g_iClientSpeedoColourCustom[client][0],
-1.0
g_iClientSpeedoColourCustom[client][1],
, 0.67
g_iClientSpeedoColourCustom[client][2], 255);
, 1.0
, g_iClientSpeedoColourCustom[client][0]
, g_iClientSpeedoColourCustom[client][1]
, g_iClientSpeedoColourCustom[client][2]
, 255
);
}
}
else if (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW){
else if (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW) {
int iRandRedBool = GetRandomInt(0,1);
int
int iRandGreenBool = GetRandomInt(0,1);
iRandRedBool = GetRandomInt(0,1)
int iRandBlueBool = GetRandomInt(0,1);
, iRandGreenBool = GetRandomInt(0,1)
, iRandBlueBool = GetRandomInt(0,1);
if (iRandRedBool){

g_iClientSpeedoColourCustom[client][0]++;
iRandRedBool ? g_iClientSpeedoColourCustom[client][0]++ : g_iClientSpeedoColourCustom[client][0]--;
}
iRandGreenBool ? g_iClientSpeedoColourCustom[client][1]++ : g_iClientSpeedoColourCustom[client][1]--;
else{
iRandBlueBool ? g_iClientSpeedoColourCustom[client][2]++ : g_iClientSpeedoColourCustom[client][2]--;
g_iClientSpeedoColourCustom[client][0]--;

}
SetHudTextParams(
-1.0
if (iRandGreenBool){
, 0.67
g_iClientSpeedoColourCustom[client][1]++;
, 1.0
}
, g_iClientSpeedoColourCustom[client][0]
else{
, g_iClientSpeedoColourCustom[client][1]
g_iClientSpeedoColourCustom[client][1]--;
, g_iClientSpeedoColourCustom[client][2]
}
, 255
, 0
if (iRandBlueBool){
);
g_iClientSpeedoColourCustom[client][2]++;
}
else{
g_iClientSpeedoColourCustom[client][2]--;
}
SetHudTextParams(-1.0, 0.67, 1.0,
g_iClientSpeedoColourCustom[client][0],
g_iClientSpeedoColourCustom[client][1],
g_iClientSpeedoColourCustom[client][2], 255, 0);
}
}
else {
else {
SetHudTextParams(-1.0, 0.67, 1.0, 255, 50, 50, 255);
SetHudTextParams(-1.0, 0.67, 1.0, 255, 50, 50, 255);
}
}
ShowSyncHudText(client, SpeedOMeter, "%.0f u/s", currentSpd);
ShowSyncHudText(client, SpeedOMeter, "%.0f u/s", currentSpd);
}
}




//VELOCIMETER TEXT:
//VELOCIMETER TEXT:
if(velocimeter[client])
if (velocimeter[client]) {
{
if (g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE) {
if(g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE)
{
SetHudTextParams(-1.0, 0.63, 1.0, 50, 100, 200, 255);
SetHudTextParams(-1.0, 0.63, 1.0, 50, 100, 200, 255);
}
}

else if (g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT) {
else if(g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT)
{
SetHudTextParams(-1.0, 0.63, 1.0, 255, 255, 255, 255);
SetHudTextParams(-1.0, 0.63, 1.0, 255, 255, 255, 255);
}
}

else if (g_iClientVelocimeterColour[client] == VELOCIMETER_DARK) {
else if(g_iClientVelocimeterColour[client] == VELOCIMETER_DARK)
{
SetHudTextParams(-1.0, 0.63, 1.0, 25, 25, 25, 255);
SetHudTextParams(-1.0, 0.63, 1.0, 25, 25, 25, 255);
}
}

else if (g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN) {
else if(g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN)
{
SetHudTextParams(-1.0, 0.63, 1.0, 50, 200, 0, 255);
SetHudTextParams(-1.0, 0.63, 1.0, 50, 200, 0, 255);
}
}

else if (g_iClientVelocimeterColour[client] == VELOCIMETER_RED) {
else if(g_iClientVelocimeterColour[client] == VELOCIMETER_RED)
{
SetHudTextParams(-1.0, 0.63, 1.0, 255, 0, 0, 255);
SetHudTextParams(-1.0, 0.63, 1.0, 255, 0, 0, 255);
}
}

else if (g_iClientVelocimeterColour[client] == VELOCIMETER_CUSTOM) {
else if(g_iClientVelocimeterColour[client] == VELOCIMETER_CUSTOM)
{
SetHudTextParams(-1.0, 0.63, 1.0,
SetHudTextParams(-1.0, 0.63, 1.0,
g_iClientVelocimeterColourCustom[client][0],
g_iClientVelocimeterColourCustom[client][0],
g_iClientVelocimeterColourCustom[client][1],
g_iClientVelocimeterColourCustom[client][1],
g_iClientVelocimeterColourCustom[client][2], 255);
g_iClientVelocimeterColourCustom[client][2], 255);
}
}

else if (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) {
else if(g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW)
int
{
iRandRedBoolV = GetRandomInt(0,1)
int iRandRedBoolV = GetRandomInt(0,1);
, iRandGreenBoolV = GetRandomInt(0,1)
int iRandGreenBoolV = GetRandomInt(0,1);
, iRandBlueBoolV = GetRandomInt(0,1);
int iRandBlueBoolV = GetRandomInt(0,1);
if(iRandRedBoolV)
{
g_iClientVelocimeterColourCustom[client][0]++;

} else {

g_iClientSpeedoColourCustom[client][0]--;
}
if(iRandGreenBoolV)
{
g_iClientVelocimeterColourCustom[client][1]++;

} else {

g_iClientVelocimeterColourCustom[client][1]--;
}
if(iRandBlueBoolV)
{
g_iClientVelocimeterColourCustom[client][2]++;

} else {


g_iClientVelocimeterColourCustom[client][2]--;
iRandRedBoolV ? g_iClientVelocimeterColourCustom[client][0]++ : g_iClientVelocimeterColourCustom[client][0]--;
}
iRandGreenBoolV ? g_iClientVelocimeterColourCustom[client][1]++ : g_iClientVelocimeterColourCustom[client][1]--;
iRandBlueBoolV ? g_iClientVelocimeterColourCustom[client][2]++ : g_iClientVelocimeterColourCustom[client][2]--;
SetHudTextParams(-1.0, 0.63, 1.0,
SetHudTextParams(-1.0, 0.63, 1.0,
g_iClientVelocimeterColourCustom[client][0],
g_iClientVelocimeterColourCustom[client][0],
g_iClientVelocimeterColourCustom[client][1],
g_iClientVelocimeterColourCustom[client][1],
g_iClientVelocimeterColourCustom[client][2], 255, 0);
g_iClientVelocimeterColourCustom[client][2], 255, 0);

}
} else {
else {

SetHudTextParams(-1.0, 0.63, 1.0, 20, 255, 20, 255);
SetHudTextParams(-1.0, 0.63, 1.0, 20, 255, 20, 255);
}
}
ShowSyncHudText(client, VelociMeter, "%.0f u/s", currentVelo);
ShowSyncHudText(client, VelociMeter, "%.0f u/s", currentVelo);

}
}
}
}