Jump to content

Recommended Posts

Posted

Okay, so, I wanted to add a chat message when interacting with an entity

I got it to send the chat message but, for some reason, it sends it twice

 

here is the code

 

 

  Reveal hidden contents

 

 

can anyone tell me why it's sending the chat message twice?

Posted

it seems to add the chat message twice even if I don't have it under the if statement

 

as in

 

 

  Reveal hidden contents

 

 

still adds it twice

Posted

its sends message twice,beacos you need to check server side and client side.....message to player sending from both of them,so you need to check is it server or no.How to do it?

if (!mc.thePlayer.worldObj.isRemote) {
			  //client side
		  } else
		  {
			  //server side
		  }

if you want,you can add that simple message "moo" at client side,but if you want to make it "Moo my age is"+bla bla,then you need to make it server side,beacos that is better ;)

 

p.s. if you want,you can send message on client for first comment,that will work

Posted

yeah, I just got it before I saw your comment :P

Though  I found just adding it into a

 

if (!worldObj.isRemote)
{
addChatMessage("moo")
}

 

seemed to work

 

but I'll keep in mind the code you've given me for future use if I need to do more complex stuff with it

Posted
  On 9/10/2013 at 3:10 PM, fhntv24 said:

its sends message twice,beacos you need to check server side and client side.....message to player sending from both of them,so you need to check is it server or no.How to do it?

if (!mc.thePlayer.worldObj.isRemote) {
			  //client side
		  } else
		  {
			  //server side
		  }

if you want,you can add that simple message "moo" at client side,but if you want to make it "Moo my age is"+bla bla,then you need to make it server side,beacos that is better ;)

 

p.s. if you want,you can send message on client for first comment,that will work

You mixed up client and server side, but the idea is here. :P

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.