Jump to content
McKay Development

Recommended Posts

Posted (edited)

Is it possible to make an if statement like

client.on('friendMessage', function (steamID, message) {

    if (message.match('!logoff') {

        if (steamID == 76...) {
        client.sendMessage(steamID, 'logging off.')
        client.logOff();

        } else {
            client.sendMessage(steamID, 'Sorry, this is an owner-only command'
        }
    }
});

I just quickly made this script so if there are some errors, I didn't try exactly this script but i tried a script very similar. This part was the same:

if (steamID == 76...) {

And if there's an option it should be easy to make allow everyone except for 1 steamid/user by just changing == in !== right.

Edited by jafix
Posted

  1. steamID is a SteamID object. If you want the 64-bit ID, use steamID.getSteamID64()

  2. JavaScript can't precisely track numbers that are larger than 253. You need to wrap it in quotes to make it a string for comparison.
  3. Correct regarding == and !=.

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...