Jump to content

private vehicle


Amine#TN

Recommended Posts

vehicle = createVehicle( 503, 1513.61328125, -1479.384765625, 9.7, 0, 0, 272 )
setVehicleColor( vehicle, 0, 0, 0 )

ID = 3


myBlip = createBlipAttachedTo ( vehicle, ID )

    function  lockPrivate( theplayer, seat, jacked )
        if ( source == vehicle ) then                
            local account = getPlayerAccount( theplayer )
            local accountName = ( account and getAccountName ( account ) or "" )
            if not( accountName == "Quiel1290" or accountName == "noOne" ) then 
                cancelEvent()
                outputChatBox("#9E0000This vehicle is locked for following users:#0D9905 |GB|{Q}uiel #9E0000Shared With #0D9905NoOne ", theplayer, 255, 255, 255, true)
            else
                outputChatBox("#0D9905Welcome to your vehicle, Sir!", theplayer, 255, 255, 255, true)
            end
        end

    end

addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate )
setVehicleDamageProof(vehicle, true) 







------------
i need some one who can make only the driver seat private and other players can ride other seats 

  • Like 1
Link to comment
  • Moderators

Test again. What SuperCroz said is right, this should work as attended. If you can not enter the vehicle, then it's probably because you are not logged in, or if you are, maybe with the wrong account. Try printing the accountName value to check that.

Also, tell us what you get in the chatbox if it's not working.

Link to comment
  • Moderators

Yeah then:

8 hours ago, Citizen said:

Test again. What SuperCroz said is right, this should work as attended. If you can not enter the vehicle, then it's probably because you are not logged in, or if you are, maybe with the wrong account. Try printing the accountName value to check that.

Also, tell us what you get in the chatbox if it's not working.

Link to comment

will you mind deleting everything in your file and pasting that code below instead and then test?

vehicle = createVehicle( 503, 1513.61328125, -1479.384765625, 9.7, 0, 0, 272 )
setVehicleColor( vehicle, 0, 0, 0 )

ID = 3


myBlip = createBlipAttachedTo ( vehicle, ID )

    function  lockPrivate( theplayer, seat, jacked )
        if source == vehicle and seat == 0 then                
            local account = getPlayerAccount( theplayer )
            local accountName = (getAccountName ( account ) )
            if not( accountName == "Quiel1290" or accountName == "noOne" ) then 
                cancelEvent()
                outputChatBox("#9E0000This vehicle is locked for following users:#0D9905 |GB|{Q}uiel #9E0000Shared With #0D9905NoOne ", theplayer, 255, 255, 255, true)
            else
                outputChatBox("#0D9905Welcome to your vehicle, Sir!", theplayer, 255, 255, 255, true)
            end
        end

    end

addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate )
setVehicleDamageProof(vehicle, true) 

 

Link to comment
25 minutes ago, A.mine said:

table of what bro

Vehicle !

-- # Example 
local Table = { }

addCommandHandler ("Car", 
  function ( player )
    local x , y , z = getElementPosition ( player ) 
    local Table[player] = createVehicle( id , x , y , z )
    end
  )

addEventHandler ("onPlayerQuit",root,
  if isElement ( Table[source] ) then
    destroyElement ( Table[source] ) 
    Table[source] = nil
    end
  end
)
    

 

Edited by #_iMr.[E]coo
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...