Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
공백 변경 숨기기
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
텍스트 스타일
모양 변경
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
Untitled diff
생성일
8년 전
비교 결과 만료 없음
초기화
내보내기
공유
설명
460 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
608 행
복사
293 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
418 행
복사
복사
복사됨
복사
복사됨
#include <sourcemod>
#pragma semicolon 1
#pragma semicolon 1
#pragma newdecls required
#pragma newdecls required
복사
복사됨
복사
복사됨
#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 = ""
};
};
복사
복사됨
복사
복사됨
//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, "Veloci
m
eter
%s", velocimeter[client] ? "ON" : "
OFF");
{
velocimeter[client]
= true;
ReplyToCommand(client, "Veloci
M
eter
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 {
SetHudTextParams(-1.0, 0.63, 1.0, 20, 255, 20, 255);
}
}
복사
복사됨
복사
복사됨
else {
ShowSyncHudText(client, VelociMeter, "%.0f u/s", currentVelo);
SetHudTextParams(-1.0, 0.63, 1.0, 20, 255, 20, 255);
}
ShowSyncHudText(client, VelociMeter, "%.0f u/s", currentVelo);
}
}
}
}
복사
복사됨
복사
복사됨
저장된 비교 결과
원본
파일 열기
#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); } }
수정본
파일 열기
#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); } }
비교하기