Raised This Month: $51 Target: $400
 12% 

Auto Message Displayer (Advertiser)


Post New Thread Reply   
 
Thread Tools Display Modes
happy_2012
Senior Member
Join Date: Aug 2012
Old 09-26-2012 , 17:20   Re: Auto Message Displayer (Advertiser)
Reply With Quote #151

any screen shots?
happy_2012 is offline
Old 09-27-2012, 15:23
tigo bitties
This message has been deleted by YamiKaitou. Reason: flaming/rude
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 09-28-2012 , 20:27   Re: Auto Message Displayer (Advertiser)
Reply With Quote #152

Small fixes to avoid problems:
- When messages limit is reached plugin simply writes to AMXX log 'Could not add new <type> message because <type> messages limit is reached; max = X' for you to know. But it continues reading config file. Also default limit is increased from 20 to 25 messages of each type.
- Added separate max length limit for text messages because to long messages lead to server crash.
Attached Files
File Type: sma Get Plugin or Get Source (GHW_Message_Disp_modified.sma - 762 views - 10.7 KB)
__________________

Last edited by isotonic; 09-28-2012 at 20:55.
isotonic is offline
windcs
Junior Member
Join Date: Feb 2009
Old 12-27-2012 , 17:48   Re: Auto Message Displayer (Advertiser)
Reply With Quote #153

Could you add some effects ? Like fade/scintillation/writing in one option ?
windcs is offline
lqlqlq
Senior Member
Join Date: Jan 2008
Old 01-09-2013 , 10:27   Re: Auto Message Displayer (Advertiser)
Reply With Quote #154

http://forums.alliedmods.net/showthread.php?p=1808585#post1808585
I need this plugins to show advertise only for players, except the admins with flag "a" - immunity.

Last edited by lqlqlq; 01-09-2013 at 10:49.
lqlqlq is offline
Praiano
Junior Member
Join Date: Nov 2007
Old 03-26-2013 , 18:59   Re: Auto Message Displayer (Advertiser)
Reply With Quote #155

Quote:
Originally Posted by isotonic View Post
Small fixes to avoid problems:
- When messages limit is reached plugin simply writes to AMXX log 'Could not add new <type> message because <type> messages limit is reached; max = X' for you to know. But it continues reading config file. Also default limit is increased from 20 to 25 messages of each type.
- Added separate max length limit for text messages because to long messages lead to server crash.
Hello friend, thank you for modifying this plugin. ~> GHW Auto Message Displayer.
But I would like to modify it again (simplify) for personal use. Can you help me and say if I did everything right and if the code is clean? Please!

My modifications:
I just wanted to remove part of the "HUD text" and use only the chat advert.
I also changed other thing you may see in the code. Please see. Thank you!

If someone can help me too, thank you very much!

chatad.txt is:
Code:
Message 1: [green]TEST[/green]
Message 1: [red]TEST[/red]
Message 1: [blue]TEST[/blue]
Attached Files
File Type: sma Get Plugin or Get Source (GHW_Message_Disp_modified (simple).sma - 631 views - 2.9 KB)

Last edited by Praiano; 03-26-2013 at 19:14. Reason: Add code for chatad.txt
Praiano is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-27-2013 , 22:57   Re: Auto Message Displayer (Advertiser)
Reply With Quote #156

Does it work?

"Clean" is very subjective. The biggest things that you might hear about coding style is "use consistent indentation (and other spacing)" and "use descriptive variable names" and maybe "comment your code".

Otherwise, if it works and you don't plan on releasing it then it's just fine as is.
__________________
fysiks is offline
Praiano
Junior Member
Join Date: Nov 2007
Old 03-28-2013 , 08:57   Re: Auto Message Displayer (Advertiser)
Reply With Quote #157

Quote:
Originally Posted by fysiks View Post
Does it work?

"Clean" is very subjective. The biggest things that you might hear about coding style is "use consistent indentation (and other spacing)" and "use descriptive variable names" and maybe "comment your code".

Otherwise, if it works and you don't plan on releasing it then it's just fine as is.
Hello, thanks for reading!
Yes it works, but I know nothing about programming and just wondering if there is something unnecessary in lines.
But if you think it's alright, I'll use it well. Thank you!

I made other changes and now the code looked like this!

PHP Code:
/*
*  It is NOT original version of GHW Auto Message Displayer plugin.
*  It is modified by Safety1st version.
*  There are small fixes to avoid problems when some limits are reached.
*/

/*
*   _______     _      _  __          __
*  | _____/    | |    | | \ \   __   / /
*  | |         | |    | |  | | /  \ | |
*  | |         | |____| |  | |/ __ \| |
*  | |   ___   | ______ |  |   /  \   |
*  | |  |_  |  | |    | |  |  /    \  |
*  | |    | |  | |    | |  | |      | |
*  | |____| |  | |    | |  | |      | |
*  |_______/   |_|    |_|  \_/      \_/
*
*
*
*  Last Edited: 06-21-08
*
*  ============
*   Changelog:
*  ============
*
*  v2.1
*    -Bug Fix
*    -Changed String lengths from 128 - 256
*
*  v2.0
*    -Remake
*
*  v1.0
*    -Initial Release
*
*/

#define VERSION    "2.2m"

#include <amxmodx>
#include <amxmisc>

#define NUM_MESSAGES    25
#define STRING_LEN    256
#define TEXT_LEN    192    // max allowed text message length

static const configfile[] = "addons/amxmodx/configs/chatad.ini"
new text_messages[NUM_MESSAGES][TEXT_LEN]
new 
saytext_msgid
new num_textmessagescur_textmessage

public plugin_init()
{
    
register_plugin("GHW Auto Message Displayer",VERSION,"GHW_Chronic")
    
    
register_cvar("sv_chatad_time","120.0")
    
    
saytext_msgid get_user_msgid("SayText")
    
    
read_configfile()
    
    if(
num_textmessagesset_task(get_cvar_float("sv_chatad_time"),"display_textmessage",0,"",0,"b")
}

public 
read_configfile()
{
    new 
Fsize file_size(configfile,/* return number of lines */)
    new 
read[STRING_LEN], trash
    
for(new i=0;i<Fsize;i++)
    {
        if(
num_textmessages==NUM_MESSAGES) {
            
log_amx("Could not add new text message because text message limit is reached; max = %d"NUM_MESSAGES)
            continue    
// do not read any text messages anymore
        
}
        
read_file(configfile,i,read,TEXT_LEN 1,trash)
        
replace_all(read,TEXT_LEN 1,"!t","^x03")
        
replace_all(read,TEXT_LEN 1,"!g","^x04")
        
replace_all(read,TEXT_LEN 1,"!n","^x01")
        
format(text_messages[num_textmessages],TEXT_LEN 1,"^x04^x01%s",read)
        
num_textmessages++
    }
}

public 
display_textmessage()
{
    new 
numplayers[32], player
    get_players
(players,num,"ch")
    for(new 
i=0;i<num;i++)
    {
        
player players[i]
        
        
message_begin(MSG_ONE,saytext_msgid,{0,0,0},player)
        
write_byte(player)
        
write_string(text_messages[cur_textmessage])
        
message_end()
    }
    
cur_textmessage = (cur_textmessage ) % num_textmessages



chatad.ini
Code:
Message 1: !gtest
Message 2: !ttest2
Message 3: test3
Praiano is offline
Dory
BANNED
Join Date: Feb 2012
Old 04-04-2013 , 08:41   Re: Auto Message Displayer (Advertiser)
Reply With Quote #158

Code:
Hud
[green]Visit our website: www.halflife.lv[/green]

Hud
[Green]To switch between servers write /server[/Green]

Hud
[Green]To switch between servers write /server[/Green]

Hud
[Green]To switch between servers write /server[/Green]

Text
Visit our website www.halflife.lv

Text
To switch between servers write /server

Text
Visit our TeamPlay Server: hl2.halflife.lv

Text
Player rankings: http://stats.halflife.lv

Text
To change map, write rtv in chat

Text
Want to become admin? Contact Skype: supportmu


This is my messages.ini , but i have problem, it displays only 2 of Hud messages, but with Text all is okey, why its like that?
Dory is offline
Send a message via Skype™ to Dory
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 04-04-2013 , 09:14   Re: Auto Message Displayer (Advertiser)
Reply With Quote #159

Are you using stream? Or running a non-steam server?
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
Dory
BANNED
Join Date: Feb 2012
Old 04-04-2013 , 14:25   Re: Auto Message Displayer (Advertiser)
Reply With Quote #160

Quote:
Originally Posted by DruGzOG View Post
Are you using stream? Or running a non-steam server?
Im not using steam. Thats nonsteam server.
Dory is offline
Send a message via Skype™ to Dory
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 23:57.


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