This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

New to SourcePawn trying to link a command


Post New Thread Reply   
 
Thread Tools Display Modes
Vict77
Junior Member
Join Date: Dec 2022
Old 12-17-2022 , 19:21   Re: New to SourcePawn trying to link a command
Reply With Quote #11

Quote:
Originally Posted by Marttt View Post
don't know what you mean, you will need be more clear and specific on what you need
looks like what you wan't is read the value from a cvar, instead a command.
It works fine if you type !test or /test. It shows the current setting. But if you type !test 1, then it will show "This test is easy." even though it's currently on normal. The client does not need access to !test 1, 2, or 3. Just !test and the current setting. Does that make sense?

Basically when typed from the client it should ignore anything typed after !test or /test. The server console uses 1, 2, and 3 which is what I need.

Last edited by Vict77; 12-17-2022 at 19:28.
Vict77 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 12-17-2022 , 20:32   Re: New to SourcePawn trying to link a command
Reply With Quote #12

Use 2 commands instead.

PHP Code:
int lastDifficulty;

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_settest"Command_SetTestADMFLAG_ROOT"set test");
    
RegConsoleCmd("sm_test"Command_ShowTest"testing");
}

Action Command_SetTest(int clientint args)
{
    if (
args 0)
        
lastDifficulty GetCmdArgInt(1);

    switch (
lastDifficulty)
    {
        case 
1ReplyToCommand(client"This test is Easy.");
        case 
2ReplyToCommand(client"This test is Normal.");
        case 
3ReplyToCommand(client"This test is Hard.");
        default: 
ReplyToCommand(client"This test is *Unknown* (%d)."lastDifficulty);
    }
    return 
Plugin_Handled;
}

Action Command_ShowTest(int clientint args)
{
    switch (
lastDifficulty)
    {
        case 
1ReplyToCommand(client"This test is Easy.");
        case 
2ReplyToCommand(client"This test is Normal.");
        case 
3ReplyToCommand(client"This test is Hard.");
        default: 
ReplyToCommand(client"This test is *Unknown* (%d)."lastDifficulty);
    }
    return 
Plugin_Handled;

__________________

Last edited by Marttt; 12-17-2022 at 20:33.
Marttt is offline
Vict77
Junior Member
Join Date: Dec 2022
Old 12-17-2022 , 22:14   Re: New to SourcePawn trying to link a command
Reply With Quote #13

Quote:
Originally Posted by Marttt View Post
Use 2 commands instead.

PHP Code:
int lastDifficulty;

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_settest"Command_SetTestADMFLAG_ROOT"set test");
    
RegConsoleCmd("sm_test"Command_ShowTest"testing");
}

Action Command_SetTest(int clientint args)
{
    if (
args 0)
        
lastDifficulty GetCmdArgInt(1);

    switch (
lastDifficulty)
    {
        case 
1ReplyToCommand(client"This test is Easy.");
        case 
2ReplyToCommand(client"This test is Normal.");
        case 
3ReplyToCommand(client"This test is Hard.");
        default: 
ReplyToCommand(client"This test is *Unknown* (%d)."lastDifficulty);
    }
    return 
Plugin_Handled;
}

Action Command_ShowTest(int clientint args)
{
    switch (
lastDifficulty)
    {
        case 
1ReplyToCommand(client"This test is Easy.");
        case 
2ReplyToCommand(client"This test is Normal.");
        case 
3ReplyToCommand(client"This test is Hard.");
        default: 
ReplyToCommand(client"This test is *Unknown* (%d)."lastDifficulty);
    }
    return 
Plugin_Handled;

Thank you once again for all your help Marttt! I really appreciate everything!
Vict77 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 15:13.


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