Jump to content

help with how to lock a vehicle to accountName


Adde

Recommended Posts

Hey, I got some problems with my "lock vehicle to AccountName" script and I hope that anyone can help me.

Only the player with accountName "Addeboyy" should be able to enter. The script wont let me enter the vehicle even if it´s my acc-name that should work to enter. It outputs to chatbox to me "You can not use bla bla bla...". Nothing in debug but it must be something wrong with the getting of the account right? If I use "source" instead of "thePlayer" it doesn´t work, it says [Expected account at argument 1, got boolean] in debug.

Help?

rancher1 = createVehicle ( 490, 2215.8991699219, -3134.2083007813, 6.1535439491272 ) 
setElementRotation ( rancher1, 0, 0, 85 ) 
  
setVehicleDamageProof ( rancher1, true ) 
  
addEventHandler ( "onVehicleStartEnter", rancher1, 
  function ( thePlayer ) 
    local name = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( name == Addeboyy ) then 
else 
      outputChatBox ( "You cannot use this vehicle as it belongs to [sALA]Adde!", thePlayer, 255, 0, 0 ) 
      cancelEvent ( ) 
        end 
      end 
) 
  

Link to comment
local rancher1 = createVehicle ( 490, 2215.8991699219, -3134.2083007813, 6.1535439491272 ) 
setElementRotation ( rancher1, 0, 0, 85 ) 
setVehicleDamageProof ( rancher1, true  
) 
  
addEventHandler ( "onVehicleStartEnter",rancher1, 
  function ( thePlayer ) 
    local name = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if ( name ~= 'Addeboyy' ) then 
        cancelEvent (   ) 
        outputChatBox ( "You cannot use this vehicle as it belongs to [sALA]Adde!", thePlayer, 255, 0, 0 ) 
    end 
end,false 
) 

Try it.

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