Raised This Month: $32 Target: $400
 8% 

Dhud advertising by language


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 02-16-2019 , 08:24   Dhud advertising by language
Reply With Quote #1

Hello. I want to do that players who is chosen language "ru" would see Russian advert messages and who chosen "en" would see English messages.


English adverts from file dhud_advert-en.ini
Russian from dhud_advert-ru.ini

PHP Code:
#include <amxmodx>
#include <amxmisc>
#if AMXX_VERSION_NUM < 183
    #include <dhudmessage>
#endif 
#define INTERVAL 20 //С каким интервалом выводить сообщения(сек.)

new Array:g_Messages;
new 
g_ArraySizeg_counter;

public 
plugin_init()
{
    
register_plugin"dhud advert""1.0""DUKKHAZ0R" );
    
    
g_Messages ArrayCreate(128);
    
set_taskINTERVAL.0,"show_advert",.flags="b");
}

public 
plugin_cfg()
{
    new 
cfgsdir[128];
    
get_configsdir(cfgsdir,charsmax(cfgsdir));
    
add(cfgsdir,charsmax(cfgsdir),"/dhud_advert.ini");
    
    if(!
file_exists(cfgsdir))
    {
        new 
szError[256];
        
formatex(szError,charsmax(szError),"Enable to open ^"%s^"!",cfgsdir);
        
set_fail_state(szError);
    }
    
    new 
i_File,szLine[256];
    
    
i_File fopen(cfgsdir,"rt");
    
    while(
i_File && !feof(i_File))
    {
        
fgets(i_File,szLine,charsmax(szLine));
        
        if(!
szLine[0] || szLine[0] == ';' || szLine[0] == '/' && szLine[1] == '/' || strlen(szLine) >= 128)
            continue;
        
        
remove_quotes(szLine);
        
ArrayPushString(g_Messages,szLine);
    }
    
    
g_ArraySize ArraySize(g_Messages);
    
fclose(i_File);
}

public 
show_advert()
{
    
clrscr();
    
    if(
g_counter >= g_ArraySize)
        
g_counter 0;
    
    new 
szMessage[128];
    
ArrayGetString(g_Messages,g_counter,szMessage,charsmax(szMessage));
    
    new 
g_iRed random_num(1,255),g_iGreen random_num(1,255),g_iBlue random_num(1,255);
    
    
set_dhudmessage(1530760000.280.1606.012.0)
    
    
set_dhudmessage(g_iRedg_iGreeng_iBlue, -1.00.0212.012.02.02.0);
    
show_dhudmessage(0,szMessage);
    
    
g_counter++;
}

public 
clrscr()
{
    for(new 
i8i++)
        
show_dhudmessage(0,"");

Can anyone help me?
LithuanianJack is offline
Reply


Thread Tools
Display Modes

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 15:32.


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