Jump to content
McKay Development

Recommended Posts

Posted

I have variable that contains steamid64. There is a reason using variable, Because it changes. This id event is not working, However it does with const. Does it work only with const? If yes, How can i make it work?

client.on('friendMessage#' + variable, function(steamID, message) {
  console.log("works");
  client.chatMessage(steamID, "works " + message);
});
Posted (edited)

It works with initial value. So I think i should clear cache and refresh after every changes somehow. How can i achieve it without restarting whole nodejs app?

 

Edit: I found a way and it is only to check steamid is equal to variable within friendMessage  id event. 

Edited by tvman99
Posted

As you discovered, calling client.on('friendMessage#' + variable, ...) only creates a listener for the SteamID contained in variable at the time the listener was added. If you need to change the SteamID you're listening for, you need to just listen for friendMessage and check the SteamID in the event.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...