redditing Posted February 26, 2020 Share Posted February 26, 2020 function building(source, command, detached) xP, yP, zP = getElementPosition(source) local build = createObject(3374, xP, yP, zP) attachElements(build, source, 0, 3, 1) setElementAlpha(build, 150) if detached=="detach" then setElementAlpha(build, 255) if isElement(build) then detachElement(build) end end end addCommandHandler("setBuild", building) When I type the command, a block of hay appears in front of me, but when I type the command with "detach" then I get an error. Can anything be done about it? Link to comment
The_GTA Posted February 27, 2020 Share Posted February 27, 2020 You have misspelled detachElements, you typed detachElement without s. Does this solve your problem? 1 Link to comment
#\_oskar_/# Posted February 27, 2020 Share Posted February 27, 2020 build = {} function building(player, command) if command == "setBuild" then if isElement(build[player]) then destroyElement(build[player]) end xP, yP, zP = getElementPosition(player) build[player] = createObject(3374, xP, yP, zP) attachElements(build[player],player, 0, 3, 1) setElementAlpha(build[player], 150) elseif command == "detach" and isElement(build[player]) then detachElements(build[player] ) end end addCommandHandler("setBuild", building) addCommandHandler("detach",building) try 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