Jump to content

isElementWithinMarker problem


orcun99

Recommended Posts

Posted (edited)

 

 

local theMarker = createMarker ( -283.43835449219,1470.9427490234,1083.2, "cylinder", 1.5, 255, 255, 0, 170 )
setElementInterior(theMarker, 15) 
setElementDimension(theMarker, 3) 


function theMarker(thePlayer, matchingDimension)
for i, p in ipairs(getElementsByType("player")) do 
    if isElementWithinMarker(p, theMarker) then 
setElementDimension ( source, 0 )
setElementInterior ( source, 0, -2033.7825927734,2335.9631347656,4.9999980926514 )
    outputChatBox("oldu", thePlayer, 255, 0, 0)
 else
   outputChatBox("hata!", thePlayer, 255, 0, 0)
end
 end
end


     

 

why this is not work 
 

Edited by orcun99
Posted
Just now, StormFighter said:

Are the marker and the player in the same dimension?

yep marker dim3 and int 15 

so I check myself in adminpanel my dim3 and int15 but dosen't work :/

Posted
9 minutes ago, StormFighter said:

You call this function somehow, right?

uhm no this is client side in meta.xml

and I can see marker but when I'm inside market do nothing

Posted
Just now, orcun99 said:

uhm no this is client side in meta.xml

and I can see marker but when I'm inside market do nothing

You have to call that function to get it work. You can do this with a simple event, and addEventHandler. This event is onClientMarkerHit ON CLIENT SIDE. So like:

1 hour ago, orcun99 said:
  1. local theMarker = createMarker ( -283.43835449219,1470.9427490234,1083.2, "cylinder", 1.5, 255, 255, 0, 170 )
  2. setElementInterior(theMarker, 15) 
  3. setElementDimension(theMarker, 3) 
  4.  
  5.  
  6. function theMarker(thePlayer, matchingDimension)
  7. for i, p in ipairs(getElementsByType("player")) do 
  8.     if isElementWithinMarker(p, theMarker) then 
  9. setElementDimension ( source, 0 )
  10. setElementInterior ( source, 0, -2033.7825927734,2335.9631347656,4.9999980926514 )
  11.     outputChatBox("oldu", thePlayer, 255, 0, 0)
  12.  else
  13.    outputChatBox("hata!", thePlayer, 255, 0, 0)
  14. end
  15.  end
  16. end
  17. addEventHandler("onClientMarkerHit", theMarker, theMarker)
  18. -- If this does not work, change the function name to something else, because it can be messed up with your variable that contains the actual marker.

 

Posted (edited)

      local theMarker = createMarker ( -283.43835449219,1470.9427490234,1083.2, "cylinder", 1.5, 255, 255, 0, 170 )
setElementInterior(theMarker, 15) 
setElementDimension(theMarker, 3) 


function theMarker2(thePlayer, matchingDimension)
for i, p in ipairs(getElementsByType("player")) do 
    if isElementWithinMarker(p, theMarker) then 
setElementDimension ( source, 0 )
setElementInterior ( source, 0, -2033.7825927734,2335.9631347656,4.9999980926514 )
    outputChatBox("oldu", thePlayer, 255, 0, 0)
 else
   outputChatBox("hata!", thePlayer, 255, 0, 0)
end
 end
end
addEventHandler("onClientMarkerHit", theMarker2, theMarker)

 

still not work bro :/

Edited by orcun99
  • Moderators
Posted (edited)

You have to do this serverside. As client you do not have the full authority to change the behaviour of other players. You can change it, but with the next synchronisation update it will be reset. And most importantly, it can cause desync for the players.

The structure of the code is original serverside based, see syntax of outputChatBox when used serverside.

outputChatBox

 

And don't forget to debug the code in all possible ways, see debug tutorial for a better way to figure out what your code does and doesn't.

 

Edited by IIYAMA

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...