Console Input Plugin for Squirrel

Finch Real

  • Sr. Member
  • Posts: 282
Re: Console Input Plugin
« Reply #30, on June 19th, 2016, 09:26 AM »
Sorry for the Bump Guys But I have loaded cmdinput32 It Loads Plugin But I can't Write Text on console
My Snipet Showroom

http://pastebin.com/5KKuU5cg

ysc3839

  • VC:MP Beta Tester
  • Posts: 620

[Serious]Sam

  • Newbie
  • Posts: 14
Re: Console Input Plugin
« Reply #32, on July 8th, 2016, 03:02 PM »
BIG THANK YOU, this plugin very helpful))) And previously I think what I can control server from app without running a game, BUT you added this plugin I WAS DREAMING about this))) BIG THNX)

Xmair

  • Wiki Contributor
  • Posts: 879
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

[Serious]Sam

  • Newbie
  • Posts: 14
Re: Console Input Plugin
« Reply #34, on July 8th, 2016, 05:07 PM »Last edited on July 8th, 2016, 05:09 PM
Am I doing something wrong?

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,761

[Serious]Sam

  • Newbie
  • Posts: 14
Re: Console Input Plugin
« Reply #37, on December 10th, 2016, 04:23 PM »Last edited on December 10th, 2016, 04:32 PM
Quote from EK.CrystalBlue on July 9th, 2016, 09:36 AM
Quote from [Serious]Sam on July 8th, 2016, 05:07 PM
Am I doing something wrong?
Yes
Change if (!text) to if (text == "")
I mean, I can't script for this plugin, also I have now Linux, and it's not working here too((
It's just printing text after first word like cmd... This is the problem, I can't do anything else.

Thijn

  • VC:MP Beta Tester
  • Posts: 1,689
Re: Console Input Plugin
« Reply #38, on December 10th, 2016, 06:42 PM »
It's doing exactly what it's suppose to. The cmd variable contains the first word (i.e. the command) and the text variable contains everything after that.

Also, the "commands" don't start with /, they're just the first words.

Xmair

  • Wiki Contributor
  • Posts: 879
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

ysc3839

  • VC:MP Beta Tester
  • Posts: 620

kennedyarz

  • Sr. Member
  • Making American Great Again
  • Posts: 334
Re: Console Input Plugin
« Reply #41,  »Last edited
Excellent! I only have one question

Code: [Select]

function onConsoleInput(cmd, text)
{
    if( cmd == "exec" )
{
    if(!text) print("[CMD] Use /"+cmd+" <code>");
else
{
                try
                {
                    local script = compilestring( text );
                    if( script )
                    {
                        script();
                        print( "[CMD] Executed.");
                    }
                    else print( "[CMD]Invalid code.");
                }
                catch(e) print(e+"");
            }
}

else if( cmd == "test" ) print("working");
else if( cmd == "cmds" ) print("exec, test");

else return print("[CMD] invalid cmd use cmds");
    }

because when I do not put the (arg <-> text) does not mark prints if I have this function.

Code: [Select]
if(!text) print("[CMD] Use /"+cmd+" <code>");

ysc3839

  • VC:MP Beta Tester
  • Posts: 620
Re: Console Input Plugin
« Reply #42,  »
Quote from kennedyarz on June 25th, 2018, 01:38 PM
Excellent! I only have one question

Code: [Select]

function onConsoleInput(cmd, text)
{
    if( cmd == "exec" )
{
    if(!text) print("[CMD] Use /"+cmd+" <code>");
else
{
                try
                {
                    local script = compilestring( text );
                    if( script )
                    {
                        script();
                        print( "[CMD] Executed.");
                    }
                    else print( "[CMD]Invalid code.");
                }
                catch(e) print(e+"");
            }
}

else if( cmd == "test" ) print("working");
else if( cmd == "cmds" ) print("exec, test");

else return print("[CMD] invalid cmd use cmds");
    }

because when I do not put the (arg <-> text) does not mark prints if I have this function.

Code: [Select]
if(!text) print("[CMD] Use /"+cmd+" <code>");
You lost a "}" after line 5.

kennedyarz

  • Sr. Member
  • Making American Great Again
  • Posts: 334
Re: Console Input Plugin
« Reply #43,  »
Another error appears.
If at this moment you are writing a command or something else in the console and a new record or print appears, the command is sent automatically. without me having executed it "fix"

Would not it be better to make a separate writing box?

ysc3839

  • VC:MP Beta Tester
  • Posts: 620
Re: Console Input Plugin
« Reply #44,  »Last edited
@kennedyarz #43 It didn't sent. It just scrolled up by other message. I'll try to fix it.

Edit: Fixing this issue requires modifying print function, which means I have to modify the code of squirrel plugin. So I won't fix it.