Andreas. Posted July 31, 2012 Share Posted July 31, 2012 function onClick(button, state, clickedElement) if button == "left" and state == "up" then if clickedElement then if getElementType(clickedElement) == "player" then choosenPlayer = clickedElement elseif getElementType(clickedElement) == "vehicle" then choosenPlayer = clickedElement destroyElement(clickedElement) local playerVeh = getPedOccupiedVehicle(clickedElement) outputChatBox(playerVeh) end end end end addEventHandler("onPlayerClick", root, onClick) I'm sure I'm doing something wrong, but i dunno what Link to comment
Castillo Posted July 31, 2012 Share Posted July 31, 2012 There's nothing to get the player name, I don't really understand what are you trying to do. Link to comment
Andreas. Posted July 31, 2012 Author Share Posted July 31, 2012 There's nothing to get the player name, I don't really understand what are you trying to do. if I click on a vehicle and there is a driver, it should output the drivers name and destroy it Link to comment
Castillo Posted July 31, 2012 Share Posted July 31, 2012 function onClick ( button, state, clickedElement ) if ( button == "left" ) and ( state == "up" ) then if ( clickedElement ) and ( getElementType ( clickedElement ) == "vehicle" ) then local driver = getVehicleController ( clickedElement ) if ( driver ) then outputChatBox ( getPlayerName ( driver ) ) destroyElement ( clickedElement ) end end end end end addEventHandler ( "onPlayerClick", root, onClick ) 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