harryh Posted April 26, 2014 Share Posted April 26, 2014 Well, the idea here is that if the player is in a vehicle it executes the harvestWeed function and if he is not it tells him to /pickbud. But when the player is in a vehicle it says /pickbud. I do not understand why. Code: function weedhit( element, matchingDimension ) if (isElement(element)) and (getElementType(element)=="vehicle") and (matchingDimension) then local thePlayer = getVehicleOccupant(element) local vehName = getVehicleName(element) local vehicleID = getVehicleModelFromName(vehName) if (vehicleID==532) then harvestWeed() else outputChatBox("You can't harvest with this vehicle!!", thePlayer) end elseif (isElement(element)) and (matchingDimension) and not (getElementType(element)=="vehicle") then outputChatBox("/pickbud to pick the weed!", thePlayer) else outputChatBox("Error!! Contact an Admin, F2", thePlayer) end end addEventHandler ( "onColShapeHit", getRootElement(), weedhit ) Link to comment
Castillo Posted April 26, 2014 Share Posted April 26, 2014 function weedhit ( element, matchingDimension ) if ( isElement ( element ) and matchingDimension and getElementType ( element ) == "player" ) then if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) local vehicleID = getElementModel ( vehicle ) if ( vehicleID == 532 ) then harvestWeed ( ) else outputChatBox ( "You can't harvest with this vehicle!!", element ) end else outputChatBox ( "/pickbud to pick the weed!", element ) end else outputChatBox("Error!! Contact an Admin, F2", element ) end end addEventHandler ( "onColShapeHit", getRootElement(), weedhit ) 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