Jump to content

[HELP] ACL Vehicle


xXGhostXx

Recommended Posts

local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

function vh ( player, seat )
	if not ( pGroup ( thePlayer ) ) then
		return false
	end
	if seat == 0 then -- allow to sit only next to the driver

				cancelEvent()
				outputChatBox ( "#ffff00Shoma Dar Faction F.B.I Nistid!", player,240,155,15,true)
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), vh )

What is problem in my code ?!

ACL group can enter vehicle and other player cant enter vehicle !

Link to comment
5 minutes ago, xXGhostXx said:

local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

function vh ( player, seat )
	if not ( pGroup ( thePlayer ) ) then
		return false
	end
	if seat == 0 then -- allow to sit only next to the driver

				cancelEvent()
				outputChatBox ( "#ffff00Shoma Dar Faction F.B.I Nistid!", player,240,155,15,true)
end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), vh )

What is problem in my code ?!

ACL group can enter vehicle and other player cant enter vehicle !

if you want it through the tables

local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"
Table = {}

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

addEventHandler( 'onVehicleStartEnter' , root , 
	function( player , seat , jacked )
		if ( Table[ player ] == false or Table[ player ] == nil ) then
			outputChatBox( "You Don't Have Premission To Ride This Vehicle" , player , 255 , 0 , 0 , true )
			cancelEvent( true )
		end
	end
)

if you want it by rank

local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

addEventHandler( 'onVehicleStartEnter' , root , 
	function( player , seat , jacked )
		Account_Name = getAccountName( getPlayerAccount( player ) )
		if ( isObjectInACLGroup( 'user.' .. Account_Name , aclGetGroup(  'Your Group Name' ) ) == false ) then
			outputChatBox( "You Don't Have Premission To Ride This Vehicle" , player , 255 , 0 , 0 , true )
			cancelEvent( true )
		end
	end
)

 

Link to comment
2 minutes ago, KillerX said:

if you want it through the tables


local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"
Table = {}

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

addEventHandler( 'onVehicleStartEnter' , root , 
	function( player , seat , jacked )
		if ( Table[ player ] == false or Table[ player ] == nil ) then
			outputChatBox( "You Don't Have Premission To Ride This Vehicle" , player , 255 , 0 , 0 , true )
			cancelEvent( true )
		end
	end
)

if you want it by rank


local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

addEventHandler( 'onVehicleStartEnter' , root , 
	function( player , seat , jacked )
		Account_Name = getAccountName( getPlayerAccount( player ) )
		if ( isObjectInACLGroup( 'user.' .. Account_Name , aclGetGroup(  'Your Group Name' ) ) == false ) then
			outputChatBox( "You Don't Have Premission To Ride This Vehicle" , player , 255 , 0 , 0 , true )
			cancelEvent( true )
		end
	end
)

 

Worked !

But player cant G in vehicle !

But other vehicle in model id cant enter or g !

Link to comment
2 minutes ago, xXGhostXx said:

Worked !

But player cant G in vehicle !

But other vehicle in model id cant enter or g !

local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

addEventHandler( 'onVehicleStartEnter' , root , 
	function( player , seat , jacked )
		Account_Name = getAccountName( getPlayerAccount( player ) )
		if ( seat ~= 0 ) then return end
		if ( isObjectInACLGroup( 'user.' .. Account_Name , aclGetGroup(  'Your Group Name' ) ) == false ) then
			outputChatBox( "You Don't Have Premission To Ride This Vehicle" , player , 255 , 0 , 0 , true )
			cancelEvent( true )
		end
	end
)

 

Link to comment
4 minutes ago, KillerX said:

local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

addEventHandler( 'onVehicleStartEnter' , root , 
	function( player , seat , jacked )
		Account_Name = getAccountName( getPlayerAccount( player ) )
		if ( seat ~= 0 ) then return end
		if ( isObjectInACLGroup( 'user.' .. Account_Name , aclGetGroup(  'Your Group Name' ) ) == false ) then
			outputChatBox( "You Don't Have Premission To Ride This Vehicle" , player , 255 , 0 , 0 , true )
			cancelEvent( true )
		end
	end
)

 

Not work !

Link to comment

really? u wanna keep asking these questions to make a gamemode and tell u wrote it ur self? god bless u my friend

first start learnin lua basics then start practicing mta events and functions then maybe u could write a gamemode ur self u know why im saying this?

because when u cant write these basic things how u wanna write for example full functional faction system?

if i want to be honest i hate guys like u who wants to abuse other peoples help, so if u wanna write a gamemode learn scripting and write it yourself and dont waste our time

i respect everyone on this forum but i have to say something to all of them , dont waste ur time guys let him learn something

Edited by Behnam-Edit
  • Like 1
  • Thanks 1
Link to comment
2 minutes ago, Behnam-Edit said:

really? u wanna keep asking these questions to make a gamemode and tell u wrote it ur self? god bless u my friend

first start learnin lua basics then start practicing mta events and functions then maybe u could write a gamemode ur self u know why im saying this?

because u cant write these basic things how u wanna write for example full functional faction system?

if i want to be honest i hate guys like u who wants to abuse other peoples help, so if u wanna write a gamemode learn scripting and write it yourself and dont waste our time

i respect everyone on this forum but i have to say something to all of them , dont waste ur time guys let him learn something

like ❤️

@Behnam-Edit made the right word

  • Thanks 1
Link to comment
On 01/10/2018 at 19:33, KillerX said:

local policeVehicles =
{
	{411, 1595.4, -1710.1, 5.7},

	{411, 1591.6, -1710.1, 5.7},
}
local police = "Police"

addEventHandler("onResourceStart",resourceRoot,function()
	for _, v in ipairs(policeVehicles) do
		local veh = createVehicle(v[1],v[2],v[3],v[4]) -- spawn a car
	end
end)

addEventHandler( 'onVehicleStartEnter' , root , 
	function( player , seat , jacked )
		Account_Name = getAccountName( getPlayerAccount( player ) )
		if ( seat ~= 0 ) then return end
		if ( isObjectInACLGroup( 'user.' .. Account_Name , aclGetGroup(  'Your Group Name' ) ) == false ) then
			outputChatBox( "You Don't Have Premission To Ride This Vehicle" , player , 255 , 0 , 0 , true )
			cancelEvent( true )
		end
	end
)

 

This code fixed !

But spawn vehicle model 411 from admin cant enter vehicle !

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