Member
|
02-07-2022
, 08:34
Re: scrollmsg
|
#2
|
Online Admin and VIP,death display
imessage_in_die+op.sma
Code:
#include <amxmodx>
#include <amxmisc>
#define MAX_MESSAGES 100
#define X_POS -1.0
#define Y_POS 0.12
#define HOLD_TIME 12.0
#define RANDOM_COL
new g_Values[MAX_MESSAGES][3]
new g_Messages[MAX_MESSAGES][384]
new g_MessagesNum
new g_Current
new g_players[32]
new num
public plugin_init() {
register_plugin("Info. Messages",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("imessage.txt")
register_dictionary("common.txt")
register_srvcmd("amx_imessage","setMessage")
register_cvar("amx_freq_imessage","10")
new lastinfo[8]
get_localinfo("lastinfomsg",lastinfo,7)
g_Current = str_to_num(lastinfo)
set_localinfo("lastinfomsg","")
}
public infoMessage() {
new admin[128],vip[128],temp[768]
new ad_vip[32],p_num,ad_num,v_num,name[32]
new apos = 0
new vpos = 0
if (g_Current >= g_MessagesNum)
g_Current = 0
get_players(ad_vip,p_num,"c")
apos += format(admin[apos],127-apos,"^nCurrent On-Line Admin:^n")
vpos += format(vip[vpos],127-vpos,"^nOn-Line VIP:^n")
for (new i=0; i<p_num; i++) {
if(access(ad_vip[i],ADMIN_IMMUNITY)){
ad_num++
get_user_name(ad_vip[i],name,31)
apos += format(admin[apos],127-apos,"%s ",name)
}
if(access(ad_vip[i],ADMIN_RESERVATION) && !access(ad_vip[i],ADMIN_IMMUNITY)){
v_num++
get_user_name(ad_vip[i],name,31)
vpos += format(vip[vpos],127-vpos,"%s ",name)
}
}
if (ad_num == 0)
format(admin,127,"Non")
if (v_num == 0)
format(vip,127,"Non")
format(temp,767,"%s^n—————————————%s%s",g_Messages[g_Current],admin,vip)
#if defined RANDOM_COL
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255),
X_POS, Y_POS, 2, 0.1, HOLD_TIME , 0.1, 0.1, -1)
#else
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2],
X_POS, Y_POS, 2, 0.1, HOLD_TIME , 0.1, 0.1, -1)
#endif
get_players(g_players,num,"bc")
for (new i=0; i<num; i++){
show_hudmessage(g_players[i],temp)
client_print(g_players[i],print_console,temp)
}
++g_Current
new Float:freq_im = get_cvar_float("amx_freq_imessage")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
}
public setMessage() {
if (g_MessagesNum >= MAX_MESSAGES) {
server_print("%L",LANG_SERVER,"INF_REACH")
return PLUGIN_HANDLED
}
remove_task(12345)
read_argv(1,g_Messages[g_MessagesNum],380)
new hostname[64]
get_cvar_string("hostname",hostname,63)
replace(g_Messages[g_MessagesNum],380,"%hostname%",hostname)
while(replace(g_Messages[g_MessagesNum],380,"\n","^n")){}
new mycol[12]
read_argv(2,mycol,11) // RRRGGGBBB
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
mycol[6] = 0
g_Values[g_MessagesNum][1] = str_to_num(mycol[3])
mycol[3] = 0
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])
g_MessagesNum++
new Float:freq_im = get_cvar_float("amx_freq_imessage")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
return PLUGIN_HANDLED
}
public plugin_end() {
new lastinfo[8]
num_to_str(g_Current,lastinfo,7)
set_localinfo("lastinfomsg",lastinfo)
}
Scrolling word shows online admin and VIP
hud_vipop.sma
Code:
#include <amxmodx>
#include <amxmisc>
#define RGB_R 255
#define RGB_G 100
#define RGB_B 150
#define SPEED 0.3
#define SCROLLMSG_SIZE 512
new g_startPos
new g_endPos
new g_scrollMsg[SCROLLMSG_SIZE]
new g_displayMsg[SCROLLMSG_SIZE]
new Float:g_xPos
new g_Length
public plugin_init()
{
register_plugin("Display OP/VIP HUD","1.0","731")
}
public showMsg()
{
new a = g_startPos, i = 0
while (a < g_endPos)
g_displayMsg[i++] = g_scrollMsg[a++]
g_displayMsg[i] = 0
if (g_endPos < g_Length)
g_endPos++
if (g_xPos > 0.35)
g_xPos -= 0.0063
else
{
g_startPos++
g_xPos = 0.35
}
if(g_startPos>=g_endPos)
{
msgInit()
return
}
set_hudmessage(RGB_R, RGB_G, RGB_B, g_xPos, 0.90, 0, SPEED, SPEED, 0.05, 0.05, 2)
show_hudmessage(0, "%s", g_displayMsg)
}
public msgInit()
{
g_endPos = 1
g_startPos = 0
g_xPos = 0.65
new p_list[32],p_count
new OPnum=-1
new VIPnum=-1
new i=0
new OPname[32][33],VIPname[32][33]
get_players(p_list,p_count,"c")//Skip Bot
new szName[33]
for(i=0;i<p_count;i++)
{
get_user_name(p_list[i],szName,32)
if(access(p_list[i],ADMIN_IMMUNITY))
{
OPnum++
copy(OPname[OPnum],32,szName)
continue;
}
if(access(p_list[i],ADMIN_RESERVATION)&&(!access(p_list[i],ADMIN_IMMUNITY)))
{
VIPnum++
copy(VIPname[VIPnum],32,szName)
continue;
}
}
format(g_scrollMsg,511,"OP List:")
if(OPnum>=0)
{
for(i=0;i<=OPnum;i++)
{
format(g_scrollMsg,511,"%s %s ;",g_scrollMsg,OPname[i])
}
}else
{
format(g_scrollMsg,511,"%s No online OP",g_scrollMsg)
}
format(g_scrollMsg,511,"%s||VIP List:",g_scrollMsg)
if(VIPnum>=0)
{
for(new i=0;i<=VIPnum;i++)
{
format(g_scrollMsg,511,"%s %s ;",g_scrollMsg,VIPname[i])
}
}else
{
format(g_scrollMsg,511,"%s No online VIP",g_scrollMsg)
}
g_Length = strlen(g_scrollMsg)
set_task(SPEED, "showMsg", 123, "", 0, "a", g_Length + 48)
server_print("%s", g_scrollMsg)
client_print(0, print_console, "%s", g_scrollMsg)
}
public plugin_cfg()
{
msgInit()
}
|
|