04.07.2015, 12:38
[Plugin] samp.js - JavaScript for SA-MP
04.07.2015, 12:45
04.07.2015, 12:46
Still wondering.. Why didn't you used SAMPGDK in this plugin?
It would save a shitload of time.
As well, If I'm not mistaken, SAMPGDK hooks directly into the server memory, So the scripts execution would be faster too.
It would save a shitload of time.
As well, If I'm not mistaken, SAMPGDK hooks directly into the server memory, So the scripts execution would be faster too.
04.07.2015, 13:02
04.07.2015, 13:06
A few reasons... I didn't want to depend on memory hooks plus on the contrary I have actually saved myself more time doing it the way I have as I wrap all native sa-mp functions in javascript around one expose C++ function and all those wrapped functions are automatically generated, which also works for other plugins. If people end up having issues with speed and can narrow it down to a native function then I'd be happy to look into using the SAMPGDK in the future but for now I wanted to get something working as easily and effortlessly as possible and I doubt people will notice the difference of a few microseconds.
05.07.2015, 10:38
Quote:
No, I think he may have no programming knowledge. My guess would be that he doesn't know the difference between a callback and a function.
|
I'm not so stupid to prove my knowledge of any language and I don't care about your view. Sadly I've met too many of you complexing guys.
05.07.2015, 14:13
Thanks. Funny enough I had been looking at your code the past 2 days already and did see that you had called it dynamically with it. Plus was looking at what you did for your issue with cyrillic text
05.07.2015, 15:02
Astonishing work, damo. Keep going m8
05.07.2015, 19:47
First thing, good job!
Second one is that I really want to use this but I'm confused on how to set everything up and running.
Can someone help me out? Thank you.
Second one is that I really want to use this but I'm confused on how to set everything up and running.
Can someone help me out? Thank you.
05.07.2015, 23:37
Quote:
First thing, good job!
Second one is that I really want to use this but I'm confused on how to set everything up and running. Can someone help me out? Thank you. |
Basically all you need to do is download one of the releases and copy all the files and folders into your server directory.
Next just set your gamemode to a blank script and set your filterscript to samp.js
Add samp.js.[so/dll] to your plugins line in the config file
Add a line to your config called jsfiles with a name of a javascript file you would like to load as your script/mode. For example
Код:
jsfiles main.js
You can use this script here https://github.com/damospiderman/sam...xamples/new.js to get you started, its the javascript equivalent of new.pwn
Example Config
Код:
echo Executing Server Config... lanmode 0 rcon_password changeme maxplayers 50 port 7777 hostname SA-MP 0.3 Server gamemode0 bare 1 filterscripts samp.js query 1 chatlogging 0 weburl www.sa-mp.com onfoot_rate 40 incar_rate 40 weapon_rate 40 stream_distance 300.0 stream_rate 1000 maxnpc 10 logtimeformat [%H:%M:%S] language English plugins samp.js.dll jsfiles main.js
06.07.2015, 13:15
11.07.2015, 04:37
New Update - 0.1.9
After looking into GDK more I have decided to implement it for various reasons. Mainly because it allows us to not need the samp.js filterscript and can also hook any public function easily with the new JavaScript function RegisterPublic("OnPlayerConnect", "i", "PlayerConnect", ["playerid"]);. This isn't limited to just samp native publics either. The speed differences in benchmarks with using GDK and without are basically the same though.
Will be putting up a linux build later. Let me know of any issues/bugs you have.
Changelog
samp.js v0.1.9
After looking into GDK more I have decided to implement it for various reasons. Mainly because it allows us to not need the samp.js filterscript and can also hook any public function easily with the new JavaScript function RegisterPublic("OnPlayerConnect", "i", "PlayerConnect", ["playerid"]);. This isn't limited to just samp native publics either. The speed differences in benchmarks with using GDK and without are basically the same though.
Will be putting up a linux build later. Let me know of any issues/bugs you have.
Changelog
Код:
- Added GDK to call native functions and hook publics - samp.js filterscript is no longer needed - Added RegisterPublic to register public function callbacks to the $server.on events - Added CallNativeGDK for calling native functions via GDK - Various bug fixes
12.07.2015, 15:08
13.07.2015, 05:28
This is a small bug major bugfix build
0.1.9.1
Fixes issue with publics/callbacks having incorrect arguments
https://github.com/damospiderman/sam...s/tag/v0.1.9.1
0.1.9.1
Fixes issue with publics/callbacks having incorrect arguments
https://github.com/damospiderman/sam...s/tag/v0.1.9.1
15.07.2015, 02:19
Another bug fix thanks to Laronic for finding it
0.1.9.2 - BUGFIX:
Fixed issue with CallNativeGDK return undefined
Fixed issue with CallNativeGDK setting all supplied floats to the same value
https://github.com/damospiderman/sam...s/tag/v0.1.9.2
0.1.9.2 - BUGFIX:
Fixed issue with CallNativeGDK return undefined
Fixed issue with CallNativeGDK setting all supplied floats to the same value
https://github.com/damospiderman/sam...s/tag/v0.1.9.2
16.07.2015, 10:18
More bugfixes! Thanks again to Laronic for hammering it so we can iron out all the bugs.
0.1.9.3
Bugfixes:
- Typos in Player.js for this._id
- CallNativeGDK multiple string issue
- CallNativeGDK format string being read incorrectly at times
- Issues with the .inc converter not detecting some reference strings correctly
- Added extra checks to stop server crash when using mysql close
- mysql.ping returning undefined
https://github.com/damospiderman/sam...s/tag/v0.1.9.3
0.1.9.3
Bugfixes:
- Typos in Player.js for this._id
- CallNativeGDK multiple string issue
- CallNativeGDK format string being read incorrectly at times
- Issues with the .inc converter not detecting some reference strings correctly
- Added extra checks to stop server crash when using mysql close
- mysql.ping returning undefined
https://github.com/damospiderman/sam...s/tag/v0.1.9.3
16.07.2015, 13:05
Quote:
More bugfixes! Thanks again to Laronic for hammering it so we can iron out all the bugs.
0.1.9.3 Bugfixes: - Typos in Player.js for this._id - CallNativeGDK multiple string issue - CallNativeGDK format string being read incorrectly at times - Issues with the .inc converter not detecting some reference strings correctly - Added extra checks to stop server crash when using mysql close - mysql.ping returning undefined https://github.com/damospiderman/sam...s/tag/v0.1.9.3 |
16.07.2015, 14:41
pretty fast updates. nice work damo
20.07.2015, 15:19
v0.1.9.4
Download 0.1.9.4
A few bug fixes and a few additions, lots of thanks to Laronic and andievandy for submitting bug reports and adding features
Thanks to everyone who is using it and testing. Also feel free to make feature requests for anything and I will most probably add it (within reason).
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
Download 0.1.9.4
A few bug fixes and a few additions, lots of thanks to Laronic and andievandy for submitting bug reports and adding features
Код:
Changes/Bug Fixes - Player.js - Various setters/getters had incorrectly named variables causing issues with player.armour,player.health etc to not work ( thanks andievandy ) - player.world added ( andievandy ) - player.message( color, message ) Added (SendClientMessage alias) - Multiple funcs/getter/setters added by Laronic - Added cameraPos getter/setter - Added cameraLookAt getter/setter - Added cameraAspectRatio getter - Added cameraZoom getter - Added cameraFrontVector getter - Added surfingVehicle getter - Added vehicleSeat getter - Added toggleSpectate setter - Added setCameraBehind() func - Added inVehicle(vehicleid) func - Added inAnyVehicle() func - Added spectateVehicle(vehicleid, mode) func - Added spectatePlayer(target, mode) func - Added isAdmin() func - Added isNPC() func - Added kick() func - Added ban(reason) func - Server.js - Additions by Laronic - Added `rcon(cmd)` func - Added `gamemode` getter/setter - RegisterPublic was being parsed incorrectly causing callbacks to be cancelled when returning 1 instead of 0 - Events.js caused callbacks to not be called in multiple scripts if not defined in the main script - print was causing malformed characters on some(one) machine - Fixed memory leak in print - mysql query now parses date objects to mysql timestamp ( thanks Laronic )
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
22.07.2015, 23:18
Great work! I'm really enjoying it
« Next Oldest | Next Newest »
Users browsing this thread: 4 Guest(s)