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

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.

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
Answer this question...

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



×
×
  • Create New...