Samking Posted April 24, 2019 Share Posted April 24, 2019 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 ds1-e Posted April 25, 2019 Scripting Moderators Share Posted April 25, 2019 On 24/04/2019 at 20:35, 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. Expand 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 1 Link to comment
Samking Posted April 26, 2019 Author Share Posted April 26, 2019 On 25/04/2019 at 00:36, majqq said: 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 Expand can u do it? Link to comment
Gordon_G Posted April 26, 2019 Share Posted April 26, 2019 (edited) 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 April 26, 2019 by Gordon_G 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