Jump to content

cant get the players name


Andreas.

Recommended Posts

Posted
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 :(

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

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

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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