Jump to content

private vehicle


Amine#TN

Recommended Posts

Posted

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

TN Zombies infection Project OWNER

i choose a wrong partner
 

Posted

this means you should replace this with the  first if statement in your script

if source == vehicle and seat == 0 then

 

 

●●●

Rage Gaming Society

Coming Soon

●●●

  • Moderators
Posted

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.

The rEvolution is coming ...

Posted

that is the problem i need only the driver seat is private other account names are allowed to use others seats 

  • Like 1

TN Zombies infection Project OWNER

i choose a wrong partner
 

  • Moderators
Posted

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.

The rEvolution is coming ...

Posted

this is enough to get the account name of a player

local accountName = getAccountName(account)

No need for the function you were using and I have no idea whether it even works this way.

 

●●●

Rage Gaming Society

Coming Soon

●●●

Posted

bro the script working good but i need to make only seat 0 is private other seats are allowed for all

  • Like 1

TN Zombies infection Project OWNER

i choose a wrong partner
 

Posted

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) 

 

 

●●●

Rage Gaming Society

Coming Soon

●●●

Posted (edited)
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

- Hashemite Kingdom Of Jordan -

Posted

i did not need it when the player want his car he must go to the place where i create it and thanx

  • Like 1

TN Zombies infection Project OWNER

i choose a wrong partner
 

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