Jump to content
alt:V Multiplayer Forum


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Solved by: native.setEntityHeading
  2. Hey there, anybody up to help me set the rotation of the player? Right here (https://wiki.altv.mp/index.php/ServerJS:Player) it says "rot" is an entity. The entity page (https://wiki.altv.mp/index.php/ServerJS:Entity) says it's an object. How do I set it now though? Thanks in advance
  3. nki

    ES6 Classes in alt:V

    Sorry had a lot on my mind lately... I refactored everything into more or less one resource.
  4. nki

    ES6 Classes in alt:V

    Thanks for clarifying! I cleaned up my act, but still get the same error: TypeError: Class constructor Business cannot be invoked without 'new' Any ideas?
  5. nki

    ES6 Classes in alt:V

    Hey there, first: I didn't really know where to put this, hope here is ok. I got the following issue: I declare a class in a resource module, reference and declare it as dependency but always get the following error when using it [18:58:08][Error] [V8] Exception at game:file:///E:/altv-server/resources/game/server/index.mjs:9 [18:58:08][Error] let bus = new Business( 2, "test 2"); [18:58:08][Error] TypeError: Class constructor Business cannot be invoked without 'new' The class: const businesses = []; export class Business { constructor( id, name ) { this.id = id; this.name = name; businesses.push( this ); } getBusinesses() { return businesses; } } Usage: import * as alt from "alt"; import { Business } from "business"; import * as util from "util"; let bus = new Business( 2, "test 2"); alt.log( util.inspect( bus) ); alt.log( util.inspect( bus.getBusinesses() ) ); If I import like this, it works: import { Business } from "../../business/server/business"; But this is not the correct way, right? Anybody dealt with this before and might lend me a hand? Thanks!
  6. so far this works, if it helps anybody import MongoClient from "mongodb"; import * as fs from 'fs'; import co from "co"; let db; const config = JSON.parse( fs.readFileSync( "./resources/mongo/config.json" ) ); MongoClient.connect( config.url, { useNewUrlParser: true, poolSize: config.poolSize }, function(err, client) { console.log("Connected successfully to server"); db = client.db( config.db ); } ); export function insertOne( collection, obj, callback ) { co( function*() { yield db.collection( collection ).insertOne( obj ); callback( ); } ).catch( function( err ) { console.log( err.stack ); }); } you need to "npm install co" and "npm install mongodb"
  7. Why can't I handle default mongoose queries like: const User = new mongoose.model( "user", userSchema ); User.create( { "email": email, "password": hash } ).then( ( userId ) => { alt.log("userId: " + JSON.stringify(userId)); } ) .catch( ( exception ) => { alt.log("register catch: " + exception); } ); Kinda Stuyk here...
  • Create New...