Jump to content

Acl vehicle


Samking

Recommended Posts

function enterVehicle (player, seat)
	if getElementModel(source) == 592 and seat == 0 then
		local accName = getAccountName(getPlayerAccount (player))
		if not isPlayerInGroup (player, "pilot") then
			cancelEvent()
			outputChatBox ( "Only Pilots can enter in this vehicle", player,255,0, 0,true)
		end
	end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle )

Error : pilot\vehicle.lua:6: attempt to call global 'isPlayerInGroup'  (a nil value)

Please help me to solve this problem.

Link to comment
  • Scripting Moderators
4 hours ago, Samking said:

function enterVehicle (player, seat)
	if getElementModel(source) == 592 and seat == 0 then
		local accName = getAccountName(getPlayerAccount (player))
		if not isPlayerInGroup (player, "pilot") then
			cancelEvent()
			outputChatBox ( "Only Pilots can enter in this vehicle", player,255,0, 0,true)
		end
	end
end
addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle )

Error : pilot\vehicle.lua:6: attempt to call global 'isPlayerInGroup'  (a nil value)

Please help me to solve this problem.

Function isPlayerInGroup most likely doesn't exist. If we're about ACL maybe you wanted this?

bool isObjectInACLGroup ( string theObject, aclgroup theGroup )

https://wiki.multitheftauto.com/wiki/IsObjectInACLGroup

  • Confused 1
Link to comment

No we won't do your job, we can explain you but we are not your slaves

 

isObjectInACLGroup function requires two args as it's written on the mta's wiki

isObjectInACLGroup ( string theObject, aclgroup theGroup )

First argument : theObject: the name of the object to check. Examples: "resource.ctf", "user.Jim". - source : wiki

What is interesting us here is the "user.Jim" example because we want to know if the driver is an admin

Maybe we could do something with it, like assembling "user." and the player's account name

isObjectInACLGroup ( "user."..accName, aclgroup theGroup )

Second argument : theGroup: the ACL group pointer of the group from which the object should be found. - source : wiki

The argument required here is not a string like in the first argument it's an "aclgroup"

In the wiki's example you can see this :

isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) )

The function that is interesting us is aclGetGroup let's copy and paste it in our function

 

As you can see you could have solve your problem directly by just READING the wiki when @majqq gave you the right function

Have a nice day

 

Edited by Gordon_G
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...