Sign in to follow this  
buxx0

I can't call the event

Recommended Posts

buxx0    1

Hey. I have some code, example commands that I made are working fine.

 

I can't get player.call to work. I have no idea why. I'm beginner at node/js, previously I scripted some php but nevermind.

 

events.js (packages/gamemode/) server-side - is working fine, console is logging

"use strict";

mp.events.add('playerJoin', (player) => {
  console.log('playerJoin called by' + player.name);
  player.call('playerJoinHandler', player); // not working

});


mp.events.addCommand('veh', (player) => {
  player.call('playerJoinHandler', player);  // working
});

 

events.js (client_packages/gamemode/) - not working

"use strict";

mp.events.add('playerJoinHandler', (player) => {
  mp.gui.chat.push("test");
  player.position = (0, 0, 0);
});

 

I've spent half a day on it. I don't know that I'm retarded AF or what.

 

I think few hours ago it was working, but it seemed random so I deleted everything and started from scratch. I guess I've done something wrong, but my commands were working fine. I only can't get playerJoin to work. I can't find answer on the wiki or in example freeroam so I'm asking here for explanation. Thank for ur time.

 

Edited by buxx0

Share this post


Link to post
Share on other sites
buxx0    1
1 hour ago, ragempdev said:

Are you sure that your events.js was executed?

It should be because if I gonna call playerJoinHandler from command at serverside, it's working.

 

 

Edited by buxx0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.