Vice City: Multiplayer

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

Title: Console Input Plugin for Squirrel
Post by: ysc3839 on Mar 14, 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
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 v30(04rel006) servers.
Title: Re: Console Input Plugin
Post by: . on Mar 14, 2015, 10:55 AM
Any usage example ?
Title: Re: Console Input Plugin
Post by: Sk on Mar 14, 2015, 12:04 PM
if you are asking about how to use it then you can use it like this.
one example
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 Mar 14, 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 Mar 14, 2015, 03:34 PM
Quote from: S.L.C on Mar 14, 2015, 12:15 PMSo, 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 Mar 14, 2015, 03:40 PM
Quote from: ysc3839 on Mar 14, 2015, 03:34 PMI 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: DizzasTeR on Mar 14, 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 Mar 15, 2015, 02:29 AM
Quote from: S.L.C on Mar 14, 2015, 03:40 PM
Quote from: ysc3839 on Mar 14, 2015, 03:34 PMI 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 Mar 15, 2015, 10:14 AM
Quote from: ysc3839 on Mar 15, 2015, 02:29 AMThere 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 Mar 15, 2015, 10:43 AM
Quote from: S.L.C on Mar 15, 2015, 10:14 AM
Quote from: ysc3839 on Mar 15, 2015, 02:29 AMThere 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 Mar 15, 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 Mar 15, 2015, 11:26 AM
Feel free to PM me for Linux .so :P

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fimg.vc-mp.pl%2Fimages%2Fy1F9xfLPJ.png&hash=752bbeed04192e80055efffa983f6a9bc58dfb1f)
Title: Re: Console Input Plugin
Post by: ysc3839 on Mar 18, 2015, 02:48 PM
Quote from: Gudio on Mar 15, 2015, 11:26 AMFeel free to PM me for Linux .so :P

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fimg.vc-mp.pl%2Fimages%2Fy1F9xfLPJ.png&hash=752bbeed04192e80055efffa983f6a9bc58dfb1f)
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 Mar 28, 2015, 06:41 AM
@ysc3839 - cmdinputrel32 isnt there in bitbucket.Please reupload. Thanks.
Title: Re: Console Input Plugin
Post by: Gudio on Mar 28, 2015, 11:31 AM
Quote from: jayant on Mar 28, 2015, 06:41 AM@ysc3839 - cmdinputrel32 isnt there in bitbucket.Please reupload. Thanks.
It is.
Title: Re: Console Input Plugin
Post by: Sk on Mar 28, 2015, 01:07 PM
Quote from: jayant on Mar 28, 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 Mar 28, 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 Mar 28, 2015, 03:19 PM
Quote from: jayant on Mar 28, 2015, 06:41 AM@ysc3839 - cmdinputrel32 isnt there in bitbucket.Please reupload. Thanks.
reuploaded! :)
Title: Re: Console Input Plugin
Post by: DizzasTeR on Apr 18, 2015, 02:28 PM
Can you update for the new 0.4 candidate, thanks.
Title: Re: Console Input Plugin
Post by: ysc3839 on Apr 18, 2015, 02:32 PM
Quote from: Doom_Killer on Apr 18, 2015, 02:28 PMCan 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 31, 2015, 01:25 AM
Updated plugin header. https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
Title: Re: Console Input Plugin
Post by: ysc3839 on Feb 20, 2016, 01:22 PM
Added Linux support! :D

dll download https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
zip download (https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fc4abad6243de49743cebbdb17b444af2%2F0.4-cmdinput.zip&hash=9926f49628a01b60dd4b260c34b6fa53ebd0a73d) (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 Feb 20, 2016, 01:25 PM
Quote from: ysc3839 on Feb 20, 2016, 01:22 PMAdded Linux support! :D

dll download https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
zip download (https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fc4abad6243de49743cebbdb17b444af2%2F0.4-cmdinput.zip&hash=9926f49628a01b60dd4b260c34b6fa53ebd0a73d) (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 Feb 20, 2016, 03:07 PM
Quote from: [DS]Anik on Feb 20, 2016, 01:25 PM
Quote from: ysc3839 on Feb 20, 2016, 01:22 PMAdded Linux support! :D

dll download https://bitbucket.org/ysc3839/0.4-cmdinput/downloads
zip download (https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fc4abad6243de49743cebbdb17b444af2%2F0.4-cmdinput.zip&hash=9926f49628a01b60dd4b260c34b6fa53ebd0a73d) (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 Feb 20, 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 07, 2016, 04:05 PM
Update to the new plugin API.

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fe8e6bfbe98441934a62c2a2cd440a724%2F0.4-cmdinput-fixed.zip&hash=32920ff834cfef02e82f0addd40073c9a6473183) (http://files.thijn.ovh/download/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)
Title: Re: Console Input Plugin
Post by: Pun1sh3r on May 09, 2016, 07: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 10, 2016, 07:12 AM
Quote from: Pun1sh3r on May 09, 2016, 07:58 PMI 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 21, 2016, 10:00 AM
Fixed.
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fe8e6bfbe98441934a62c2a2cd440a724%2F0.4-cmdinput-fixed.zip&hash=32920ff834cfef02e82f0addd40073c9a6473183) (http://files.thijn.ovh/download/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)
Title: Re: Console Input Plugin
Post by: Pun1sh3r on May 22, 2016, 12:21 PM
Quote from: ysc3839 on May 21, 2016, 10:00 AMFixed.
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Ffiles.thijn.ovh%2Fimg%2Fe8e6bfbe98441934a62c2a2cd440a724%2F0.4-cmdinput-fixed.zip&hash=32920ff834cfef02e82f0addd40073c9a6473183) (http://files.thijn.ovh/download/e8e6bfbe98441934a62c2a2cd440a724/0.4-cmdinput-fixed.zip)

Thanks, works fine!
Title: Re: Console Input Plugin
Post by: Finch Real on Jun 19, 2016, 08: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 Jun 19, 2016, 10:07 AM
Quote from: Finch Real on Jun 19, 2016, 08:26 AMSorry 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 Jul 08, 2016, 02: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 Jul 08, 2016, 03:22 PM
There is a reason the like button exists.
Title: Re: Console Input Plugin
Post by: [Serious]Sam on Jul 08, 2016, 04:07 PM
Am I doing something wrong?
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FTzklTW9.png&hash=72d0c0a0ba57acaa3fbe46565b8541442a3c79eb)
Title: Re: Console Input Plugin
Post by: [Serious]Sam on Jul 08, 2016, 06:39 PM
Quote from: Xmair on Jul 08, 2016, 03:22 PMThere is a reason the like button exists.
Help me if you smart)
Title: Re: Console Input Plugin
Post by: EK.IceFlake on Jul 09, 2016, 08:36 AM
Quote from: [Serious]Sam on Jul 08, 2016, 04:07 PMAm I doing something wrong?
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FTzklTW9.png&hash=72d0c0a0ba57acaa3fbe46565b8541442a3c79eb)
Yes
Change if (!text) to if (text == "")
Title: Re: Console Input Plugin
Post by: [Serious]Sam on Dec 10, 2016, 04:23 PM
Quote from: EK.CrystalBlue on Jul 09, 2016, 08:36 AM
Quote from: [Serious]Sam on Jul 08, 2016, 04:07 PMAm I doing something wrong?
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FTzklTW9.png&hash=72d0c0a0ba57acaa3fbe46565b8541442a3c79eb)
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 Dec 10, 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 Dec 11, 2016, 07:55 AM
Change
if ( cmd = "print" ) print(text);
To
if ( cmd == "print" ) print(text);
Title: Re: Console Input Plugin
Post by: ysc3839 on Jun 25, 2018, 06: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 Jun 25, 2018, 12:38 PM
Quote from: ysc3839 on Jun 25, 2018, 06:54 AMVersion 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


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.

if(!text) print("[CMD] Use /"+cmd+" <code>");
Title: Re: Console Input Plugin
Post by: ysc3839 on Jun 25, 2018, 01:13 PM
Quote from: kennedyarz on Jun 25, 2018, 12:38 PM
Quote from: ysc3839 on Jun 25, 2018, 06:54 AMVersion 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


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.

if(!text) print("[CMD] Use /"+cmd+" <code>");
You lost a "}" after line 5.
Title: Re: Console Input Plugin
Post by: kennedyarz on Jun 26, 2018, 01: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 Jun 26, 2018, 03: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 Jun 26, 2018, 03: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