[Plugin] samp.js - JavaScript for SA-MP
#41

Quote:

I also have a working example of reading MapAndreas files natively in samp.js with both buffered and non-buffered versions if anyone is interested give me a shout and I will make it pretty and upload it

Yea that sounds interesting, but I don't use MapAndreas anymore. I use ColAndreas. Still, I'd like to see your MapAndreas stuff.
Reply
#42

Here is the module: https://github.com/damospiderman/sam...s/heightmap.js

Usage

PHP код:
var map = require('heightmap').full('scriptfiles/SAfull.hmap');
// or alternatively nobuffer
var map = require('heightmap').nobuffer('scriptfiles/SAfull.hmap');

var 
height map.Get(1292.0320, -2012.4912); 
Reply
#43

Nice work!
Perhaps you can make the PHP language too
^****** translate^sorry for the bad english
Reply
#44

For some reason the print function is getting called two times in the latest version (v0.1.9.4). Maybe it could also be an issue in the event system?

With the follow code:
PHP код:
$server.on('GameModeInit', function() {
    print(
'test');
    print(
'test2');
    return 
1;
});
$server.on('PlayerConnect', function(player) {
    print(
'Player ' player.id ' joined.');
    return 
1;
}); 
I get this in the console/server_log:
Код:
[18:51:07] Player 0 joined.
[18:51:07] test
[18:51:07] test2
[18:51:07] Player 0 joined.
[18:51:07] test
[18:51:07] test2
Somebody else have also this issue or is it just me?
Reply
#45

Quote:
Originally Posted by BlackBank3
Посмотреть сообщение
For some reason the print function is getting called two times in the latest version (v0.1.9.4). Maybe it could also be an issue in the event system?

With the follow code:
PHP код:
$server.on('GameModeInit', function() {
    print(
'test');
    print(
'test2');
    return 
1;
});
$server.on('PlayerConnect', function(player) {
    print(
'Player ' player.id ' joined.');
    return 
1;
}); 
I get this in the console/server_log:
Код:
[18:51:07] Player 0 joined.
[18:51:07] test
[18:51:07] test2
[18:51:07] Player 0 joined.
[18:51:07] test
[18:51:07] test2
Somebody else have also this issue or is it just me?
That's really weird, I haven't noticed anything like that in my tests.

Are you using the Windows version or Linux?
Reply
#46

Actually I think I know what it is. Are you still using the old samp.js filterscript? If so you need to remove it as its not needed anymore and will cause issues ( like events being called twice )
Reply
#47

Quote:
Originally Posted by theYiin
Посмотреть сообщение
Finally! <3

Код:
cmds.set(['car', 'veh', 'vehicle'], function(player, data) {

}
would be awesome too
Great suggestion! check github for updated version

(Notice I'm using add instead of set here)
pawn Код:
cmds.add(['announce', 'anno'], function(player, data)
{
    if(!data.text) {
        return player.message(`Usage: /${data.cmd} [msg]`);
    }
    $server.message(`Announcement: ${data.text}`);
});
Reply
#48

Just a quick question. Is it possible to use npm modules?
Reply
#49

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Just a quick question. Is it possible to use npm modules?
Unfortunately it is not. Would be a nice feature but to implement nodejs would be a big under taking... I did look into it though at one stage
Reply
#50

This is really interesting! Nice job!
Reply
#51

Quote:
Originally Posted by !damo!spiderman
Посмотреть сообщение
Unfortunately it is not. Would be a nice feature but to implement nodejs would be a big under taking... I did look into it though at one stage
Thx for quick answer, kinda expected that answer but still was just curious.
Reply
#52

Great work, and I like the latest bug fixes
Reply
#53

What is 'let'?
Reply
#54

Quote:
Originally Posted by SkittlesAreFalling
Посмотреть сообщение
What is 'let'?
https://developer.mozilla.org/en-US/...Statements/let
Reply
#55

Nevermind, great work!
Reply
#56

Going to play with this interesting plugin. For two years of my development in PAWN I was dreaming about such a language with dynamic array sizes, closures, flexible & handy objects, normal event/callback system and no freaking PAWN compiler

Well, I just wanted to say "thanks, I love this plugin's idea and I'm going to play with it or even use it". +Rep for you, keep going!
Reply
#57

Quote:
Originally Posted by prineside
Посмотреть сообщение
Going to play with this interesting plugin. For two years of my development in PAWN I was dreaming about such a language with dynamic array sizes, closures, flexible & handy objects, normal event/callback system and no freaking PAWN compiler

Well, I just wanted to say "thanks, I love this plugin's idea and I'm going to play with it or even use it". +Rep for you, keep going!
I actually like PAWN compiler as i dont have to start my server and only than realize i fucked up somewhere
Reply
#58

Nice! Never seen a plugin like it!
+rep
Reply
#59

Small Bug:
When typing 'loadjs <scriptname>.js' into console even though script is already loaded will crash server.

Spelling:
$fs.exits = $fs.exists @ line: 103 (samp.js/FileSystem.js)

Spelling:
[ERROR][samp.js] FileSystem.js:151: TypeError: Cannot read property 'mkdir' of undefined
[ERROR][samp.js] return this.internval.mkdir(directory);

CRASH:
Код:
SendClientMessage(player.id, COLOR.WHITE, String.format("Welcome to %s, %s!", ServerData.name, player.name);
It is because I forgot the )
Код:
SendClientMessage(player.id, COLOR.WHITE, String.format("Welcome to %s, %s!", ServerData.name, player.name));
Quote:

[ERROR][samp.js] js/cops&robbers.js:317: SyntaxError: missing ) after argument list
[debug] Server crashed due to an unknown error
[debug] Native backtrace:
[debug] #0 0049dc0c in ?? () from samp-server.exe
[debug] #1 779bd2d9 in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[debug] #2 779e8e5c in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[debug] #3 698a3264 in ?? () from C:\WINDOWS\system32\apphelp.dll
[debug] #4 698a328c in ?? () from C:\WINDOWS\system32\apphelp.dll
[debug] #5 0049eef9 in ?? () from samp-server.exe
[debug] #6 0048b460 in ?? () from samp-server.exe
[debug] #7 004a5a3b in ?? () from samp-server.exe
[debug] #8 0049cf72 in ?? () from samp-server.exe

Reply
#60

Amazing work !

It's possible to use external libaries in our server delopment like socket.io ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)