Jump to content
  • 0

Question

Posted

Hello,

 

i am very new at developing own sourcecodes for l2j cores and i got now my first question. Why does my script not work?

 

i added in Enterworld.java the following lines:

	if (activeChar.isGM())
		{

		activeChar.sendMessage("Hallo GM!");
		}
	else
	{
		activeChar.sendMessage("Hallo Spieler");
	}

 

if i log in as a gm char there is a "Hallo GM!" in the System Window. But for normal players there doesnt happen anything...why?

9 answers to this question

Recommended Posts

  • 0
Posted

if (activeChar.isGM())
{		
activeChar.sendMessage("Hallo GM!");
}
else if (!activeChar.isGM())
{
activeChar.sendMessage("Hallo Spieler");
}

 

i think it will work like this

  • 0
Posted

its not the same

 

look....

 

my :

 

if (activeChar.isGM())

{

 

activeChar.sendMessage("Hallo GM!");

}

else

{

activeChar.sendMessage("Hallo Spieler");

}

 

vagos:

 

if (activeChar.isGM())

{

activeChar.sendMessage("Hallo GM!");

}

else if (!activeChar.isGM())

{

activeChar.sendMessage("Hallo Spieler");

}

 

the "!" means that the opposite of the following is that what will happen ( sorry for my bad english :P )

  • 0
Posted

its not the same

 

look....

 

my :

 

	if (activeChar.isGM())
		{

		activeChar.sendMessage("Hallo GM!");
		}
	else
	{
		activeChar.sendMessage("Hallo Spieler");
	}

 

vagos:

 

the "!" means that the opposite of the following is that what will happen ( sorry for my bad english :P )

come on it is the same! else means that if is not the first..so it will not be gm
  • 0
Posted

The first script should work. You surely forget to update the .jar.

 

if (activeChar.isGM())
   activeChar.sendMessage("Hallo GM!");
else
   activeChar.sendMessage("Hallo Spieler");

 

----

 

Now if you want to add the name of the player, as it's currently static in your code:

 

activeChar.sendMessage("Hello "+ activeChar.getName() + ", welcome in our server !");

 

----

 

You can too add a static message value:

 

String test = "This is a test."
activeChar.sendMessage(test);

 

which equals to :

 

activeChar.sendMessage("This is a test.");

 

Prefer to use second option for readability.

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


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock