Raised This Month: $ Target: $400
 0% 

Help with HudMessage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-05-2022 , 18:45   Re: Help with HudMessage
Reply With Quote #8

Quote:
Originally Posted by Elusive13 View Post
Can you explain to me exactly how this works, that is, what exactly you do to make things happen or what to read to learn it.
What is this "i"before "File" var,what mean that g_szMessage or szFile
PHP Code:
#include <amxmodx>
#include <amxmisc>

#if !defined MAX_FMT_LENGTH
    
const MAX_FMT_LENGTH 192 // Max Message length
#endif

new g_szMessageMAX_FMT_LENGTH ]; // String variable to store the message from the file

public plugin_init( ) 
{
    
register_plugin"Welcome Message""1.0""Supremache" )
    
    
ReadWelcomeMessageFile( ); // Read the file
}

public 
client_putinserverid )
{
    
set_task10.0"OnConnectMessage"id ); // Display the message when the client connects to the server
}

public 
OnConnectMessageid )
{
    
set_hudmessage080255,  -1.00.1823.015.00.11.5false )
    
show_hudmessageidg_szMessage // Put the message that was stored from the file
}

ReadWelcomeMessageFile( )
{
    new 
g_szFile128 ]; // Create a variable to store the location of the file
    
get_configsdirg_szFilecharsmaxg_szFile ) ) //  the location of the confing folder
    
addg_szFilecharsmaxg_szFile ), "/WelcomeMessages.ini" // add the file name
    
    
new iFile fopeng_szFile"rt" ); // Open the file
    
    
if( iFile // If the file exist
    
{
        new 
szDataMAX_FMT_LENGTH ]; // Create variable to store the data from the file
        
        
while( fgetsiFileszDatacharsmaxszData ) ) ) // Get the date from the file
        
{   
            
trimszData ); // remove space
            
            
switch( szData] )
            {
                case 
EOS';''#''/': continue; // Block these symbols
                
                
default:
                {
                    
copyg_szMessagecharsmaxg_szMessage ), szData // store the message from the file
                    
replace_allg_szMessagecharsmaxg_szMessage ), "!n""^n" // Replace field !n to ^n if you want to add line
                
}
            }
        }
        
fcloseiFile ); // Close the file
    
}

__________________
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; 05-05-2022 at 18:46.
Supremache is offline
 



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 21:23.


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