adjust some changes + rename

This commit is contained in:
DoganGFL 2018-12-05 15:40:22 +01:00
parent 548cfb844d
commit ebd550190b

View File

@ -14,24 +14,25 @@ ConVar g_cMessageText;
float MessagePos[2]; float MessagePos[2];
int MessageColor[3]; int MessageColor[3];
char MessageTxt[512];
Handle MessageTimer; Handle MessageTimer;
Handle MessageSync; Handle MessageSync;
public Plugin myinfo = public Plugin myinfo =
{ {
name = "SpamNotification", name = "SpamMessage",
author = "Dogan", author = "Dogan",
description = "Provide the server with important informations/advertisements", description = "Provide the server with important informations/advertisements",
version = "1.0.0", version = "1.1.0",
url = "" url = ""
} }
public void OnPluginStart() public void OnPluginStart()
{ {
g_cMessagePosition = CreateConVar("sm_message_position", "-1.0 0.8", "The x and y positions for the message"); g_cMessagePosition = CreateConVar("sm_message_position", "-1.0 0.8125", "The x and y positions for the message");
g_cMessageColor = CreateConVar("sm_message_color", "0 255 0", "RGB color value for the message"); g_cMessageColor = CreateConVar("sm_message_color", "0 255 0", "RGB color value for the message");
g_cMessageCooldown = CreateConVar("sm_message_cooldown", "120", "Cooldown of the message in seconds"); g_cMessageCooldown = CreateConVar("sm_message_cooldown", "180", "Cooldown of the message in seconds");
g_cMessageText = CreateConVar("sm_message_text", "UNLOZE Christmas Sale: 25'%' on all VIP Offers. Check www.unloze.com for more info", "text thats shown at the message"); g_cMessageText = CreateConVar("sm_message_text", "UNLOZE Christmas Sale: 25%% on all VIP Offers. Check www.unloze.com for more info.", "Text thats shown on the message");
g_cMessagePosition.AddChangeHook(ConVarChange); g_cMessagePosition.AddChangeHook(ConVarChange);
g_cMessageColor.AddChangeHook(ConVarChange); g_cMessageColor.AddChangeHook(ConVarChange);
@ -40,7 +41,7 @@ public void OnPluginStart()
MessageSync = CreateHudSynchronizer(); MessageSync = CreateHudSynchronizer();
AutoExecConfig(true, "plugin.SpamNotification"); AutoExecConfig(true, "plugin.SpamMessage");
GetConVars(); GetConVars();
} }
@ -69,6 +70,8 @@ public void GetConVars()
ColorStringToArray(ColorValue, MessageColor); ColorStringToArray(ColorValue, MessageColor);
g_cMessageText.GetString(MessageTxt, sizeof(MessageTxt));
if (MessageTimer != INVALID_HANDLE && CloseHandle(MessageTimer)) if (MessageTimer != INVALID_HANDLE && CloseHandle(MessageTimer))
MessageTimer = INVALID_HANDLE; MessageTimer = INVALID_HANDLE;
@ -82,13 +85,13 @@ public void ConVarChange(ConVar convar, char[] oldValue, char[] newValue)
public void SendMessage() public void SendMessage()
{ {
SetHudTextParams(MessagePos[0], MessagePos[1], 5.0, MessageColor[0], MessageColor[1], MessageColor[2], 255, 1, 3.0, 0.4, 0.4); SetHudTextParams(MessagePos[0], MessagePos[1], 6.0, MessageColor[0], MessageColor[1], MessageColor[2], 255, 1, 4.0, 0.8, 0.8);
for (int client = 1; client <= MAXPLAYERS; client++) for (int client = 1; client <= MAXPLAYERS; client++)
{ {
if (IsClientConnected(client)) if (IsClientConnected(client))
{ {
ShowSyncHudText(client, MessageSync, g_cMessageText); ShowSyncHudText(client, MessageSync, MessageTxt);
} }
} }
} }