This repository has been archived by the owner on Jun 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Home
damo edited this page Jun 18, 2015
·
11 revisions
print(var) - prints the object/string/variable to the log/console
- load(string:filename) - Loads a javascript file as a new script
- unload(string:filename) - Unloads an existing script
- reload(string:filename) - Unloads then loads an existing script
- include(string:filename) - Includes and runs a file in the current context/script
- require(string:filename/name) - Searches for a script in js/ by name and loads its as a module
- path - The relative path of the main script e.g. js/gamemodes/
- filename - The filename of the main script e.g. main.js
- fullpath - The full path of the main script e.g. js/gamemodes/main.js
The $server object can set and get SA-MP server related functions and also intercepts events.
-
on(string:eventname, function:callback(...))
$server.on("PlayerConnect", function(player){ //do stuff });
- fire (string::eventname,arguments) - Fires a custom event
- memory.heap() Gets the javascript heap size in MB for the current script
- memory.current() Gets the samp-server's current memory usage in MB
- memory.peak() Gets the samp-servers peak memory usage in MB
All SA-MP events which normally have a playerid will send a player object instead. This is a convenience object with many simple functions
player.id // Gets the players id
player.name // Gets the players name
player.name = "Gerald" // Sets the players name
player.pos // Returns the players postion { x, y, z }
player.pos = {x:500,y:200,z:10} // Sets the players position
-
Home
-
V8 Engine
- ES6
- Template Strings
- Hidden Functions
- Classes
- scoped variables
- ES6