Jump to content

restrict ONE car to skin or acl group


tim260

Recommended Posts

Can i do like restrict the car to one person and the car id in my map file is : vehicle (Bullet) (1) and only the persons in the skin 29

 dealerVehicles = { vehicle (Bullet) (1)]=true} 
    dealerTeams = {[29]=true} 
      
    function dealerenterVehicle ( player, seat, jacked ) 
        if ( dealerVehicles[getElementModel ( source )] ) and ( not dealerTeams[getElementModel(player)] ) and ( seat == 0 ) then 
            outputChatBox ( "You aren't dealer , you can't drive this.", player ) --and tell the player why 
            cancelEvent() 
        end 
    end 
    addEventHandler ( "onVehicleStartEnter", getRootElement(), dealerenterVehicle ) 

Link to comment

you'll need getElementID:

dealerVehicles = { ["vehicle (Bullet) (1)"] = true } 
dealerTeams = { [29] = true } 
      
function dealerenterVehicle ( player, seat, jacked ) 
  if ( dealerVehicles[getElementID(source)] ) and ( not dealerTeams[getElementModel(player)] ) and ( seat == 0 ) then 
    outputChatBox ( "You aren't dealer , you can't drive this.", player) --and tell the player why 
    cancelEvent() 
  end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), dealerenterVehicle ) 

Link to comment

I mean like there is a bullet in the base of the speed demons clan the id of the bullet is " vehicle (Bullet) (1)" and the acl group of this clan is called dealers i want the car (" vehicle (Bullet) (1)") only able to enter by the dealers acl group of if not possible with acl with skin. but not ALL bullets only that ONE, so vehicle (Bullet) (1)

Link to comment

oh ok well idk how to do it this way but when i lock cars i do like this ..

Hunter1 = createVehicle ( 425, 362.26513671875, 1997.4976806641, 21.543445587158, 0, 0, 91.75 ) 
  
  
function lockTheHydras(player, seat, jacked) 
if source == Hunter1 then 
local accountname = getAccountName (getPlayerAccount(player)) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "AR-AirForce" ) ) then return end 
cancelEvent() 
outputChatBox ( "Only Airforce or Special Forces can enter this vehicle", player, 255, 0, 0, true ) 
end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), lockTheHydras ) 

The difference i just take cordinates and create the vehicle in the lua file instead and wellchange the acl group to whatever u want

BTW serverside script

Link to comment

Please explain this furhter i dont understand :P

in the mean while why is this script not working the gate is created but not moving o.O

   gate1 = createObject ( 980, 2061.8999023438, 2464.8000488281, 12.60000038147, 0, 0, 180.24719238281 ) 
   col = createColCircle ( 2061.8999023438, 2464.8000488281, 12.60000038147, 7 ) 
  
function opena51gates(thePlayer) 
if getElementModel( thePlayer ) == 71 then 
       moveObject (gate1, 3000, 2061.8999023438, 2464.8000488281, 17.200000762939 ) 
end 
end 
addEventHandler( "onColShapeHit", col, opena51gates ) 
  
function closea51gates(thePlayer) 
if getElementModel( thePlayer ) == 29 then 
       moveObject (gate1, 3000, 2061.8999023438, 2464.8000488281, 12.60000038147 ) 
end 
end 
addEventHandler( "onColShapeLeave", col, closea51gates ) 

Link to comment

Hm try this with debugscript 3 on if it says colshape when you go to it then the colshape is right

  
gate1 = createObject ( 980, 2061.8999023438, 2464.8000488281, 12.60000038147, 0, 0, 180.24719238281 ) 
col = createColCircle ( 2061.8999023438, 2464.8000488281, 12.60000038147, 7 ) 
  
function opena51gates(thePlayer) 
outputDebugString ( "Colshape." ) 
if getElementModel( thePlayer ) == 71 then 
       moveObject (gate1, 3000, 2061.8999023438, 2464.8000488281, 17.200000762939 ) 
end 
end 
addEventHandler( "onColShapeHit", col, opena51gates ) 
  
function closea51gates(thePlayer) 
if getElementModel( thePlayer ) == 29 then 
       moveObject (gate1, 3000, 2061.8999023438, 2464.8000488281, 12.60000038147 ) 
end 
end 
addEventHandler( "onColShapeLeave", col, closea51gates ) 

Link to comment

Still can you help me with the script for restricting one car ?

i had to use

getElementByID 

right ? im gonna make a script ( TRY to make :P ) you can see whats wrong then :P

EDIT oh btw whats wrong with this one :

dealerVehicles = { ["vehicle (Bullet) (1)"] = true } 
dealerTeams = { [29] = true } 
      
function dealerenterVehicle ( player, seat, jacked ) 
  if ( dealerVehicles[getElementID(source)] ) and ( not dealerTeams[getElementModel(player)] ) and ( seat == 0 ) then 
    outputChatBox ( "You aren't dealer , you can't drive this.", player) --and tell the player why 
    cancelEvent() 
  end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), dealerenterVehicle )  

Link to comment

Fine i will take a look again after i cleaned up my room lol

EDIT L to let you know:

this is the car where is it about :

"vehicle-bullet" paintjob="3" model="541" plate="Y799UHE" interior="0" dimension="0" color="54,14,0,0" posX="2099" posY="2479.5" posZ="10.5" rotX="0" rotY="0" rotZ="179.99462890625">

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