Jump to content

HELP!


Mateuswiesner

Recommended Posts

How to when the player enter /sellcar. It exit of car automatically?

function playerCarSell ( source, cmd) 
    if(isPedInVehicle(source)) then 
        local playercar = getPedOccupiedVehicle ( source ) 
        if(getElementData ( playercar, "owner" ) == getPlayerName ( source )) then 
            setElementData (playercar,"owner","Nobody") 
            givePlayerMoney ( source, getElementData ( playercar, "price" )/100*50 ) 
            outputChatBox ("You sold your car!",source, 243,149,72 ) 
            saveCars() 
        else 
            outputChatBox ("Error: It's not your car!",source, 255,255,127 ) 
        end 
    else 
        outputChatBox ("Error: You're not the car!",source, 255,255,127 ) 
    end 
end 
  
addCommandHandler ("sellcar",playerCarSell) 

Edited by Guest
Link to comment
function playerCarSell ( source, cmd) 
    if(isPedInVehicle(source)) then 
        removePedFromVehicle (source)        
        local playercar = getPedOccupiedVehicle ( source ) 
        if(getElementData ( playercar, "owner" ) == getPlayerName ( source )) then 
            setElementData (playercar,"owner","Nobody") 
            givePlayerMoney ( source, getElementData ( playercar, "price" )/100*50 ) 
            outputChatBox ("You sold your car!",source, 243,149,72 ) 
            saveCars() 
        else 
            outputChatBox ("Error: It's not your car!",source, 255,255,127 ) 
        end 
    else 
        outputChatBox ("Error: You're not the car!",source, 255,255,127 ) 
    end 
end 
  
addCommandHandler ("sellcar",playerCarSell) 
  

Link to comment

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