Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #define DEBUG
- #define PLUGIN_AUTHOR "codingcow"
- #define PLUGIN_VERSION "1.01"
- #include <sourcemod>
- #include <sdktools>
- public Plugin myinfo =
- {
- name = "abstract-eventAdvert",
- author = PLUGIN_AUTHOR,
- description = "",
- version = PLUGIN_VERSION,
- url = ""
- }
- #pragma newdecls required
- ConVar g_cbEnable = null;
- ConVar g_csMsg = null;
- ConVar g_cfTimerPeriod = null;
- ConVar g_cfXPos = null;
- ConVar g_cfYPos = null;
- ConVar g_cfMsgHoldTime = null;
- ConVar g_ciRed = null;
- ConVar g_ciGreen = null;
- ConVar g_ciBlue = null;
- ConVar g_ciAlpha = null;
- public void OnPluginStart()
- {
- // RegAdminCmd("sm_showmsg", Command_Showmsg, ADMFLAG_ROOT, "Message displayed");
- g_cbEnable = CreateConVar("advert_hudmsg_enable", "1", "Enable or disable the hud message from being displayed", 0, true, 0.0, true, 1.0);
- g_csMsg = CreateConVar("advert_hudmsg", "Advert Hud Message Default", "This is the message you would like displayed", _);
- g_cfTimerPeriod = CreateConVar("advert_hudmsg_period", "300", "How often to display the hud message", _, true, 1.0, true, 999.0);
- g_cfXPos = CreateConVar("advert_hudmsg_x", "-1.0", "x-axis position", _, true, -1.0, true, 1.0);
- g_cfYPos = CreateConVar("advert_hudmsg_y", "0.10", "y-axis position", _, true, -1.0, true, 1.0);
- g_cfMsgHoldTime = CreateConVar("advert_hudmsg_time", "10", "how long to display the center hud message", _, true, 0.0);
- g_ciRed = CreateConVar("advert_hudmsg_r", "0", "red color", _, true, 0.0, true, 255.0);
- g_ciGreen = CreateConVar("advert_hudmsg_g", "190", "green color", _, true, 0.0, true, 255.0);
- g_ciBlue = CreateConVar("advert_hudmsg_b", "255", "blue color", _, true, 0.0, true, 255.0);
- g_ciAlpha = CreateConVar("advert_hudmsg_alpha", "225", "transparancy value", _, true, 0.0, true, 255.0);
- AutoExecConfig(true, "hud-adverts");
- CreateTimer(g_cfTimerPeriod.FloatValue, doPrint, _, TIMER_REPEAT);
- }
- public Action doPrint(Handle timer)
- {
- if(g_cbEnable.BoolValue)
- {
- char sMsg[256];
- g_csMsg.GetString(sMsg, sizeof(sMsg));
- SetHudTextParams(g_cfXPos.FloatValue, g_cfYPos.FloatValue, g_cfMsgHoldTime.FloatValue, g_ciRed.IntValue, g_ciGreen.IntValue, g_ciBlue.IntValue, g_ciAlpha.IntValue);
- for (int i = 1; i <= MaxClients; i++)
- {
- if (IsClientInGame(i) && !IsFakeClient(i))
- {
- ShowHudText(i, 6, sMsg); //int ShowHudText(int client, int channel, const char[] message, any ...)
- }
- }
- }
- }
- /*
- public Action:Command_Showmsg(client, args)
- {
- doPrint();
- return Plugin_Handled;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment