Ryan167 Posted February 26 Share Posted February 26 So I'm new into learning scripting if this script looks awful, that's why. What I'm trying to do is have a marker in dimension 11 and when the player joins the marker the player can't use a jetpack (it works but it stays working even outside the marker) and the weapons disabled, which works fine. Also with the dimensions, the marker only shows on dimension 11 but works in all dimensions, how could I make the marker only trigger on dimension 11? function createTheMarker () hMarker = createMarker (-10,-10,0, "cylinder", 55, 255, 12, 0, 100, getRootElement()) setElementDimension (hMarker, 11) end addEventHandler("onResourceStart", getRootElement(), createTheMarker) function markerHit (hitPlayer, matchingDimension) if (source == hMarker) then if (getElementType (hitPlayer) == "player") then if ( getElementDimension ( source ) == 11 ) then if ( not isPedWearingJetpack ( hitPlayer ) ) then else --create a check if player is using jetpack inside marker setTimer ( function(markerHit) setPedWearingJetpack ( hitPlayer, false ) end, 1000, 0 ) outputChatBox ( "#FF0000Jetpacks are not allowed, cheater.", hitPlayer, 255, 255, 255, true ) end end end end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) function markerHit (hitPlayer, matchingDimension) if (source == hMarker) then if (getElementType (hitPlayer) == "player") then if (getElementDimension (hitPlayer, 11)) then setPedWearingJetpack ( hitPlayer, false ) setPedWeaponSlot(hitPlayer, 0) toggleControl (hitPlayer, "fire", false) toggleControl (hitPlayer, "next_weapon", false) toggleControl (hitPlayer, "previous_weapon", false) toggleControl (hitPlayer, "aim_weapon", false) toggleControl (hitPlayer, "vehicle_fire", false) toggleControl (hitPlayer, "vehicle_secondarry_fire", false) toggleControl (hitPlayer, "vehicle_fire", false) elseif (getElementType (hitPlayer) == "vehicle") then destroyElement (hitPlayer) end end end end addEventHandler ("onMarkerHit", getRootElement(), markerHit) function markerLeave (leavePlayer, matchingDimension) if (source == hMarker) then if (getElementType (leavePlayer) == "player") then toggleControl (leavePlayer, "fire", true) toggleControl (leavePlayer, "next_weapon", true) toggleControl (leavePlayer, "previous_weapon", true) toggleControl (leavePlayer, "aim_weapon", true) toggleControl (leavePlayer, "vehicle_fire", true) toggleControl (leavePlayer, "vehicle_secondarry_fire", true) toggleControl (leavePlayer, "vehicle_fire", true) end end end addEventHandler ("onMarkerLeave", getRootElement(), markerLeave) If someone could explain what I'm doing wrong, I'd greatly appreciate it! Link to comment
Moderators IIYAMA Posted February 26 Moderators Share Posted February 26 2 hours ago, Ryan167 said: how could I make the marker only trigger on dimension 11? If the parameter matchingDimension contains the value true, the marker is hit in the same dimension. 2 hours ago, Ryan167 said: What I'm trying to do is have a marker in dimension 11 and when the player joins the marker the player can't use a jetpack (it works but it stays working even outside the marker) and the weapons disabled, which works fine. Instead of setting a timer. Which currently is being created infinity > crashing the server at a given point. Do the following: When giving a jetpack, check if the player is inside of the marker. Based on that, give the Jetpack yes / no. -- Making the marker find able inside of another resource local antiJetpack = createElement ( "antiJetpackType", "antiJetpackID" ) local marker = createMarker ( 0, 0, 0, "cylinder", 1.5, 255, 255, 0, 170 ) setElementParent(marker, antiJetpack) (Other resource) local parent = getElementByID ("antiJetpackID") if not parent then return end local marker = getElementChildren ( parent )[1] local status = isElementWithinMarker ( thePlayer, marker ) https://wiki.multitheftauto.com/wiki/IsElementWithinMarker Link to comment
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