Zcraks Posted January 23, 2021 Posted January 23, 2021 marker = createMarker ( 2371.64, -1126.66, 1050.88 - 1, "cylinder", 0.7) marker:setInterior(8) marker:setDimension(1) addEventHandler("onMarkerHit", marker, function( player ) if player:getType() == "player" and dim == 1 then outputDebugString("TEST") end end) Server side
SpecT Posted January 23, 2021 Posted January 23, 2021 The event onMarkerHit also has an argument for matching dimension (true or false) which you could use. I don't know where you set the variable "dim" so maybe the problem is from there. addEventHandler("onMarkerHit", marker, function( player, matchDim ) if player:getType() == "player" and matchDim then outputDebugString("TEST") end end) *matchDim - true if the player and the marker are in the same dimension
ERAGON007 Posted January 27, 2021 Posted January 27, 2021 (edited) marker = createMarker ( 2371.64, -1126.66, 1050.88 - 1, "cylinder", 0.7) marker:setInterior(8) marker:setDimension(1) addEventHandler("onMarkerHit", marker, function(hitElement, matchingDimension) -- parameter matchingDimension is a boolean value and not a int if hitElement:getType() == "player" and matchingdimension then outputDebugString("Player Hit The Marker!") end end) Edited January 27, 2021 by ERAGON007 Forgot to put arguments of function :)
SpecT Posted January 27, 2021 Posted January 27, 2021 (edited) 20 minutes ago, ERAGON007 said: marker = createMarker ( 2371.64, -1126.66, 1050.88 - 1, "cylinder", 0.7) marker:setInterior(8) marker:setDimension(1) addEventHandler("onMarkerHit", marker, function() -- parameter matchingDimension is a boolean value and not a int if :getType() == "player" and matchingdimension then outputDebugString("Player Hit The Marker!") end end) Yeah and how will it get that "matchingdimension" variable when it's not declared in the function arguments ? Also this ":getType()" will throw an error because no element was specified. I already suggested a solution which I guess is working as the post author didn't write anymore. Edited January 27, 2021 by SpecT
ERAGON007 Posted January 27, 2021 Posted January 27, 2021 1 minute ago, SpecT said: Yeah and how will it get that "matchingdimension" variable when it's not declared in the function arguments ? Also this ":getType()" will throw an error as no element was specified. I already suggested a solution which I guess is working as the post author didn't write anymore. edited
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now