Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Affichage
Vue
Divisé
Unifié
Éditeur live
Masquer les espaces
Cacher identiques
Sans retour à la ligne
Niveau de précision
Intelligent
Syntaxe
Aucun
Modifier l’apparence
Traitement
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 8 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
448 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
608 lignes
Copier tout
295 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
418 lignes
Copier tout
Copier
Copié
Copier
Copié
#include <sourcemod>
#pragma semicolon 1
#pragma semicolon 1
#pragma newdecls required
#pragma newdecls required
Copier
Copié
Copier
Copié
#define PLUGIN_VERSION "1.0.
0"
#define PLUGIN_VERSION "1.0.
1"
#include <sourcemod>
bool
speedo[MAXPLAYERS]
, 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 = ""
};
};
Copier
Copié
Copier
Copié
//Description: speedo + velocimeter
//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()
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();
Copier
Copié
Copier
Copié
Différences enregistrées
Texte d'origine
Ouvrir un fichier
#include <sourcemod> #pragma semicolon 1 #pragma newdecls required #define PLUGIN_VERSION "1.0.0" public Plugin myinfo = { name = "Speedometer", author = "CrancK (modified for Tempus)", description = "Speedometer", version = PLUGIN_VERSION, url = "" }; //Description: speedo + velocimeter //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); RegConsoleCmd("sm_speedo", Command_Speedo); RegConsoleCmd("sm_speedoblue", Speedo_Blue); RegConsoleCmd("sm_speedolight", Speedo_Light); RegConsoleCmd("sm_speedodark", Speedo_Dark); RegConsoleCmd("sm_speedogreen", Speedo_Green); RegConsoleCmd("sm_speedored", Speedo_Red); RegConsoleCmd("sm_speedocustom", Speedo_Custom); RegConsoleCmd("sm_speedorainbow", Speedo_Rainbow); SpeedOMeter = CreateHudSynchronizer(); RegConsoleCmd("sm_velocimeter", Command_VelociMeter); RegConsoleCmd("sm_velocimeterblue", Velocimeter_Blue); RegConsoleCmd("sm_velocimeterlight", Velocimeter_Light); RegConsoleCmd("sm_velocimeterdark", Velocimeter_Dark); RegConsoleCmd("sm_velocimetergreen", Velocimeter_Green); RegConsoleCmd("sm_velocimeterred", Velocimeter_Red); RegConsoleCmd("sm_velocimetercustom", Velocimeter_Custom); RegConsoleCmd("sm_velocimeterrainbow", Velocimeter_Rainbow); VelociMeter = CreateHudSynchronizer(); } public void OnClientPutInServer(int client) { speedo[client] = false; g_iClientSpeedoColour[client] = SPEEDO_NORMAL; g_iClientSpeedoColourCustom[client][0] = 255; g_iClientSpeedoColourCustom[client][1] = 50; g_iClientSpeedoColourCustom[client][2] = 50; velocimeter[client] = false; g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL; g_iClientVelocimeterColourCustom[client][0] = 20; g_iClientVelocimeterColourCustom[client][1] = 255; g_iClientVelocimeterColourCustom[client][2] = 20; } //----------------------------------SPEEDO---------------------------------- public Action Command_Speedo(int client, int args) { if(!speedo[client]){ speedo[client] = true; ReplyToCommand(client, "Speedo ON"); } else{ speedo[client] = false; ReplyToCommand(client, "Speedo OFF"); } return Plugin_Handled; } public Action Speedo_Blue(int client, int args) { if (g_iClientSpeedoColour[client] == SPEEDO_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; } public Action Speedo_Light(int client, int args) { if (g_iClientSpeedoColour[client] == SPEEDO_LIGHT) { g_iClientSpeedoColour[client] = SPEEDO_NORMAL; ReplyToCommand(client, "Speedo is default"); } else{ g_iClientSpeedoColour[client] = SPEEDO_LIGHT; ReplyToCommand(client, "Speedo is lighter"); } return Plugin_Handled; } public Action Speedo_Dark(int client, int args) { if (g_iClientSpeedoColour[client] == SPEEDO_DARK) { g_iClientSpeedoColour[client] = SPEEDO_NORMAL; ReplyToCommand(client, "Speedo is default"); } else{ g_iClientSpeedoColour[client] = SPEEDO_DARK; ReplyToCommand(client, "Speedo is darker"); } return Plugin_Handled; } public Action Speedo_Green(int client, int args) { if (g_iClientSpeedoColour[client] == SPEEDO_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; } public Action Speedo_Red(int client, int args) { if (g_iClientSpeedoColour[client] == SPEEDO_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; } public Action Speedo_Custom(int client, int args) { if (args < 3) { ReplyToCommand(client, "Please enter three numbers"); return Plugin_Handled; } bool bRedZeroCheck = true; bool bGreenZeroCheck = true; bool bBlueZeroCheck = true; char arg1[4]; char arg2[4]; char arg3[4]; //char sInputCheck[3][3]; GetCmdArg(1, arg1, sizeof(arg1)); GetCmdArg(2, arg2, sizeof(arg2)); GetCmdArg(3, arg3, sizeof(arg3)); /*for (int i = 0; i > 3; i++){ sInputCheck[i][i] = arg1[i]; sInputCheck[i][i] = arg2[i]; sInputCheck[i][i] = arg3[i]; } */ if (!StrEqual(arg1[0], "0")){ bRedZeroCheck = false; } if (!StrEqual(arg2[0], "0")){ bGreenZeroCheck = false; } if (!StrEqual(arg3[0], "0")){ bBlueZeroCheck = false; } int red = StringToInt(arg1); int green = StringToInt(arg2); int blue = StringToInt(arg3); //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); if ((red == 0 && bRedZeroCheck == false) || (green == 0 && bGreenZeroCheck == false) || (blue == 0 && bBlueZeroCheck == false)) { ReplyToCommand(client, "Please enter in numbers"); return Plugin_Handled; } if ((red >=0 && red <=255) && (green >=0 && green <=255) && (blue >=0 && blue <=255)) { g_iClientSpeedoColour[client] = SPEEDO_CUSTOM; ReplyToCommand(client, "Speedo is now (%d, %d, %d)", red, green, blue); g_iClientSpeedoColourCustom[client][0] = red; g_iClientSpeedoColourCustom[client][1] = green; g_iClientSpeedoColourCustom[client][2] = blue; return Plugin_Handled; } else { ReplyToCommand(client, "Please enter numbers between 0 and 255"); return Plugin_Handled; } } public Action Speedo_Rainbow(int client, int args) { if (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW) { g_iClientSpeedoColour[client] = SPEEDO_NORMAL; ReplyToCommand(client, "Speedo is default"); } else{ g_iClientSpeedoColour[client] = SPEEDO_RAINBOW; ReplyToCommand(client, "Speedo is fabulous"); } return Plugin_Handled; } //----------------------------------VELOCIMETER---------------------------------- //toggling velocimeter using command public Action Command_VelociMeter(int client, int args) { if(!velocimeter[client]) { velocimeter[client] = true; ReplyToCommand(client, "VelociMeter ON"); } else { velocimeter[client] = false; ReplyToCommand(client, "VelociMeter OFF"); } return Plugin_Handled; } //velocimeter blue [VALUE = 1] public Action Velocimeter_Blue(int client, int args) { //if client's velocimeter is already blue, make it default color 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; } //velocimeter light [VALUE = 2] public Action Velocimeter_Light(int client, int args) { //if client's velocimeter is already light, make it default color 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; } //velocimeter dark [VALUE = 3] public Action Velocimeter_Dark(int client, int args) { //if client's velocimeter is already dark, make it default color 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; } //velocimeter green [VALUE = 4] public Action Velocimeter_Green(int client, int args) { //if client's velocimeter is already green, make it default color 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; } //velocimeter red [VALUE = 5] public Action Velocimeter_Red(int client, int args) { //if client's velocimeter is already red, make it default color 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; } //velocimeter custom [VALUE = 6] public Action Velocimeter_Custom(int client, int args) { //if client does not give valid RGB values if (args < 3) { ReplyToCommand(client, "Please enter three numbers"); return Plugin_Handled; } bool bRedZeroCheckV = true; bool bGreenZeroCheckV = true; bool bBlueZeroCheckV = true; char Varg1[4]; char Varg2[4]; char Varg3[4]; GetCmdArg(1, Varg1, sizeof(Varg1)); GetCmdArg(2, Varg2, sizeof(Varg2)); GetCmdArg(3, Varg3, sizeof(Varg3)); if(!StrEqual(Varg1[0], "0")) { bRedZeroCheckV = false; } if(!StrEqual(Varg2[0], "0")) { bGreenZeroCheckV = false; } if(!StrEqual(Varg3[0], "0")) { bBlueZeroCheckV = false; } int Vred = StringToInt(Varg1); int Vgreen = StringToInt(Varg2); int Vblue = StringToInt(Varg3); if((Vred == 0 && bRedZeroCheckV == false) || (Vgreen == 0 && bGreenZeroCheckV == false) || (Vblue == 0 && bBlueZeroCheckV == false)) { ReplyToCommand(client, "Please enter in numbers"); return Plugin_Handled; } if((Vred >=0 && Vred <=255) && (Vgreen >=0 && Vgreen <=255) && (Vblue >=0 && Vblue <=255)) { g_iClientVelocimeterColour[client] = VELOCIMETER_CUSTOM; ReplyToCommand(client, "Velocimeter is now (%d, %d, %d)", Vred, Vgreen, Vblue); g_iClientVelocimeterColourCustom[client][0] = Vred; g_iClientVelocimeterColourCustom[client][1] = Vgreen; g_iClientVelocimeterColourCustom[client][2] = Vblue; return Plugin_Handled; } else { ReplyToCommand(client, "Please enter numbers between 0 and 255"); return Plugin_Handled; } } //velocimeter rainbow [VALUE = 7] public Action Velocimeter_Rainbow(int client, int args) { //if client's velocimeter is already rainbow, make it default color if (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) { 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; } //-------------------------------------------------------------------------- //calculating speed/velocity and displaying on screen public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { float currentVel[3], currentSpd, currentVelo; GetEntPropVector(client, Prop_Data, "m_vecVelocity", currentVel); currentSpd = SquareRoot( (currentVel[0]*currentVel[0]) + (currentVel[1]*currentVel[1]) ); currentVelo = SquareRoot( (currentVel[0]*currentVel[0])+(currentVel[1]*currentVel[1])+(currentVel[2]*currentVel[2]) ); //SPEEDO TEXT: if(speedo[client]) { if (g_iClientSpeedoColour[client] == SPEEDO_BLUE){ SetHudTextParams(-1.0, 0.67, 1.0, 50, 100, 200, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_LIGHT){ SetHudTextParams(-1.0, 0.67, 1.0, 255, 255, 255, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_DARK){ SetHudTextParams(-1.0, 0.67, 1.0, 25, 25, 25, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_GREEN){ SetHudTextParams(-1.0, 0.67, 1.0, 50, 200, 0, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_RED){ SetHudTextParams(-1.0, 0.67, 1.0, 255, 0, 0, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_CUSTOM){ SetHudTextParams(-1.0, 0.67, 1.0, g_iClientSpeedoColourCustom[client][0], g_iClientSpeedoColourCustom[client][1], g_iClientSpeedoColourCustom[client][2], 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW){ int iRandRedBool = GetRandomInt(0,1); int iRandGreenBool = GetRandomInt(0,1); int iRandBlueBool = GetRandomInt(0,1); if (iRandRedBool){ g_iClientSpeedoColourCustom[client][0]++; } else{ g_iClientSpeedoColourCustom[client][0]--; } if (iRandGreenBool){ g_iClientSpeedoColourCustom[client][1]++; } else{ g_iClientSpeedoColourCustom[client][1]--; } 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 { SetHudTextParams(-1.0, 0.67, 1.0, 255, 50, 50, 255); } ShowSyncHudText(client, SpeedOMeter, "%.0f u/s", currentSpd); } //VELOCIMETER TEXT: if(velocimeter[client]) { if(g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE) { SetHudTextParams(-1.0, 0.63, 1.0, 50, 100, 200, 255); } else if(g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT) { SetHudTextParams(-1.0, 0.63, 1.0, 255, 255, 255, 255); } else if(g_iClientVelocimeterColour[client] == VELOCIMETER_DARK) { SetHudTextParams(-1.0, 0.63, 1.0, 25, 25, 25, 255); } else if(g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN) { SetHudTextParams(-1.0, 0.63, 1.0, 50, 200, 0, 255); } else if(g_iClientVelocimeterColour[client] == VELOCIMETER_RED) { SetHudTextParams(-1.0, 0.63, 1.0, 255, 0, 0, 255); } else if(g_iClientVelocimeterColour[client] == VELOCIMETER_CUSTOM) { SetHudTextParams(-1.0, 0.63, 1.0, g_iClientVelocimeterColourCustom[client][0], g_iClientVelocimeterColourCustom[client][1], g_iClientVelocimeterColourCustom[client][2], 255); } else if(g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) { int iRandRedBoolV = GetRandomInt(0,1); int iRandGreenBoolV = 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]--; } SetHudTextParams(-1.0, 0.63, 1.0, g_iClientVelocimeterColourCustom[client][0], g_iClientVelocimeterColourCustom[client][1], g_iClientVelocimeterColourCustom[client][2], 255, 0); } else { SetHudTextParams(-1.0, 0.63, 1.0, 20, 255, 20, 255); } ShowSyncHudText(client, VelociMeter, "%.0f u/s", currentVelo); } }
Texte modifié
Ouvrir un fichier
#pragma semicolon 1 #pragma newdecls required #define PLUGIN_VERSION "1.0.1" #include <sourcemod> bool speedo[MAXPLAYERS] , 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 = { name = "Speedometer", author = "CrancK (modified for Tempus)", description = "Speedometer", version = PLUGIN_VERSION, url = "" }; public void OnPluginStart() { CreateConVar("sm_speedo_version", PLUGIN_VERSION, "Speedometer Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY); RegConsoleCmd("sm_speedo", Command_Speedo); RegConsoleCmd("sm_speedoblue", Speedo_Blue); RegConsoleCmd("sm_speedolight", Speedo_Light); RegConsoleCmd("sm_speedodark", Speedo_Dark); RegConsoleCmd("sm_speedogreen", Speedo_Green); RegConsoleCmd("sm_speedored", Speedo_Red); RegConsoleCmd("sm_speedocustom", Speedo_Custom); RegConsoleCmd("sm_speedorainbow", Speedo_Rainbow); SpeedOMeter = CreateHudSynchronizer(); RegConsoleCmd("sm_velocimeter", Command_VelociMeter); RegConsoleCmd("sm_velocimeterblue", Velocimeter_Blue); RegConsoleCmd("sm_velocimeterlight", Velocimeter_Light); RegConsoleCmd("sm_velocimeterdark", Velocimeter_Dark); RegConsoleCmd("sm_velocimetergreen", Velocimeter_Green); RegConsoleCmd("sm_velocimeterred", Velocimeter_Red); RegConsoleCmd("sm_velocimetercustom", Velocimeter_Custom); RegConsoleCmd("sm_velocimeterrainbow", Velocimeter_Rainbow); VelociMeter = CreateHudSynchronizer(); } public void OnClientPutInServer(int client) { speedo[client] = false; g_iClientSpeedoColour[client] = SPEEDO_NORMAL; g_iClientSpeedoColourCustom[client][0] = 255; g_iClientSpeedoColourCustom[client][1] = 50; g_iClientSpeedoColourCustom[client][2] = 50; velocimeter[client] = false; g_iClientVelocimeterColour[client] = VELOCIMETER_NORMAL; g_iClientVelocimeterColourCustom[client][0] = 20; g_iClientVelocimeterColourCustom[client][1] = 255; g_iClientVelocimeterColourCustom[client][2] = 20; } //----------------------------------SPEEDO---------------------------------- public Action Command_Speedo(int client, int args) { speedo[client] = !speedo[client]; ReplyToCommand(client, "Speedo %s", speedo[client] ? "On": "Off"); return Plugin_Handled; } public Action Speedo_Blue(int client, int args) { g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_BLUE) ? SPEEDO_NORMAL : SPEEDO_BLUE; ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_BLUE) ? "default" : "blue"); return Plugin_Handled; } public Action Speedo_Light(int client, int args) { g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_LIGHT) ? SPEEDO_NORMAL : SPEEDO_LIGHT; ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_LIGHT) ? "default" : "lighter"); return Plugin_Handled; } public Action Speedo_Dark(int client, int args) { g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_DARK) ? SPEEDO_NORMAL : SPEEDO_DARK; ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_DARK) ? "default" : "darker"); return Plugin_Handled; } public Action Speedo_Green(int client, int args) { g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_GREEN) ? SPEEDO_NORMAL : SPEEDO_GREEN; ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_GREEN) ? "default" : "green"); return Plugin_Handled; } public Action Speedo_Red(int client, int args) { g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_RED) ? SPEEDO_NORMAL : SPEEDO_RED; ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_RED) ? "default" : "red"); return Plugin_Handled; } public Action Speedo_Custom(int client, int args) { if (args < 3) { ReplyToCommand(client, "Please enter three numbers"); return Plugin_Handled; } bool bRedZeroCheck = true , bGreenZeroCheck = true , bBlueZeroCheck = true; char arg1[4] , arg2[4] , arg3[4]; //char sInputCheck[3][3]; GetCmdArg(1, arg1, sizeof(arg1)); GetCmdArg(2, arg2, sizeof(arg2)); GetCmdArg(3, arg3, sizeof(arg3)); /*for (int i = 0; i > 3; i++){ sInputCheck[i][i] = arg1[i]; sInputCheck[i][i] = arg2[i]; sInputCheck[i][i] = arg3[i]; } */ if (!StrEqual(arg1[0], "0")) { bRedZeroCheck = false; } if (!StrEqual(arg2[0], "0")) { bGreenZeroCheck = false; } if (!StrEqual(arg3[0], "0")) { bBlueZeroCheck = false; } int red = StringToInt(arg1) , green = StringToInt(arg2) , blue = StringToInt(arg3); //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); if ((red == 0 && bRedZeroCheck == false) || (green == 0 && bGreenZeroCheck == false) || (blue == 0 && bBlueZeroCheck == false)) { ReplyToCommand(client, "Please enter in numbers"); return Plugin_Handled; } if ((0 <= red <= 255) && (0 <= green <= 255) && (0 <= blue <= 255)) { g_iClientSpeedoColour[client] = SPEEDO_CUSTOM; ReplyToCommand(client, "Speedo is now (%d, %d, %d)", red, green, blue); g_iClientSpeedoColourCustom[client][0] = red; g_iClientSpeedoColourCustom[client][1] = green; g_iClientSpeedoColourCustom[client][2] = blue; return Plugin_Handled; } ReplyToCommand(client, "Please enter numbers between 0 and 255"); return Plugin_Handled; } public Action Speedo_Rainbow(int client, int args) { g_iClientSpeedoColour[client] = (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW) ? SPEEDO_NORMAL : SPEEDO_RAINBOW; ReplyToCommand(client, "Speedo is %s", (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW) ? "default" : "fabulous"); return Plugin_Handled; } //----------------------------------VELOCIMETER---------------------------------- //toggling velocimeter using command public Action Command_VelociMeter(int client, int args) { velocimeter[client] = !velocimeter[client]; ReplyToCommand(client, "Velocimeter %s", velocimeter[client] ? "ON" : "OFF"); return Plugin_Handled; } //velocimeter blue [VALUE = 1] public Action Velocimeter_Blue(int client, int args) { g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE) ? VELOCIMETER_NORMAL : VELOCIMETER_BLUE; ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE) ? "default" : "blue"); return Plugin_Handled; } //velocimeter light [VALUE = 2] public Action Velocimeter_Light(int client, int args) { g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT) ? VELOCIMETER_NORMAL : VELOCIMETER_LIGHT; ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT) ? "default" : "lighter"); return Plugin_Handled; } //velocimeter dark [VALUE = 3] public Action Velocimeter_Dark(int client, int args) { g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_DARK) ? VELOCIMETER_NORMAL : VELOCIMETER_DARK; ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_DARK) ? "default" : "darker"); return Plugin_Handled; } //velocimeter green [VALUE = 4] public Action Velocimeter_Green(int client, int args) { g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN) ? VELOCIMETER_NORMAL : VELOCIMETER_GREEN; ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN) ? "default" : "green"); return Plugin_Handled; } //velocimeter red [VALUE = 5] public Action Velocimeter_Red(int client, int args) { g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_RED) ? VELOCIMETER_NORMAL : VELOCIMETER_RED; ReplyToCommand(client, "Velocimeter is %s", (g_iClientVelocimeterColour[client] == VELOCIMETER_RED) ? "default" : "red"); return Plugin_Handled; } //velocimeter custom [VALUE = 6] public Action Velocimeter_Custom(int client, int args) { //if client does not give valid RGB values if (args < 3) { ReplyToCommand(client, "Please enter three numbers"); return Plugin_Handled; } bool bRedZeroCheckV = true , bGreenZeroCheckV = true , bBlueZeroCheckV = true; char Varg1[4] , Varg2[4] , Varg3[4]; GetCmdArg(1, Varg1, sizeof(Varg1)); GetCmdArg(2, Varg2, sizeof(Varg2)); GetCmdArg(3, Varg3, sizeof(Varg3)); if (!StrEqual(Varg1[0], "0")) { bRedZeroCheckV = false; } if (!StrEqual(Varg2[0], "0")) { bGreenZeroCheckV = false; } if (!StrEqual(Varg3[0], "0")) { bBlueZeroCheckV = false; } int Vred = StringToInt(Varg1) , Vgreen = StringToInt(Varg2) , Vblue = StringToInt(Varg3); if ((Vred == 0 && bRedZeroCheckV == false) || (Vgreen == 0 && bGreenZeroCheckV == false) || (Vblue == 0 && bBlueZeroCheckV == false)) { ReplyToCommand(client, "Please enter in numbers"); return Plugin_Handled; } if ((0 <= Vred <= 255) && (0 <= Vgreen <= 255) && (0 <= Vblue <= 255)) { g_iClientVelocimeterColour[client] = VELOCIMETER_CUSTOM; ReplyToCommand(client, "Velocimeter is now (%d, %d, %d)", Vred, Vgreen, Vblue); g_iClientVelocimeterColourCustom[client][0] = Vred; g_iClientVelocimeterColourCustom[client][1] = Vgreen; g_iClientVelocimeterColourCustom[client][2] = Vblue; return Plugin_Handled; } ReplyToCommand(client, "Please enter numbers between 0 and 255"); return Plugin_Handled; } //velocimeter rainbow [VALUE = 7] public Action Velocimeter_Rainbow(int client, int args) { //if client's velocimeter is already rainbow, make it default color g_iClientVelocimeterColour[client] = (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) ? VELOCIMETER_NORMAL : VELOCIMETER_RAINBOW; ReplyToCommand(client, "Velocimeter is default", (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) ? "default" : "fabulous"); return Plugin_Handled; } //-------------------------------------------------------------------------- //calculating speed/velocity and displaying on screen public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon) { float currentVel[3] , currentSpd , currentVelo; GetEntPropVector(client, Prop_Data, "m_vecVelocity", currentVel); currentSpd = SquareRoot((currentVel[0]*currentVel[0]) + (currentVel[1]*currentVel[1])); currentVelo = SquareRoot((currentVel[0]*currentVel[0])+(currentVel[1]*currentVel[1])+(currentVel[2]*currentVel[2])); //SPEEDO TEXT: if (speedo[client]) { if (g_iClientSpeedoColour[client] == SPEEDO_BLUE) { SetHudTextParams(-1.0, 0.67, 1.0, 50, 100, 200, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_LIGHT) { SetHudTextParams(-1.0, 0.67, 1.0, 255, 255, 255, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_DARK) { SetHudTextParams(-1.0, 0.67, 1.0, 25, 25, 25, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_GREEN) { SetHudTextParams(-1.0, 0.67, 1.0, 50, 200, 0, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_RED) { SetHudTextParams(-1.0, 0.67, 1.0, 255, 0, 0, 255); } else if (g_iClientSpeedoColour[client] == SPEEDO_CUSTOM) { SetHudTextParams( -1.0 , 0.67 , 1.0 , g_iClientSpeedoColourCustom[client][0] , g_iClientSpeedoColourCustom[client][1] , g_iClientSpeedoColourCustom[client][2] , 255 ); } else if (g_iClientSpeedoColour[client] == SPEEDO_RAINBOW) { int iRandRedBool = GetRandomInt(0,1) , iRandGreenBool = GetRandomInt(0,1) , iRandBlueBool = GetRandomInt(0,1); iRandRedBool ? g_iClientSpeedoColourCustom[client][0]++ : g_iClientSpeedoColourCustom[client][0]--; iRandGreenBool ? g_iClientSpeedoColourCustom[client][1]++ : g_iClientSpeedoColourCustom[client][1]--; iRandBlueBool ? g_iClientSpeedoColourCustom[client][2]++ : 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 { SetHudTextParams(-1.0, 0.67, 1.0, 255, 50, 50, 255); } ShowSyncHudText(client, SpeedOMeter, "%.0f u/s", currentSpd); } //VELOCIMETER TEXT: if (velocimeter[client]) { if (g_iClientVelocimeterColour[client] == VELOCIMETER_BLUE) { SetHudTextParams(-1.0, 0.63, 1.0, 50, 100, 200, 255); } else if (g_iClientVelocimeterColour[client] == VELOCIMETER_LIGHT) { SetHudTextParams(-1.0, 0.63, 1.0, 255, 255, 255, 255); } else if (g_iClientVelocimeterColour[client] == VELOCIMETER_DARK) { SetHudTextParams(-1.0, 0.63, 1.0, 25, 25, 25, 255); } else if (g_iClientVelocimeterColour[client] == VELOCIMETER_GREEN) { SetHudTextParams(-1.0, 0.63, 1.0, 50, 200, 0, 255); } else if (g_iClientVelocimeterColour[client] == VELOCIMETER_RED) { SetHudTextParams(-1.0, 0.63, 1.0, 255, 0, 0, 255); } else if (g_iClientVelocimeterColour[client] == VELOCIMETER_CUSTOM) { SetHudTextParams(-1.0, 0.63, 1.0, g_iClientVelocimeterColourCustom[client][0], g_iClientVelocimeterColourCustom[client][1], g_iClientVelocimeterColourCustom[client][2], 255); } else if (g_iClientVelocimeterColour[client] == VELOCIMETER_RAINBOW) { int iRandRedBoolV = GetRandomInt(0,1) , iRandGreenBoolV = GetRandomInt(0,1) , iRandBlueBoolV = GetRandomInt(0,1); 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, g_iClientVelocimeterColourCustom[client][0], g_iClientVelocimeterColourCustom[client][1], g_iClientVelocimeterColourCustom[client][2], 255, 0); } else { SetHudTextParams(-1.0, 0.63, 1.0, 20, 255, 20, 255); } ShowSyncHudText(client, VelociMeter, "%.0f u/s", currentVelo); } }
Trouver la différence