Jump to content

Code error help?[Solved]


quadrinka4

Recommended Posts

local player = getPlayer();
local px = getPlayer():getX();
local py = getPlayer():getY();

   
    if (px == 10994 && py == 9647) then
    player:Say("here i am");
    end

 

 

 

Hello everyone, in this code I am trying to make a player say  "here i am" when its function is executed at certain location.

however, the console keep giving me there's an error at line 5 saying "   ')' expected to be near & " .

Could anyone help me to fix this problem?

Thank you in advance.

 

 

Edited by quadrinka4
Link to comment
Share on other sites

11 minutes ago, RoboMat said:

Lua doesn't use && like java ... you have to use and


local player = getPlayer();
local px = getPlayer():getX();
local py = getPlayer():getY();

if (px == 10994 and py == 9647) then
    player:Say("here i am");
end

 

Thank you ^^!!

 

is there also a way to make the function to check not the exact that spot but within 3 blocks of that spot??

Link to comment
Share on other sites

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