Chaos Posted January 12, 2014 Share Posted January 12, 2014 hi i have problem with this code i want to lock the car for group but event onvehiclestartenter not working i don't know why and can anyone enter to vehicle. veh = {} function car(player, command, arg1) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then local x, y, z = getElementPosition(player) if veh[player] then destroyElement(veh[player]) end veh[player] = createVehicle(597, x, y, z) setVehicleDamageProof(veh[player], true) addVehicleUpgrade ( veh[player], 1010 ) end end addCommandHandler("mycar", car) function enterVehicle(enteringPlayer,seat) if seat == 0 and source == veh[player] then local accName = getAccountName ( getPlayerAccount ( enteringPlayer ) ) if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Vip" ) ) then cancelEvent() outputChatBox("This is a private car you can't steal it !",enteringPlayer,255,0,0) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Link to comment
Castillo Posted January 12, 2014 Share Posted January 12, 2014 local veh = { } local vehicles = { } function car ( player, command, arg1 ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Vip" ) ) then local x, y, z = getElementPosition ( player ) if veh [ player ] then vehicles [ veh [ player ] ] = nil destroyElement ( veh [ player ] ) end veh [ player ] = createVehicle ( 597, x, y, z ) setVehicleDamageProof ( veh [ player ], true ) addVehicleUpgrade ( veh [ player ], 1010 ) vehicles [ veh [ player ] ] = accName end end addCommandHandler ( "mycar", car ) function enterVehicle ( enteringPlayer, seat ) if ( seat == 0 and vehicles [ source ] ) then local accName = getAccountName ( getPlayerAccount ( enteringPlayer ) ) if ( vehicles [ source ] == accName ) then cancelEvent ( ) outputChatBox ( "This is a private car you can't steal it !", enteringPlayer, 255, 0, 0 ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Is that what you meant? Link to comment
Chaos Posted January 12, 2014 Author Share Posted January 12, 2014 yes but now im vip but i can't enter This is a private car you can't steal it ! Link to comment
Castillo Posted January 12, 2014 Share Posted January 12, 2014 local veh = { } local vehicles = { } function car ( player, command, arg1 ) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Vip" ) ) then local x, y, z = getElementPosition ( player ) if veh [ player ] then vehicles [ veh [ player ] ] = nil destroyElement ( veh [ player ] ) end veh [ player ] = createVehicle ( 597, x, y, z ) setVehicleDamageProof ( veh [ player ], true ) addVehicleUpgrade ( veh [ player ], 1010 ) vehicles [ veh [ player ] ] = accName end end addCommandHandler ( "mycar", car ) function enterVehicle ( enteringPlayer, seat ) if ( seat == 0 and vehicles [ source ] ) then local accName = getAccountName ( getPlayerAccount ( enteringPlayer ) ) if ( not isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Vip" ) ) ) then cancelEvent ( ) outputChatBox ( "This is a private car you can't steal it !", enteringPlayer, 255, 0, 0 ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now