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

Auto Message Displayer (Advertiser)


Post New Thread Reply   
 
Thread Tools Display Modes
romeo72
Member
Join Date: Oct 2021
Old 12-14-2021 , 10:46   Re: Auto Message Displayer (Advertiser)
Reply With Quote #201

Hi everyone,

I wanted to ask if you can display a text under each other? it only shows me the top line.
and whether you can extend the duration of the text display?

example (messages.ini):
Quote:
Text
[green][Custom Shop][/green] type [blue]/shop[/blue] in the chat to buy with points
[green] [XP Rank System][/green] type [blue]/xp[/blue] or [blue]/level[/blue] in the chat to see your Rank und Level
best regards
__________________
romeo72 is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 12-14-2021 , 17:26   Re: Auto Message Displayer (Advertiser)
Reply With Quote #202

Quote:
Originally Posted by romeo72 View Post
Hi everyone,

I wanted to ask if you can display a text under each other? it only shows me the top line.
and whether you can extend the duration of the text display?

example (messages.ini):

best regards
Method:
[HUD]
"0" "255" "0" "Hello world!"
"255" "255" "0" "Hello world!"
"255" "255" "255" "Hello world!"
[CHAT]
"&x04Hello&x03 world!"
"&x05Hello&x01 world!"
"&x07Hello world!"

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cromchat>

const MAX_TEXT_LENGTH 192

new const Version[ ] = "1.0.0";
new const 
g_szAdvertFile[ ] = "Messages.ini";

enum _:AdvertData 

    
AD_Color16 ],
    
AD_MessageMAX_TEXT_LENGTH ]
};

enum 

    
HUD 1,
    
CHAT
}

new 
eAdvertAdvertData ]
new Array:
g_aHudMessages, Array:g_aMessages

public plugin_init( ) 
{
    
register_plugin"Advert Message"Version"Supremache" )
    
    
g_aMessages ArrayCreateMAX_TEXT_LENGTH );
    
g_aHudMessages ArrayCreateAdvertData );
    
    
set_task35.0"OnTaskAdvertHud", .flags "b" );
    
set_task50.0"OnTaskAdvertChat", .flags "b" ) ;
    
    
ReadAdvertFile( )
}

public 
plugin_end( )
{
    
ArrayDestroyg_aMessages );
    
ArrayDestroyg_aHudMessages );
}

public 
OnTaskAdvertHud( ) 
{
    if( 
ArraySizeg_aHudMessages ) != )
    {        
        static 
iCurrent
        
        
if( iCurrent >= ArraySizeg_aHudMessages ) )
        {
            
iCurrent 0;
        }
        
        
ArrayGetArrayg_aHudMessagesiCurrent++, eAdvert );
            
        
set_hudmessageeAdvertAD_Color ][ ], eAdvertAD_Color ][ ] , eAdvertAD_Color ][ ], -1.00.2020.2012.00.100.01, -1);
        
show_hudmessage(0eAdvertAD_Message ]);
    }
}

public 
OnTaskAdvertChat( ) 
{
    if( 
ArraySizeg_aMessages ) != )
    {        
        static 
iCurrent
        
        
if( iCurrent >= ArraySizeg_aMessages ) )
        {
            
iCurrent 0;
        }
        
        
ArrayGetStringg_aMessagesiCurrent++, eAdvertAD_Message ], charsmaxeAdvertAD_Message ] ) )
        
        
CC_SendMessage0eAdvertAD_Message ] );
    }
}

ReadAdvertFile( )
{
    new 
g_szFile128 ], g_szConfigs64 ];
    
get_configsdirg_szConfigscharsmaxg_szConfigs ) )
    
formatexg_szFilecharsmaxg_szFile ), "%s/%s"g_szConfigsg_szAdvertFile )
    
    new 
iFile fopeng_szFile"rt" );
    
    if( 
iFile )
    {
        new 
szData96 ], iSectioniSizeszColor][ ]
        
        while( 
fgetsiFileszDatacharsmaxszData ) ) )
        {   
            
trimszData );
            
            switch( 
szData] )
            {
                case 
EOS';''#''/':
                {
                    continue;
                }
                
                case 
'[':
                {
                    
iSize strlen(szData)

                    if(
szData[iSize 1] == ']')
                    {
                        switch( 
szData] )
                        {
                            case 
'H''h'iSection HUD
                            
case 'C''c'iSection CHAT
                            
default: continue
                        }
                    }
                    else continue
                }
                
                default:
                {
                    switch( 
iSection )
                    {
                        case 
HUD:
                        {
                            
parse 
                            
(
                                
szData,
                                
szColor]        , charsmaxszColor[ ] ),
                                
szColor]        , charsmaxszColor[ ] ),
                                
szColor]        , charsmaxszColor[ ] ),
                                
eAdvertAD_Message ]    , charsmax(eAdvertAD_Message ])
                            )
                            
                            
trimeAdvertAD_Message ] );
                            
                            for( new 
03i++ )
                            {
                                
eAdvertAD_Color ][ ] = _:clampstr_to_numszColor] ), -1255 );
                            }
                        
                            
replace_alleAdvertAD_Message ], charsmaxeAdvertAD_Message ] ), "!n""^n" );
                            
                            
ArrayPushArrayg_aHudMessageseAdvert );
                        }
                        
                        case 
CHAT:
                        {
                            
remove_quotesszData );
                            
ArrayPushStringg_aMessagesszData );
                        }
                    }
                }
            }
        }
        
fcloseiFile );
    }

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 12-14-2021 at 17:33.
Supremache is offline
romeo72
Member
Join Date: Oct 2021
Old 12-16-2021 , 09:09   Re: Auto Message Displayer (Advertiser)
Reply With Quote #203

Hello Supremache,

Thank you very much for your help and I wish you a nice day!

best regards
__________________
romeo72 is offline
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 16:14.


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