Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player prototype may break when player disconnects #1

Open
Tracked by #23
xxshady opened this issue Jul 29, 2022 · 5 comments
Open
Tracked by #23

Player prototype may break when player disconnects #1

xxshady opened this issue Jul 29, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@xxshady
Copy link
Owner

xxshady commented Jul 29, 2022

I don't know how to reproduce it with a clean script, though.

@xxshady xxshady added the bug Something isn't working label Jul 29, 2022
@xxshady
Copy link
Owner Author

xxshady commented Jul 30, 2022

And I think it's related to this altmp/altv-js-module#106

@ApollonSeven
Copy link

ApollonSeven commented Mar 28, 2024

I have same error

import * as alt from 'alt-client';

export class TrafficCamera extends alt.LocalObject {
  public serverId: string | number;

  constructor(serverId: string | number, pos: alt.Vector3, rot: alt.Vector3) {
    super('ch_prop_ch_camera_01', pos, rot);
    this.frozen = true;
    this.serverId = serverId;

    this.text();
  }

  public text(){
    console.log(123);
  }
 }

Log error:

Uncaught exception in event listener of event "worldObjectStreamIn":
 TypeError: this.text is not a function
    at new TrafficCamera (client/index.js:4551:10)
    at TrafficCameraService.add (client/index.js:4570:5)
    at client/index.js:4530:35
    at f (client/index.js:28:2712) 
[V8] Exception at core:client/index.js:28 
${a}  `)} ${r[1]}`}it=function(e,n=!0){let r=0;n&&(e=ho(e)),e=Vn(e,"NFC");for(le... 
TypeError: this.text is not a function
    at new TrafficCamera (client/index.js:4551:10)
    at TrafficCameraService.add (client/index.js:4570:5)
    at client/index.js:4530:35
    at f (client/index.js:28:2712) 
TypeError: this.text is not a function 

My config:

import { altvEsbuild } from "altv-esbuild"
import esbuild from "esbuild"

export const watch = async ({
  esbuild: esbuildOptions,
  altvEsbuild: altvEsbuildOptions,
}) => {
  const ctx = await esbuild.context({
    bundle: true,
    target: "esnext",
    logLevel: "info",
    format: "esm",
    plugins: [
      altvEsbuild({
        dev: true, // enables hot reload automatically

        // see docs for more info about these options:
        altvEnums: true,         
        ...altvEsbuildOptions,
        bugFixes: {
          playerPrototype: true
        }
      })
    ],

    ...esbuildOptions,
  })

  ctx.watch()
}

@xxshady
Copy link
Owner Author

xxshady commented Mar 28, 2024

@ApollonSeven do you use js module v2? (btw your issue is unrelated to this one)

@ApollonSeven
Copy link

ApollonSeven commented Mar 28, 2024

@ApollonSeven do you use js module v2?

@xxshady How can I check this? I have just 'js-module' string in my server.toml

@xxshady
Copy link
Owner Author

xxshady commented Mar 28, 2024

then its v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants