Jump to content
McKay Development

Fartura

Recommended Posts

Hello I wanted to make my bot when someone adds it said "hello (name of person) thanks for adding" how do I? I only have this but I do not know how to put the person's name

 

I have this:

 

post-1888-0-28039300-1506475813_thumb.png 

 

how to customize to show the person's name?

 

client.on('friendRelationship', (steamid, relationship) => {
    if (relationship === 2) {
        client.addFriend(steamid);
client.chatMessage(steamid, 'Hello! Thanks for add me, if you need help write !help'); 
        console.log("You add " + (steamid))
    }
});
Link to comment
Share on other sites

sorry but I'm not very good with code
 
How should I put my code?
 
Is he as he should be?
 
client.on('friendRelationship', (steamid, relationship) => {
    if (relationship === 2) {
        client.addFriend(steamid);
client.chatMessage(steamid, 'Hello! Obrigado por me adicionar, se você precisar de ajuda, escreva! help''); 
        console.log("You add " + (steamid))
    }
});
Link to comment
Share on other sites

client.on('friendRelationship', (steamid, relationship) => {
    if (relationship === 2) {
        client.addFriend(steamid);
        client.chatMessage(steamid, 'Hello! Thanks for add me, if you need help write !help');
        
        //getting name using getPersonas
        client.getPersonas([steamid], function(personas) {
             var persona = personas[steamid.getSteamID64()];
             var name = persona ? persona.player_name : ("[" + steamid.getSteamID64() + "]");

             //You can use 'name' to show their name
             console.log("You add: " + name + " - " +steamid);
        });
    }
});

Pretty much like this

Edited by Vanilla
Link to comment
Share on other sites

 

client.on('friendRelationship', (steamid, relationship) => {
    if (relationship === 2) {
        client.addFriend(steamid);
        client.chatMessage(steamid, 'Hello! Thanks for add me, if you need help write !help');
        
        //getting name using getPersonas
        client.getPersonas([steamid], function(personas) {
             var persona = personas[steamid.getSteamID64()];
             var name = persona ? persona.player_name : ("[" + steamid.getSteamID64() + "]");

             //You can use 'name' to show their name
             console.log("You add: " + name + " - " +steamid);
        });
    }
});

Pretty much like this

 

I do not think you understood my objective.
I want that when the person adds me to appear in the chat of the person
Hello (here the name of the person who added me)! Thanks for add me, if you need help write! Help
Link to comment
Share on other sites

 

I do not think you understood my objective.
I want that when the person adds me to appear in the chat of the person
Hello (here the name of the person who added me)! Thanks for add me, if you need help write! Help

 

 

Like I said above, variable "name" is now availabe to use in above code

Just add this code above console.log

client.chatMessage(steamid, 'Hello ' +name+ ', thanks for add me, if you need help write !help'); 
Edited by Vanilla
Link to comment
Share on other sites

 

Like I said above, variable "name" is now availabe to use in above code

Just add this code above console.log

client.chatMessage(steamid, 'Hello ' +name+ ', thanks for add me, if you need help write !help'); 
thanks, it was not working but I changed places and it already works, thank you.
 
one more question, can I erase the friendship after a while? for example, my bot accepts the friendship today at 1:00 p.m. and erases the friendship tomorrow at 1:00 p.m.?
 
What is the code for this to work?
Link to comment
Share on other sites

 

one more question, can I erase the friendship after a while? for example, my bot accepts the friendship today at 1:00 p.m. and erases the friendship tomorrow at 1:00 p.m.?
 
What is the code for this to work?

 

 

You might need a database for that (like Oracle, MySQL, MonggoDB).

I'm not sure how to do that though

Link to comment
Share on other sites

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