Skip to content

NodeJS library for Scripting San Andreas Multiplayer:SAMP depends on samp-node plugin

License

Notifications You must be signed in to change notification settings

peterszombati/samp-node-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

samp-node-lib

NodeJS library for Scripting San Andreas Multiplayer : SAMP depends on samp-node plugin

some part of source code was auto generated with NodeJS

Getting started

Step 0 install samp-node

Step 1 install samp-node-lib via npm

npm i samp-node-lib

Example usage

import {
    ManualVehicleEngineAndLights,
    OnGameModeInit,
    OnPlayerCommandText
} from "samp-node-lib";

OnGameModeInit(() => {
    ManualVehicleEngineAndLights();
});

//

OnPlayerCommandText((player, cmdtext) => {
    player.SendClientMessage('rgba(255,0,0,1)', cmdtext)
});

Example using for gates

import {
    DynamicObject,
    OnGameModeInit,
    OnPlayerCommandText
} from "samp-node-lib";


let o1: DynamicObject;
let o2: DynamicObject;

OnGameModeInit(() => {
    o1 = new DynamicObject(3049, 808.012, 842.4, 10.9, 0.0, 0.0, 293.198)
        .setOpen(806.29, 846.4, 10.9, 0.0, 0.0, 293.2);
    o2 = new DynamicObject(3050, 808, 842.4, 10.9, 0.0, 0.0, 114.988)
        .setOpen(809.5, 839.2, 10.9, 0.0, 0.0, 114.99);
});

OnPlayerCommandText((player, cmdtext) => {
    if (cmdtext === '/open') {
        o1.open();
        o2.open();
        return 1;
    }
    if (cmdtext === '/close') {
        o1.close();
        o2.close();
        return 1;
    }
});