Vice City: Multiplayer

Server Development => Community Plugins => Topic started by: ysc3839 on March 14th, 2015, 05:25 AM

Title: Console Input Plugin
Post by: ysc3839 on March 14th, 2015, 05:25 AM
Feature
Linux readline support.
In past version of this plugin, if you press arrow keys you will get characters like "^[[A^[[B^[[C^[[D".
Now with readline you can move the cursor or use command history.

Usage
Code: [Select]
function onConsoleInput(cmd, arg)
{
print(cmd + " " + arg);
}

Source & Download
https://bitbucket.org/ysc3839/0.4-cmdinput/downloads/

Version 1.3.1 works on both v23(04rel004) and v29(04rel006) servers.
Title: Re: Console Input Plugin
Post by: . on March 14th, 2015, 10:55 AM
Any usage example ?
Title: Re: Console Input Plugin
Post by: Sk on March 14th, 2015, 12:04 PM
if you are asking about how to use it then you can use it like this.
one example
Code: [Select]
function onConsoleInput(cmd,text)
{
if (cmd = "test") print(text);
}
will output this http://s20.postimg.org/sv2xkxij1/2015_03_14_165423.png
 when you type "test this is some test to check this plugin" in console.
btw thankx for the plugin ysc :).
Title: Re: Console Input Plugin
Post by: . on March 14th, 2015, 12:15 PM
So, this happens once when you start the server? The server start-up is paused until the user inserts some text with something like std::cin and then it can proceed? Well, if your server has an auto-restart-on-crash protection then you might need to re-think your script.
Title: Re: Console Input Plugin
Post by: ysc3839 on March 14th, 2015, 03:34 PM
Quote from S.L.C on March 14th, 2015, 12:15 PM
So, this happens once when you start the server? The server start-up is paused until the user inserts some text with something like std::cin and then it can proceed? Well, if your server has an auto-restart-on-crash protection then you might need to re-think your script.
I don't know what you say. I use a thread to get user's input, and then use OnFrame to execute the script.
Title: Re: Console Input Plugin
Post by: . on March 14th, 2015, 03:40 PM
Quote from ysc3839 on March 14th, 2015, 03:34 PM
I don't know what you say. I use a thread to get user's input, and then use OnFrame to execute the script.
Why not just say that in the first place :-\ Every plugin deserves an introduction and not just: Download my plugin here...
Title: Re: Console Input Plugin
Post by: Doom_Kill3R on March 14th, 2015, 03:51 PM
FINALLY DAMN IT!

Atleast won't need to go ingame to test or execute a simple thing now... very helpful.
Title: Re: Console Input Plugin
Post by: ysc3839 on March 15th, 2015, 02:29 AM
Quote from S.L.C on March 14th, 2015, 03:40 PM
Quote from ysc3839 on March 14th, 2015, 03:34 PM
I don't know what you say. I use a thread to get user's input, and then use OnFrame to execute the script.
Why not just say that in the first place :-\ Every plugin deserves an introduction and not just: Download my plugin here...
There is the plugin source code. I don't want to say anything.
Title: Re: Console Input Plugin
Post by: . on March 15th, 2015, 10:14 AM
Quote from ysc3839 on March 15th, 2015, 02:29 AM
There is the plugin source code. I don't want to say anything.
Not anyone can read through C++ source code :-\
Title: Re: Console Input Plugin
Post by: Fuzzie on March 15th, 2015, 10:43 AM
Quote from S.L.C on March 15th, 2015, 10:14 AM
Quote from ysc3839 on March 15th, 2015, 02:29 AM
There is the plugin source code. I don't want to say anything.
Not anyone can read through C++ source code :-\
I agree with S.L.C. Provide a simple documentation about your plugin so that users can know what your plugin can do. How hard can that be?
Title: Re: Console Input Plugin
Post by: Gudio on March 15th, 2015, 10:56 AM
I see a lot of new people here, who haven't ever used 0.3zR2 squirrel server and onConsoleInput in their scripts, seriously. :)
Title: Re: Console Input Plugin
Post by: Gudio on March 15th, 2015, 11:26 AM
Feel free to PM me for Linux .so :P

(http://img.vc-mp.pl/images/y1F9xfLPJ.png)
Title: Re: Console Input Plugin
Post by: ysc3839 on March 18th, 2015, 02:48 PM
Quote from Gudio on March 15th, 2015, 11:26 AM
Feel free to PM me for Linux .so :P

(http://img.vc-mp.pl/images/y1F9xfLPJ.png)
I hope you can put the source code on internet! :)
BTW, Can you give me your plugin in the image? I think is useful!
Title: Re: Console Input Plugin
Post by: jayant on March 28th, 2015, 06:41 AM
@ysc3839 - cmdinputrel32 isnt there in bitbucket.Please reupload. Thanks.
Title: Re: Console Input Plugin
Post by: Gudio on March 28th, 2015, 11:31 AM
Quote from jayant on March 28th, 2015, 06:41 AM
@ysc3839 - cmdinputrel32 isnt there in bitbucket.Please reupload. Thanks.
It is.
Title: Re: Console Input Plugin
Post by: Sk on March 28th, 2015, 01:07 PM
Quote from jayant on March 28th, 2015, 06:41 AM
@ysc3839 - cmdinputrel32 isnt there in bitbucket.Please reupload. Thanks.
https://bitbucket.org/ysc3839/0.4-cmdinput/downloads/cmdinputrel32.dll
?
Title: Re: Console Input Plugin
Post by: jayant on March 28th, 2015, 02:21 PM
"404,Oops you've found a dead link" I should have posted this before..
Title: Re: Console Input Plugin
Post by: ysc3839 on March 28th, 2015, 03:19 PM
Quote from jayant on March 28th, 2015, 06:41 AM
@ysc3839 - cmdinputrel32 isnt there in bitbucket.Please reupload. Thanks.
reuploaded! :)
Title: Re: Console Input Plugin
Post by: Doom_Kill3R on April 18th, 2015, 03:28 PM
Can you update for the new 0.4 candidate, thanks.
Title: Re: Console Input Plugin
Post by: ysc3839 on April 18th, 2015, 03:32 PM
Quote from Doom_Killer on April 18th, 2015, 03:28 PM
Can you update for the new 0.4 candidate, thanks.
Just updated! https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
Title: Re: Console Input Plugin
Post by: ysc3839 on May 31st, 2015, 02:25 AM
Updated plugin header. https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
Title: Re: Console Input Plugin
Post by: ysc3839 on February 20th, 2016, 01:22 PM
Added Linux support! :D

dll download https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
zip download (http://files.thijn.ovh/img/c4abad6243de49743cebbdb17b444af2/0.4-cmdinput.zip)(http://files.thijn.ovh/download/c4abad6243de49743cebbdb17b444af2/0.4-cmdinput.zip)

I have removed the critical section. If you found any bug please PM me!
Title: Re: Console Input Plugin
Post by: Anik on February 20th, 2016, 01:25 PM
Quote from ysc3839 on February 20th, 2016, 01:22 PM
Added Linux support! :D

dll download https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
zip download (http://files.thijn.ovh/img/c4abad6243de49743cebbdb17b444af2/0.4-cmdinput.zip)(http://files.thijn.ovh/download/c4abad6243de49743cebbdb17b444af2/0.4-cmdinput.zip)

I have removed the critical section. If you found any bug please PM me!
Virus
Title: Re: Console Input Plugin
Post by: ysc3839 on February 20th, 2016, 03:07 PM
Quote from [DS]Anik on February 20th, 2016, 01:25 PM
Quote from ysc3839 on February 20th, 2016, 01:22 PM
Added Linux support! :D

dll download https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
zip download (http://files.thijn.ovh/img/c4abad6243de49743cebbdb17b444af2/0.4-cmdinput.zip)(http://files.thijn.ovh/download/c4abad6243de49743cebbdb17b444af2/0.4-cmdinput.zip)

I have removed the critical section. If you found any bug please PM me!
Virus
If you think it's virus, you can compile by yourself. :)
Title: Re: Console Input Plugin
Post by: Thijn on February 20th, 2016, 04:51 PM
https://www.virustotal.com/nl/file/f3e7d4432b71f1a59d3140faef0b24b335474089893c70b6933fe2f83ce67522/analysis/

It's pretty much clean, in case you don't want to/can't compile yourself.
Title: Re: Console Input Plugin
Post by: ysc3839 on May 7th, 2016, 05:05 PM
Update to the new plugin API.

(http://files.thijn.ovh/img/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)(http://files.thijn.ovh/download/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)
Title: Re: Console Input Plugin
Post by: Pun1sh3r on May 9th, 2016, 08:58 PM
I have a Error while loading your Plugin.

Error Message: Plugin error >> GetProcAddress() 'plugins/cmdinputrel64.dll' failed: Code 127 Failed to loag plugin: cmdinputrel64
Title: Re: Console Input Plugin
Post by: ysc3839 on May 10th, 2016, 08:12 AM
Quote from Pun1sh3r on May 9th, 2016, 08:58 PM
I have a Error while loading your Plugin.

Error Message: Plugin error >> GetProcAddress() 'plugins/cmdinputrel64.dll' failed: Code 127 Failed to loag plugin: cmdinputrel64
I'll fix it on the weekends.
Title: Re: Console Input Plugin
Post by: ysc3839 on May 21st, 2016, 11:00 AM
Fixed.
(http://files.thijn.ovh/img/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)(http://files.thijn.ovh/download/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)
Title: Re: Console Input Plugin
Post by: Pun1sh3r on May 22nd, 2016, 01:21 PM
Quote from ysc3839 on May 21st, 2016, 11:00 AM
Fixed.
(http://files.thijn.ovh/img/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)(http://files.thijn.ovh/download/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)
Thanks, works fine!
Title: Re: Console Input Plugin
Post by: Finch Real 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
Title: Re: Console Input Plugin
Post by: ysc3839 on June 19th, 2016, 11:07 AM
Quote from Finch Real 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
I'll see it on next weekend.
Title: Re: Console Input Plugin
Post by: [Serious]Sam 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)
Title: Re: Console Input Plugin
Post by: Xmair on July 8th, 2016, 04:22 PM
There is a reason the like button exists.
Title: Re: Console Input Plugin
Post by: [Serious]Sam on July 8th, 2016, 05:07 PM
Am I doing something wrong?
(http://i.imgur.com/TzklTW9.png)
Title: Re: Console Input Plugin
Post by: [Serious]Sam on July 8th, 2016, 07:39 PM
Quote from Xmair on July 8th, 2016, 04:22 PM
There is a reason the like button exists.
Help me if you smart)
Title: Re: Console Input Plugin
Post by: EK.IceFlake on July 9th, 2016, 09:36 AM
Quote from [Serious]Sam on July 8th, 2016, 05:07 PM
Am I doing something wrong?
(http://i.imgur.com/TzklTW9.png)
Yes
Change if (!text) to if (text == "")
Title: Re: Console Input Plugin
Post by: [Serious]Sam on December 10th, 2016, 04:23 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?
(http://i.imgur.com/TzklTW9.png)
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.
(https://i.imgur.com/M8ii2Px.png)
Title: Re: Console Input Plugin
Post by: Thijn 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.
Title: Re: Console Input Plugin
Post by: Xmair on December 11th, 2016, 07:55 AM
Change
Code: [Select]
if ( cmd = "print" ) print(text);
To
Code: [Select]
if ( cmd == "print" ) print(text);
Title: Re: Console Input Plugin
Post by: ysc3839 on June 25th, 2018, 07:54 AM
Version 1.3.1 is released. See the first post(https://forum.vc-mp.org/?topic=387.0) for more information.
https://bitbucket.org/ysc3839/0.4-cmdinput/downloads/cmdinput1.3.1-apiv2.zip
Title: Re: Console Input Plugin
Post by: kennedyarz on June 25th, 2018, 01:38 PM
Quote from ysc3839 on June 25th, 07:54 AM
Version 1.3.1 is released. See the first post(https://forum.vc-mp.org/?topic=387.0) for more information.
https://bitbucket.org/ysc3839/0.4-cmdinput/downloads/cmdinput1.3.1-apiv2.zip
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>");
Title: Re: Console Input Plugin
Post by: ysc3839 on June 25th, 2018, 02:13 PM
Quote from kennedyarz on June 25th, 01:38 PM
Quote from ysc3839 on June 25th, 07:54 AM
Version 1.3.1 is released. See the first post(https://forum.vc-mp.org/?topic=387.0) for more information.
https://bitbucket.org/ysc3839/0.4-cmdinput/downloads/cmdinput1.3.1-apiv2.zip
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.
Title: Re: Console Input Plugin
Post by: kennedyarz on June 26th, 2018, 02:38 PM
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?
Title: Re: Console Input Plugin
Post by: ysc3839 on June 26th, 2018, 04:20 PM
@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.
Title: Re: Console Input Plugin
Post by: ysc3839 on June 26th, 2018, 04:49 PM
Version 1.3.2 is released.

Now "arguments" (the second parameter of onConsoleInput) will be null if it's no space in input string.
For example, when you type "abc", you will get cmd="abc" and arg=null.
when you type "abc def", you will get cmd="abc" and arg="def".

https://bitbucket.org/ysc3839/0.4-cmdinput/downloads/cmdinput1.3.2-apiv2.zip