637 / 639 New player Welcome Message

 
Oct 28, 2012
74
2
0
Hey so I haven't really touched any of this stuff in like 9 years lol, basically i've been messing around with the Inxity 637 release (long live 637 haha); anyways I've been trying to add a welcome message when a new player joins that broadcasts it to the server. I've snooped around for quite a bit and couldn't find a single tutorial for this on a 637/639 source, I've tried methods for 667 / 718+ but couldn't get it to work. At first I had a bunch of errors and I managed to get it to compile without errors by moving it around in Player.java and changing some of the translation around and I thought I actually managed to do it then, but then it just wasn't sending any message hahaha. I'll give some thumbs up for whoever can help, also i'll post the code for the Player.Java as an attachment (Nevermind it wouldn't let me lol, I'll put the code on Pastebin). Thanks!
 
I figured out how to add a "player has just logged in message" (I basically just stole the "has reached level 99 announcement" from Inxity levelup.java and took out the bits regarding the skill stuff).
Add this in actionsender.java after the initial "Welcome to ...." message
for (Player pl : World.getWorld().getPlayers()) { pl.sendMessage("<col=ff0033>" + Misc.formatPlayerNameForDisplay(player.getUsername()) + " has just logged in!"); }
Which is definitely progress! But I still want a special welcome message specifically for players who's first logging in. Anyone got any ideas?
 
I figured it out motherfuckers! hahahaha. It took like 6 hours, and it displays the welcome message aswell as the "has logged in message", but it's pretty cool man :cool:. (this method only works if you have a tutorialscene)
Add these imports to the top of your tutorialscene.java, you'll most likely have to add them in actionsender.java aswell for the first bit of code

import org.dementhium.model.World; import org.dementhium.util.Misc;

Now add this in the middle of the curly braces towards the end

public void start() { scene.start(); for (Player pl : World.getWorld().getPlayers()) { pl.sendMessage("<col=ff0033>" + Misc.formatPlayerNameForDisplay(pl.getUsername()) + " Has logged in for the first time! Everybody give them a welcome!"); } }

Turned out to be rather simple, but I feel like someone figuring out a problem on their own (even if it could be implemented a lot better hahaha) is a rarity on this forum. Feel free to move this to tutorials if im worthy :))
 
Last edited:
  • Like
Reactions: nbness2
I figured it out motherfuckers! hahahaha. It took like 6 hours, and it displays the welcome message aswell as the "has logged in message", but it's pretty cool man :cool:. (this method only works if you have a tutorialscene)
Add these imports to the top of your tutorialscene.java, you'll most likely have to add them in actionsender.java aswell for the first bit of code

import org.dementhium.model.World; import org.dementhium.util.Misc;

Now add this in the middle of the curly braces towards the end

public void start() { scene.start(); for (Player pl : World.getWorld().getPlayers()) { pl.sendMessage("<col=ff0033>" + Misc.formatPlayerNameForDisplay(pl.getUsername()) + " Has logged in for the first time! Everybody give them a welcome!"); } }

Turned out to be rather simple, but I feel like someone figuring out a problem on their own (even if it could be implemented a lot better hahaha) is a rarity on this forum. Feel free to move this to tutorials if im worthy :))
It's always solid and good for you as a programmer to try and figure it out yourself before you ask for help! Just to see if you can! And even after you do figure it out, ask anyways to see if there's a better way you can do it because sometimes you'll connect some dots and be able to apply that better way to future things
 
  • Like
Reactions: surf473

Users who are viewing this thread (total: 1, members: 0, guests: 1)