Yo World Yo Vice City Yo Tommy

Started by RyderX, Dec 29, 2016, 06:50 PM

Previous topic - Next topic

RyderX

Introduction
Hello all Vice City Multi-player Followers, i came to VC:MP and im new here i came From SA:MP and i am Scripter There.
Hope that world would be cool and Fun.

ON-Topic
Hello VC:MP Developer Stromeus And all Beta Tester[Wiki....],
i'm just asking that in VC:MP i can make Scripts? Like Gamemode and filterScripts and includes and anything like that?
And can someone give me an example of making a little script like /healme to see the style of the scripting.
And if there's advantages to make scripts then what is the Applications to make scripts in it?
Thanks Very much :).


Cool

Hi download ready made script from showroom and take a look at script

KAKAN

#3
Hello RyderX,
                    Here we use a scripting language named 'Squirrel'. It's easier than pawn, and has support for classes too.
For learning it, you must have basic knowledge of scripting. It's pretty much JavaScript.
For documentation, you can go here: http://www.squirrel-lang.org/squirreldoc/
Here's a example of the language: http://www.squirrel-lang.org/#look
Alternatives website for learning includes: https://electricimp.com/docs/squirrel/
In VCMP, we use 'callbacks' from the plugin to use our script accordingly. A simple /healme command would look like this:-
http://pastebin.com/ppffrHhj

For an editor, you can use anything. You don't need to compile anything, so, use anything you want. I'd prefer VS Code if you go for free.
oh no

RyderX

Okay then, But it there any includes?
For Example: function onPlayerCommand( invoker, command, arguments ){
if( command == "healme" ) //You don't need to put a '/' here.
{
if( invoker.Health == 100 ) PrivMessage( invoker, "You already have 100 HP." );
else {
invoker.Health = 100;
MessagePlayer( "INFO: You've 100 HP now.", invoker );
//This are the 2 functions to send a personal Message( PM ) to a player from the server.
}
}
}

This the code you gave it, is there in the up[in the beginning of the script] something like #include <a_vcmp>? Or just you can type command with callbacks and function and done?

DizzasTeR

There aren't any includes, but you have to specify plugins in the server.cfg file. The most important one to use all the utilities is the squirrel plugin.

Now regarding filterscripts, that's a big disadvantage VCMP has at the moment. VCMP does not support filterscripts with event bindings

What that means is, you CAN load more script files as an attachment to your main script but you can't use same event twice

Here's an example:

[spoiler=Main.nut]
function onScriptLoad()
{
    /* other things */
    dofile( "Functions.nut", true );
    dofile( "Commands.nut", true );
    /* some stuff here and there */
}
[/spoiler]

[spoiler=Functions.nut]
function Add( a, b )
{
    return a + b;
}
[/spoiler]

[spoiler=Commands.nut]
function onPlayerCommand( player, command, arguments )
{
    /* your commands defined in this file */
}
[/spoiler]

However like I said, in SAMP you can repeat callbacks/events in the files/filterscripts, but here you cannot so for example consider the Main.nut like this:

[spoiler=Main.nut]
function onScriptLoad()
{
    /* other things */
    dofile( "Functions.nut", true );
    dofile( "Commands.nut", true );
    /* some stuff here and there */
}

function onPlayerJoin( player )
{
    Message( player.Name + " has joined the server" );
}
[/spoiler]

and then Functions.nut like this:

[spoiler=Functions.nut]
function onPlayerJoin( player )
{
    return true;
}
[/spoiler]

The event at Functions.nut will override the one in Main.nut and you will never see the message.

KAKAN

Quote from: Doom_Kill3R on Dec 30, 2016, 07:01 AMNow regarding filterscripts, that's a big disadvantage VCMP has at the moment. VCMP does not support filterscripts with event bindings
What that means is, you CAN load more script files as an attachment to your main script but you can't use same event twice
But you can use classes and make them work like you do in filterscripts...
Like this: http://forum.vc-mp.org/?topic=3912.msg29075#msg29075
oh no

DizzasTeR

Yes but that's a different story, creating your very own personal event handlers is something different than the official plugin. The main concept was to tell him that he can't repeat events. If he codes one, then ofcourse that will work out

p.s: Crystal is not the first to make it, my MGM server had it.

RyderX

Ok i understood it,
OT:all VCMP Server based in SQL?

RyderX

And Does VC:MP Provides LAN Servers? mean just CLient to test script in my pc not a host just testing.

KAKAN

Quote from: RyderX on Dec 30, 2016, 07:06 PMAnd Does VC:MP Provides LAN Servers? mean just CLient to test script in my pc not a host just testing.
yup, add your local IP address.
Quote from: RyderX on Dec 30, 2016, 07:03 PMOT:all VCMP Server based in SQL?
Its Squirrel. No, you can script your server in C++ or use your own language if you know C++
oh no

jWeb

Quote from: RyderX on Dec 30, 2016, 07:03 PMOk i understood it,
OT:all VCMP Server based in SQL?

Unlike the SA mods. VC:MP is not tied to any particular scripting language. It has a C++ plugin system which can be used to extend it's functionality. In fact, Squirrel is a plugin which exposes that functionality for the Squirrel language.