Raised This Month: $ Target: $400
 0% 

[DONE]How to make permanent HUD message?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-30-2011 , 05:08   [DONE]How to make permanent HUD message?
Reply With Quote #1

Title.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067

Last edited by Evaldas.Grigas; 10-30-2011 at 09:02.
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
plowed
Senior Member
Join Date: Oct 2010
Location: germany
Old 10-30-2011 , 05:30   Re: How to make permanent HUD message?
Reply With Quote #2

search
__________________
Zombie Mod + gameMe stats :
plowed is offline
datka888
Member
Join Date: Oct 2011
Old 10-30-2011 , 05:52   Re: How to make permanent HUD message?
Reply With Quote #3

Try This.
CVARS Copy To amxx.cfg
amx_permanent_message "Your advertisement here"
amx_permanent_message_color "255 255 255"
amx_permanent_message_location 3

Quote:
/*
*
*
* * * ***** ***** * ***** * * ***** * * * *
* * * * * * * * * * ** * * ** * * * *
* ****** ****** ****** * * ****** * * * * * * * * * * *
* * * * * ******* * * * * * * * * * * * *
* * * ***** ***** * * ***** * * ***** * * * *
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* AMX MOD X script. *
* Plugin made by He3aBuCuM(a.k.a. independent). *
* Important! You can modify the code, but DO NOT modify the author! *
* Contacts with me: *
* E-mail: [email protected] *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Special thanks to: *
* [email protected] - for the optimization on my first version *
* [email protected] - tell me for the clamp native *
* [email protected] - tell me how to use ShowSyncHudMsg and some ideas *
* [email protected] - for the idea amx_permanent_message_show *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
*
*/

#include <amxmodx>
#include <amxmisc>

new cvar_message, cvar_color, cvar_location, cvar_effects, cvar_show, cvar_cmd, hudsync

public plugin_init() {
register_plugin("Permanent message", "1.1", "He3aBuCuM")
cvar_message = register_cvar("amx_permanent_message", "Your/nadvertisement%new%here")
cvar_color = register_cvar("amx_permanent_message_color", "255 255 255")
cvar_location = register_cvar("amx_permanent_message_location ", "3")
cvar_effects = register_cvar("amx_permanent_message_effects" , "0")
cvar_show = register_cvar("amx_permanent_message_show", "0")
cvar_cmd = register_cvar("amx_permanent_message_cmd", "1")
register_concmd("amx_perm_msg", "cmdChangeMsg", ADMIN_LEVEL_A)
hudsync = CreateHudSyncObj()
set_task(1.0, "show_hud", 0, "", 0, "b")
}

public show_hud() {
new message[200], location, eff, show, players[32], inum
static red, green, blue
get_pcvar_string(cvar_message, message, charsmax(message))
get_hud_color(red, green, blue)
location = get_pcvar_num(cvar_location)
eff = clamp(get_pcvar_num(cvar_effects), 0, 2)
show = get_pcvar_num(cvar_show)
get_players(players, inum)

replace_all(message, charsmax(message), "%new%", "^n")
replace_all(message, charsmax(message), "/n", "^n")

switch(location) {
case 1: set_hudmessage(red, green, blue, 0.01, 0.15, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 2: set_hudmessage(red, green, blue, -1.0, 0.15, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 3: set_hudmessage(red, green, blue, 0.99, 0.15, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 4: set_hudmessage(red, green, blue, 0.01, -1.0, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 5: set_hudmessage(red, green, blue, -1.0, -1.0, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 6: set_hudmessage(red, green, blue, 0.99, -1.0, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 7: set_hudmessage(red, green, blue, 0.01, 0.75, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 8: set_hudmessage(red, green, blue, -1.0, 0.75, eff, 1.0, 1.0, 0.1, 0.2, -1)
case 9: set_hudmessage(red, green, blue, 0.99, 0.70, eff, 1.0, 1.0, 0.1, 0.2, -1)
}

for(new i=0; i<inum; ++i) {
switch(show) {
case 0: ShowSyncHudMsg(0, hudsync, message)
case 1: {
if(!is_user_alive(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
case 2: {
if(is_user_alive(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
case 3: {
if(is_user_admin(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
case 4: {
if(!is_user_admin(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
case 5: {
if(is_user_admin(players[i]) && is_user_alive(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
case 6: {
if(is_user_admin(players[i]) && !is_user_alive(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
case 7: {
if(!is_user_admin(players[i]) && is_user_alive(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
case 8: {
if(!is_user_admin(players[i]) && !is_user_alive(players[i]))
ShowSyncHudMsg(players[i], hudsync, message)
}
default: ShowSyncHudMsg(0, hudsync, message)
}
}
return PLUGIN_CONTINUE
}

public cmdChangeMsg(id, level, cid) {
if(!get_pcvar_num(cvar_cmd) || !cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED

new args[200], name[32]
read_args(args, charsmax(args))
remove_quotes(args)
get_user_name(id, name, charsmax(name))

set_pcvar_string(cvar_message, args)
log_amx("The admin ^"%s^" change the permanent message to ^"%s^"", name, args)

return PLUGIN_CONTINUE
}

get_hud_color(&r, &g, &b) {
new color[20]
static red[5], green[5], blue[5]
get_pcvar_string(cvar_color, color, charsmax(color))
parse(color, red, charsmax(red), green, charsmax(green), blue, charsmax(blue))

r = str_to_num(red)
g = str_to_num(green)
b = str_to_num(blue)
}

Last edited by datka888; 10-30-2011 at 05:55.
datka888 is offline
Send a message via Skype™ to datka888
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 10-30-2011 , 05:57   Re: How to make permanent HUD message?
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <amxmisc>
new g_msgScreenFade_bh
public plugin_init()
{
 
register_plugin"PermHud""1.0""PermHud" )
 
set_task0.5 "perm_hud")
 
g_MsgSync_bh CreateHudSyncObj()
}

public 
perm_hud()
{
   
 
set_hudmessage(250000.75, -1.010.50.51.01.0, -1)
 
ShowSyncHudMsg(idg_MsgSync_bh"Perm Hud!"
 
set_task0.5 "perm_hud")

.Dare Devil. is offline
Old 10-30-2011, 06:13
Evaldas.Grigas
This message has been deleted by Evaldas.Grigas. Reason: Fixed.
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 10-30-2011 , 06:15   Re: How to make permanent HUD message?
Reply With Quote #5

Quote:
Originally Posted by .Dare Devil. View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
new g_msgScreenFade_bh
public plugin_init()
{
 
register_plugin"PermHud""1.0""PermHud" )
 
set_task0.5 "perm_hud")
 
g_MsgSync_bh CreateHudSyncObj()
}

public 
perm_hud()
{
   
 
set_hudmessage(250000.75, -1.010.50.51.01.0, -1)
 
ShowSyncHudMsg(idg_MsgSync_bh"Perm Hud!"
 
set_task0.5 "perm_hud")

this method will greatly consume server resources

Last edited by Backstabnoob; 10-30-2011 at 06:15.
Backstabnoob is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-30-2011 , 06:16   Re: How to make permanent HUD message?
Reply With Quote #6

Why this doesn't work then?
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "HUD Message"
#define VERSION "1.0"
#define AUTHOR "Evaldas.Grigas"


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
set_task0.5 "PermanentHUD")
}

public 
PermanentHUD()
{
    new 
CurrentDate[32]
    new 
CurrentTime[9]
    new 
CurrentMap[33]
    
    
get_mapname (CurrentMap32
    
get_time("%Y:%m:%d"CurrentDate31)
    
get_time("%H:%M:%S"CurrentTime8)
    
    
set_hudmessage(000, -0.850.0100.50.51.01.0, -1)
    
show_hudmessage(0"Date: %s"CurrentDate)
    
set_hudmessage(000, -0.850.0401.01.00.10.2, -1)
    
show_hudmessage(0"Time: %s"CurrentTime)
    
set_hudmessage(000, -0.850.0701.01.00.10.2, -1)
    
show_hudmessage(0"Map: %s"CurrentMap)

__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 10-30-2011 , 06:18   Re: How to make permanent HUD message?
Reply With Quote #7

If you want to know why it doesn't work, it's because the task is not looped infinitely. Look for set_task() on funcwiki.

If you want to know why that code sucks and will lag your server, use search, I already explained somewhere what is a better solution.

Last edited by Backstabnoob; 10-30-2011 at 06:18.
Backstabnoob is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-30-2011 , 06:21   Re: How to make permanent HUD message?
Reply With Quote #8

Maybe there is a perm message plugin already made? I need that it would show date, time, map and timeleft.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 10-30-2011 , 08:49   Re: How to make permanent HUD message?
Reply With Quote #9

Quote:
Originally Posted by Evaldas.Grigas View Post
Maybe there is a perm message plugin already made? I need that it would show date, time, map and timeleft.
PHP Code:
#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN "HUD Message"
#define VERSION "1.0"
#define AUTHOR "Evaldas.Grigas"
 
 
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
set_task0.5 "PermanentHUD")
}
 
public 
PermanentHUD()
{
    new 
CurrentDate[32]
    new 
CurrentTime[9]
    new 
CurrentMap[33]
 
    
get_mapname (CurrentMap32
    
get_time("%Y:%m:%d"CurrentDate31)
    
get_time("%H:%M:%S"CurrentTime8)
 
    
set_hudmessage(000, -0.850.0100.50.51.01.0, -1)
    
show_hudmessage(0"Date: %s"CurrentDate)
    
set_hudmessage(000, -0.850.0401.01.00.10.2, -1)
    
show_hudmessage(0"Time: %s"CurrentTime)
    
set_hudmessage(000, -0.850.0701.01.00.10.2, -1)
    
show_hudmessage(0"Map: %s"CurrentMap)
 
    
set_task0.5 "PermanentHUD")

Its dont take more res. its a hud message like zp.

Last edited by .Dare Devil.; 10-30-2011 at 08:49.
.Dare Devil. is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 10-30-2011 , 09:01   Re: How to make permanent HUD message?
Reply With Quote #10

Already done everything I wanted. Thanks for answers.
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode