Andreas. Posted July 31, 2012 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
Castillo Posted July 31, 2012 Posted July 31, 2012 There's nothing to get the player name, I don't really understand what are you trying to do. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Andreas. Posted July 31, 2012 Author 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
Castillo Posted July 31, 2012 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted July 31, 2012 Posted July 31, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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