Skip to content

Instantly share code, notes, and snippets.

@draobrehtom
draobrehtom / tasks.lua
Created May 13, 2022
GTA V Tasks List
View tasks.lua
tasksIndex = {
CTaskHandsUp = 0,
CTaskClimbLadder = 1,
CTaskExitVehicle = 2,
CTaskCombatRoll = 3,
CTaskAimGunOnFoot = 4,
CTaskMovePlayer = 5,
CTaskPlayerOnFoot = 6,
CTaskWeapon = 8,
CTaskPlayerWeapon = 9,
View config.lua
Config = {}
if GetResourceState('es_extended') == 'started' or GetResourceState('extendedmode') == 'started' then -- ESX
Config.Framework = "ESX"
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
elseif GetResourceState('qb-core') == 'started' then -- QBCore
Config.Framework = "QBCore"
local success = pcall(function()
print(exports['qb-core'].GetCoreObject)
end)
@draobrehtom
draobrehtom / package.json
Created Jan 14, 2020
FiveM: JS - Development config
View package.json
{
"name": "gungame",
"version": "1.0.0",
"description": "Gun Game gamemode for FiveM",
"main": "index.js",
"scripts": {
"buildc": "tsc --build src/client/tsconfig.json",
"builds": "tsc --build src/server/tsconfig.json",
"build": "npm run buildc && npm run builds",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
@draobrehtom
draobrehtom / aim.js
Created Jan 2, 2020
Fivem: JS - Aiming to entity and deleting it
View aim.js
let previousPed;
GiveWeaponToPed(PlayerPedId(), GetHashKey('WEAPON_SNOWBALL'), 30, false, true);
setTick(() => {
if (IsPlayerFreeAiming()) {
let r = GetEntityPlayerIsFreeAimingAt(PlayerId());
if (r[0] && DoesEntityExist(r[1])) {
if (IsEntityAPed(r[1]) && IsEntityDead(r[1]) === false) {
previousPed = PlayerPedId();
SwitchOutPlayer(previousPed, 0, 0);
SwitchInPlayer(r[1]);
@draobrehtom
draobrehtom / car.js
Created Jan 2, 2020
FiveM: JS - Creating car
View car.js
RegisterCommand("car", async (source, args) => {
let vehicleName = args[0] ? args[0] : 'adder';
if (! IsModelInCdimage(vehicleName) || ! IsModelAVehicle(vehicleName)) {
emitNet("js:chat", 'spawn a ' + vehicleName + '. Who even wants their spawning to actually ^*succeed?', [0,0,0]);
return;
}
RequestModel(vehicleName);
let i = setInterval(() => {
emitNet("js:chat", 'model loading', [0,0,0]);
@draobrehtom
draobrehtom / README.md
Last active Sep 21, 2019
TCP and UDP ports redirection
View README.md

UDP redirection:

https://unix.stackexchange.com/questions/205959/how-can-i-redirect-all-udp-traffic-from-one-port-to-another-on-bsd-os-x/207595#207595?newreg=fed9c03544f84687a9299f26752b21e2

TCP redirection:

https://serverfault.com/questions/238563/can-i-use-ufw-to-setup-a-port-forward

@draobrehtom
draobrehtom / list.js
Created Sep 15, 2019
Two different approaches to List files in NodeJS
View list.js
let start = new Date();
require('fs').readdir(require('path').join(__dirname), (err, files) => {
if (! err) {
files.forEach(function (file) {
require('./' + file);
});
}
});
console.log(new Date() - start + 'ms'); // 1 ' ms'