Code Monkey home page Code Monkey logo

altv-vchat's People

Contributors

5exyguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

altv-vchat's Issues

Server crashed after use commands

My gamemode - Clientside: JS, Serverside: C#
I got regiserCmd work, and command works well.
But after using the command, there is a crash without logs(errors), I can only judge that it is the crash after using the command.(Not typing!!!)
but sometimes it works, Doesn't seem to be a problem with registerCmd. I tested it without registerCmd, it crash my server too.
I put log test(server -> chat.ts):
if (words.length > 0) { if (this.optionsService.getOption('logPlayerCommands')) this.loggerService.log([Commmand] ${player.name}: ${message}`);

            let args = words.split(' ');
            let cmdName = args.shift() ?? '';

            const invoked = this.commandService.invoke(player, cmdName, args);

            logError("Invoked doing, result = " + invoked)

            if (invoked)
            {
                logError("Invoked success, result = " + invoked)
                return;
            }

            logError("Invoked failed, result = " + invoked)

            const unknownCommandMessage = this.optionsService
                .getOption('unknownCommandMessage')
                .replace('{0}', cmdName);


            try {
                this.mountService.waitForMount(
                    player,
                    this.windowService.send(player, unknownCommandMessage, MessageType.Error),
                );

                logError("The command doesnt exists")
            }
            catch (e) {
                logError(`[Error] ${e}`);
            }
        }`

i have no idea...

Functions with function parameter can't be imported to C#

Firstly thanks for this wonderful project.

I loved the entire logic, but I needed to import my existing C# commands to VChat and failed it.
The problem is functions with function parameter, in this case the following export function:

export function registerCmd(cmdName: string, handler: CommandHandler): void;

can't be imported to C# environment.

I tried a couple of ways but it's not possible in my case. I tried the following way:

 // Functions without function parameter works โœ…๐Ÿ‘
Alt.Import("altv-vchat", "muteAllPlayers", out Action muteAllPlayers); 

// Throws exception โŒ ๐Ÿ‘Ž
Alt.Import("altv-vchat", "registerCmd", out Action<string, Action<IPlayer, string[]>> registerCmd);

registerCmd("ping", (player, args) =>
{
    Console.WriteLine("Hello, World!");
});

image

not working clearMessageHistory(); clearMessages();

i have some issues. I've try to clear messages after playr disconnect from server and nothing happened. Messages still there.
here is the code `alt.on('playerDisconnect', playerDisconnect);

function playerDisconnect(player) {
if (!player || !player.valid) {
return;
}
let pos;
let ID = player.getSyncedMeta('ID');
pos = player.pos;

global.DB.query(
'UPDATE characters SET x=?, y=?, z=?, h=?, hp=?, armour=? WHERE uuid=?',
[pos.x, pos.y, pos.z, pos.z - 1, player.health, player.armour, ID],
function (err, r) {}
);
chat.clearMessageHistory(player);
chat.clearMessages(player);
alt.log(${player.name} has disconnected from the server.);
}`

maybe i do something wrong? can you help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.