AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Dictionary isnt working. (https://forums.alliedmods.net/showthread.php?t=126957)

OneMoreLevel 05-15-2010 14:15

Dictionary isnt working.
 
I have the code for registering a dictionary in my plugin, and then when I place the dictionary file in the lang directory, it doesnt work, like when a action happens, it will say:

ML_NOTFOUND: INSUFFICIENT_CASH

Do I need to add the name of the dictionary somewhere like a lang.ini?

wrecked_ 05-15-2010 14:22

Re: Dictionary isnt working.
 
Show us your file or at least the INSUFFICIENT_CASH line.

OneMoreLevel 05-15-2010 14:36

Re: Dictionary isnt working.
 
My lang file? or my sma?

Heres my lang
Code:

[en]
INSUFFICIENT_CASH = [Deathrun] You have insufficient cash.
GIVE_ONE_FLASHBANG = [Deathrun] You have been granted one flashbang.
GIVE_ONE_SMOKEG = [Deathrun] You have been granted one smoke grenade.
DECREASE_GRAVITY = [Deathrun] Your gravity has been decreased.
INCREASE_SPEED = [Deathrun] Your speed has been increased.
INVISIBILITY_ON = [Deathrun] You have become less visible.
GIVE_DUALIES = [Deathrun] You have been given dual elites.
PLUGIN_DISABLED = That plugin is disabled.
LIMIT_REACHED = [Deathrun] You have already bought three items from the shop this round.
[pl]
INSUFFICIENT_CASH = [Deathrun] Masz niewystarczajaca ilosc pieniedzy.
GIVE_ONE_FLASHBANG = [Deathrun] Zostaniesz zaopatrzony w jeden granat oslepiacy.
GIVE_ONE_SMOKEG = [Deathrun] Zostaniesz zaopatrzony w jeden granat dymny.
DECREASE_GRAVITY = [Deathrun] Twoja grawitacja zostanie zmniejszona.
INCREASE_SPEED = [Deathrun] Twoja predkosc zostanie zwieszkona.
INVISIBILITY_ON = [Deathrun] Staniesz sie mniej widzialny.
GIVE_DUALIES = [Deathrun] Zostaniesz zaopatrzony w podwojne pistolety.
PLUGIN_DISABLED = Ten plugin jest wylaczony.
LIMIT_REACHED = [Deathrun] Juz kupiles trzy przedmioty ze sklepu w tej rundzie.
[ro]
INSUFFICIENT_CASH = [Deathrun] Nu ai destui bani.
GIVE_ONE_FLASHBANG = [Deathrun] Ai primit un flashbang.
GIVE_ONE_SMOKEG = [Deathrun] Ai primit o grenada fumigena (smoke).
DECREASE_GRAVITY = [Deathrun] Ti-a fost scazuta forta gravitationala.
INCREASE_SPEED = [Deathrun] Ti-a fost marita viteza de deplasare.
INVISIBILITY_ON = [Deathrun] Ai devenit mai putin vizibil.
GIVE_DUALIES = [Deathrun] Ai primit doua pistoale Beretta M9 (Elites).
PLUGIN_DISABLED = Acest plugin este dezactivat.
LIMIT_REACHED = [Deathrun] Ai cumparat deja trei obiecte runda aceasta.


Exolent[jNr] 05-15-2010 14:39

Re: Dictionary isnt working.
 
This is what you should do for your plugin:

mylangs.txt
Code:

[en]
OHHAI_THAR = Ohhai thar!

[de]
OHHAI_THAR = You suck, teehee.

myplugin.sma
Code:
#include < amxmodx > public plugin_init( ) {     register_dictionary( "mylangs.txt" ); } public client_putinserver( iPlayer ) {     client_print( iPlayer, print_chat, "* %L", iPlayer, "OHHAI_THAR" ); }

If you follow that example, then it should work.

wrecked_ 05-15-2010 14:40

Re: Dictionary isnt working.
 
INSUFFICIENT_CASH isn't used in that plugin at all. To use an ML file in a plugin, you'll also need register_dictionary.

EDIT: Damnit, Exolent.

OneMoreLevel 05-15-2010 14:56

Re: Dictionary isnt working.
 
Oops, sorry guys, I was sending you the wrong plugin, here's the real one:

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>


#define PLUGIN "Deathrun Shop"
#define VERSION "1.1"
#define AUTHOR "OneMoreLevel"

new pluginENABLE

new shopLimit 0;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd"say /shop","deathrun_shop")
    
    
pluginENABLE register_cvar("shop_enable""1");
    
    
register_event("DeathMsg","Hook_DeathMsg","a")
    
register_dictionary"deathrun_shop.txt")
}

public 
deathrun_shop(id){
    
    new 
menu menu_create("\rDeathrun Shop""menu_handler");
    
    
menu_additem(menu"\wMore Speed - 1500$""1"0);
    
menu_additem(menu"\wLess Gravity - 2500$""2"0);
    
menu_additem(menu"\w75% Invisibility - 2000$""3"0);
    
menu_additem(menu"\wDual Elites - 4000$""4"0);
    
menu_additem(menu"\wSmoke Grenade - 2500$""5"0);
    
menu_additem(menu"\wFlashbang - 2500$""6"0);
    if (
get_pcvar_num(pluginENABLE)) {
        
menu_display(idmenu0);
    }
    else {
        
client_print(idprint_chat"%L"id"PLUGIN_DISABLED")
    }
}
public 
menu_handler(id,menu,item){
    if (
item == MENU_EXIT )
    { 
        
menu_destroy(menu);
    }
    
    
    
// Here are the data functions and variables
    
new data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            
// Print the message and destroy the menu
            
if (cs_get_user_money(id) >= 750)  {
                
shopLimit ++;
                if (
shopLimit 4){
                    
client_print(idprint_chat"%L"id"INCREASE_SPEED")
                    
cs_set_user_money(idcs_get_user_money(id) - 750)
                    
set_user_maxspeed(idget_user_maxspeed(id) + 100)
                }
                else if (
shopLimit 3){ 
                    
                }
                
client_print(idprint_chat"%L"id"LIMIT_REACHED")
            }
            else {
                
client_print(idprint_chat"%L"id"INSUFFICIENT_CASH")
            }
        }
        
        case 
2:
        {
            if(
cs_get_user_money(id) >= 1250) {
                
shopLimit ++;
                if (
shopLimit 4){
                    
client_print(idprint_chat"%L"id"DECREASE_GRAVITY")
                    
cs_set_user_money(idcs_get_user_money(id) - 1250)
                    
set_user_gravity(idget_user_gravity(id) - 0.1)
                }
                else if (
shopLimit 3) {
                    
                }
                
client_print(idprint_chat"%L"id"LIMIT_REACHED")
            }
            else {
                
client_print(idprint_chat"%L"id"INSUFFICIENT_CASH")
                
            }
        }
        case 
3:
        {
            if(
cs_get_user_money(id) >= 1000) {
                
shopLimit ++;
                if (
shopLimit 4){
                    
client_print(idprint_chat"%L"id"INVISIBILITY_ON")
                    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha65)
                    
cs_set_user_money(idcs_get_user_money(id) - 1000)
                }
                else if (
shopLimit 3) {
                    
                }
                
client_print(idprint_chat"%L"id"LIMIT_REACHED")
            }
            else {
                
client_print(idprint_chat"%L"id"INSUFFICIENT_CASH")
            }
        }
        case 
4:    
        {
            if(
cs_get_user_money(id) >= 2000) {
                
shopLimit ++;
                if (
shopLimit 4){
                    
client_print(idprint_chat"%L"id"GIVE_DUALIES")        
                    
give_item(id"weapon_elite")
                    
cs_set_user_bpammo (idCSW_ELITE120)
                    
cs_set_user_money(idcs_get_user_money(id) - 2000)
                }
                else if (
shopLimit 3) {
                    
                }
                
client_print(idprint_chat"%L"id"LIMIT_REACHED")
            }
            else {
                
client_print(idprint_chat"%L"id"INSUFFICIENT_CASH")
            }
        }
        case 
5:    
        {
            if(
cs_get_user_money(id) >= 2500) {
                
shopLimit ++;
                if (
shopLimit 4){
                    
client_print(idprint_chat"%L"id"GIVE_ONE_SMOKEG")
                    
cs_set_user_money(idcs_get_user_money(id) - 2500)
                    
give_item(id"weapon_smokegrenade")
                }
                else if (
shopLimit 3){
                    
                }
                
client_print(idprint_chat"%L"id"LIMIT_REACHED")
            }
            else {
                
client_print(idprint_chat"%L"id"INSUFFICIENT_CASH")
            }
        }
        case 
6:    
        {
            if(
cs_get_user_money(id) >= 2500) {
                
shopLimit ++;
                if (
shopLimit 4){
                    
client_print(idprint_chat"%L"id"GIVE_ONE_FLASHBANG")
                    
client_print(idprint_chat"[Deathrun] You have been granted one flashbang.");
                    
cs_set_user_money(idcs_get_user_money(id) - 2500)
                    
give_item(id"weapon_flashbang")
                }
                else if (
shopLimit 3) {
                    
                }
                
client_print(idprint_chat"%L"id"LIMIT_REACHED")
            }
            else {
                
client_print(idprint_chat"%L"id"INSUFFICIENT_CASH")
            }
        }
    }
    
// Kill the menu, and make a return.
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
HookDeathMsg(){
    
shopLimit 0;




All times are GMT -4. The time now is 03:42.

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