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

Problem in Lang Message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snake.
Senior Member
Join Date: Jul 2017
Old 10-06-2020 , 09:44   Problem in Lang Message
Reply With Quote #1

For some reason, it only shows message for en users. My lang is tr but it still shows en even though i set my lang as tr. Any problem in this code?

PHP Code:
#include <amxmodx>
#include <colorchat>
 
#define PLUGIN "Lang Message"
#define VERSION "1.0"
#define AUTOR   "raizo"


new AdvTime

new const LANG_FILE[][] =
{
    
"[en]",
    
"ADVERTISMENT_ONE = ^1Put ^3message^1 here ^4please ONE ^1!",
    
"ADVERTISMENT_TWO = ^1Put ^3here^1 message ^4please TWO ^1!",
    
"ADVERTISMENT_THREE = ^1Put ^3message^1 here ^4please THREE^1!",
    
"ADVERTISMENT_FOUR = ^1Put ^3here^1 message ^4please FOUR^1!",
    
"ADVERTISMENT_FIVE = ^1Put ^3message^1 here ^4please FIVE^1!",
    
"ADVERTISMENT_SIX = ^1Put ^3here^1 message ^4please SIX^1!",
    
"ADVERTISMENT_SEVEN = ^1Put ^3message^1 here ^4please SEVEN^1!",
    
"ADVERTISMENT_EIGHT = ^1Put ^3here^1 message ^4please EIGHT^1!",
    
"ADVERTISMENT_NINE = ^1Put ^3message^1 here ^4please NINE^1!",
    
"ADVERTISMENT_TEN = ^1Put ^3here^1 message ^4please TEN^1!"
}

new const 
LANG_FILE_PREFIXES[][] =
{
    
"ADVERTISMENT_ONE",
    
"ADVERTISMENT_TWO",
    
"ADVERTISMENT_THREE",
    
"ADVERTISMENT_FOUR",
    
"ADVERTISMENT_FIVE",
    
"ADVERTISMENT_SIX",
    
"ADVERTISMENT_SEVEN",
    
"ADVERTISMENT_EIGHT",
    
"ADVERTISMENT_NINE",
    
"ADVERTISMENT_TEN"

}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTOR);

    
AdvTime register_cvar("amx_messageone","60.0");
   
    
set_task(get_pcvar_float(AdvTime), "Advertisment");
 
    
register_dictionary("lang_messages.txt")
}

public 
plugin_precache()
{  
    if(!
file_exists("addons/amxmodx/data/lang/lang_messages.txt"))
    {
        for(new 
i=0;isizeof LANG_FILE;i++)
        {
            
write_file("addons/amxmodx/data/lang/lang_messages.txt"LANG_FILE[i]);
        }
    }
   
}

public 
Advertisment()ColorChat(0GREEN"^3[^4Lang Messages^3]^1 %L"LANG_PLAYERLANG_FILE_PREFIXES[random(sizeof(LANG_FILE_PREFIXES))] ), set_task(get_pcvar_float(AdvTime), "Advertisment");
__________________ 
Snake. is offline
Send a message via Skype™ to Snake.
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-06-2020 , 12:15   Re: Problem in Lang Message
Reply With Quote #2

I would use:
Code:
if(!lang_exists("lang_messages.txt"))
Double check lang_messages.txt is not over-written from this script as it regenerates the file in all English if not found.
__________________
DJEarthQuake 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 18:55.


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