Jump to content

Get data from shape


Recommended Posts

Posted
function take(theElement)
  if getElementData(shape, "take") == "+" then -- How to check colShape date element from server side?
    if not isPedInVehicle then return end
    if (theElement == localPlayer) then
      local veh = getPedOccupiedVehicle(localPlayer)
      local model = getElementModel(veh)
      if model == 485 then
        triggerEvent("notiAdd", localPlayer, "success", "Done")
      else
        triggerEvent("notiAdd", localPlayer, "error", "Error")
      end
    end
  end
end
addEventHandler("onClientColShapeHit", root, take)

How to getElementData colShape from server side?

Posted (edited)

Hi

-- theElement: the element that entered the colshape.
-- The source of this event is the colshape that was hit.

function take(theElement, matchingDimension)

    if not (theElement == localPlayer) then  
		-- Checks whether the entering element is the local player
        return
    end
	
	if not (isPedInVehicle(localPlayer) then
		-- Checks if local player is not in a vehicle
		return
	end

	-- your colshape stuff
	if getElementData(source, "take") == "+" then -- source = colshape
		local veh = getPedOccupiedVehicle(localPlayer)
		local model = getElementModel(veh)
		if model == 485 then
			triggerEvent("notiAdd", localPlayer, "success", "Done")
		else
			triggerEvent("notiAdd", localPlayer, "error", "Error")
		end
    end
	
end
addEventHandler("onClientColShapeHit", root, take)

 

Edited by Mkl

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