AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved messagemode in menu doesn't work (https://forums.alliedmods.net/showthread.php?t=318189)

Akka3223 08-18-2019 16:00

messagemode in menu doesn't work
 
Hello there,


somehow i don't understand why doesn't this work, could someone help me with this?
in console i can't see anything from ''public mmXp(id) ''


this is what i use in a menu
Quote:

client_cmd(id ,"messagemode cmdaddxp")
server_print("Bugs bugs bugs its raining bugs#2")


this is my messagemode functions
Quote:

}
public set_messagemode_cmds()
{
register_clcmd("say /setgoldcmd", "cmdaddxp")
register_clcmd("mmXpMain", "mmXp")
}
public cmdaddxp(id)
{
client_cmd(id, "messagemode mmXpMain")
}
public mmXp(id)
{
server_print("Bugs check#3")
new szTemp[64]
read_args(szTemp, charsmax(szTemp))
remove_quotes(szTemp);
new gold_amount = str_to_num(szTemp);
g_PlayerXp[SelectedPlayerIDD[id]][g_CurrentChar[SelectedPlayerIDD[id]]] += gold_amount;
client_print(SelectedPlayerIDD[id], print_chat, "Your XP has been increased by %d!",
gold_amount);
}

fysiks 08-18-2019 16:09

Re: messagemode in menu doesn't work
 
The two parts of code that you posted don't appear to go together. It does not look like there is any client command registered called "cmdaddxp".

It would be easiest if you attach your entire plugin. If you don't want to do that, create a test plugin with just the functionality that you are struggling with that reproduces the issue.

Akka3223 08-18-2019 16:19

Re: messagemode in menu doesn't work
 
Quote:

Originally Posted by fysiks (Post 2663728)
The two parts of code that you posted don't appear to go together. It does not look like there is any client command registered called "cmdaddxp".

It would be easiest if you attach your entire plugin. If you don't want to do that, create a test plugin with just the functionality that you are struggling with that reproduces the issue.

okay ill attach its not a plugin its a d2lod addon or something not sure how its calld


EDIT*
i changed it from inl to ini because i couldn't attach

Akka3223 08-18-2019 16:29

Re: messagemode in menu doesn't work
 
and btw i mean its an admin menu,while i try to make a selection to add xp with selected value.

i tryed using that too
client_cmd(id ,"messagemode mmXp")
it doesn't shows anything or gives anything from public mmXp(id)

JocAnis 08-18-2019 17:33

Re: messagemode in menu doesn't work
 
messagemode mmxp cant be called but messagemode mmxpmain will

Akka3223 08-18-2019 18:25

Re: messagemode in menu doesn't work
 
Quote:

Originally Posted by JocAnis (Post 2663737)
messagemode mmxp cant be called but messagemode mmxpmain will

i tryed already it doesn't give me xp

its opens a messagemode when i type in something it doesnt give me xp thats what i try to fix.

fysiks 08-18-2019 19:19

Re: messagemode in menu doesn't work
 
You'll have to debug it. Is the function actually being called? What is the contents of the szTemp string in mmXp()?

Akka3223 08-19-2019 08:41

Re: messagemode in menu doesn't work
 
Quote:

Originally Posted by fysiks (Post 2663741)
You'll have to debug it. Is the function actually being called? What is the contents of the szTemp string in mmXp()?

exactly i tryed to debug it doesn't show me anything.

i don't know how to explain it,
PHP Code:

            client_cmd(id ,"messagemode mmXpMain"
            
server_print("Bugs bugs bugs its raining bugs#2"

This thing opens an messagemode for me but when i type an amount there how much xp i want its just doesn't use the fuction at all somewhy

PHP Code:

public mmXp(id

    
server_print("Bugs bugs bugs its raining bugs#3")
    new 
szTemp[64
    
read_args(szTempcharsmax(szTemp))
    
remove_quotes(szTemp);    
    new 
gold_amount str_to_num(szTemp);
    
server_print("Bugs bugs bugs its raining bugs#4")
    
g_PlayerXp[SelectedPlayerIDD[id]][g_CurrentChar[SelectedPlayerIDD[id]]] += gold_amount;
    
client_print(SelectedPlayerIDD[id], print_chat"Your XP has been increased by %d!"gold_amount);



fysiks 08-19-2019 23:25

Re: messagemode in menu doesn't work
 
This is why I also said that you should create a test plugin to make sure that you understand the logic required to implement the feature you are trying to implement in your plugin. I do this all the time. Create a simple plugin that does just that one feature to make sure that I know that what I'm doing it working in it's simplest form. See here:

Code:

#include <amxmodx>

public plugin_init()
{
        register_clcmd("say test", "cmdSayTest")
        register_clcmd("_testmm", "cmdTestMM")
}


public cmdSayTest(id)
{
        client_print(id, print_chat, "say test happened")
        client_cmd(id, "messagemode _testmm")
}

public cmdTestMM(id)
{
        new szString[32]
        read_args(szString, charsmax(szString))
       
        client_print(id, print_chat, "TestMM String:  %s", szString)
}

they "test" in chat and you should get the messagemode command and then type something. When you hit enter, it will display that text in chat. This shows that it's working. Then, you can compare that to what you're doing in your plugin.

Akka3223 08-20-2019 09:19

Re: messagemode in menu doesn't work
 
Quote:

Originally Posted by fysiks (Post 2663884)
This is why I also said that you should create a test plugin to make sure that you understand the logic required to implement the feature you are trying to implement in your plugin. I do this all the time. Create a simple plugin that does just that one feature to make sure that I know that what I'm doing it working in it's simplest form. See here:

Code:

#include <amxmodx>

public plugin_init()
{
        register_clcmd("say test", "cmdSayTest")
        register_clcmd("_testmm", "cmdTestMM")
}


public cmdSayTest(id)
{
        client_print(id, print_chat, "say test happened")
        client_cmd(id, "messagemode _testmm")
}

public cmdTestMM(id)
{
        new szString[32]
        read_args(szString, charsmax(szString))
       
        client_print(id, print_chat, "TestMM String:  %s", szString)
}

they "test" in chat and you should get the messagemode command and then type something. When you hit enter, it will display that text in chat. This shows that it's working. Then, you can compare that to what you're doing in your plugin.

ok so, i tryed making different plugin for messagemode and that one worked when i tryed to implement it to the diablo2lod mod it doesn't work again mhm

*EDIT*
thanks i fixed it.


All times are GMT -4. The time now is 17:30.

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