illestiraqi Posted March 8, 2013 Share Posted March 8, 2013 In this script link given: https://community.multitheftauto.com/index.php?p= ... ls&id=1152 all of the groups are free and i can make it passworded witch will work but im getting resources step by step and I need this permission, like some other 50+ server goes like You need permission to join this group. How do I do that? There are too many files i cant post so please help me make it ACL permission Link to comment
50p Posted March 8, 2013 Share Posted March 8, 2013 Try this: -- make new line (21) in s_main.lua local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL and ( not isGuestAccount( plrAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) ) then outputChatBox( "You are not member of this team/gang. Please, choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; end Also, make a new ACL group for each team (eg. team "Police") you want to restrict and add for each player inside that group: <group name="Police" > <object name="user.USERNAME" /> </group> Not tested but should work. Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 Try this: -- make new line (21) in s_main.lua local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL and ( not isGuestAccount( plrAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) ) then outputChatBox( "You are not member of this team/gang. Please, choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; end Also, make a new ACL group for each team you want to restrict and add for each player inside that group: <group name="Police" > <object name="user.USERNAME" /> </group> Not tested but should work. What file name? Link to comment
50p Posted March 8, 2013 Share Posted March 8, 2013 Read my post again. ACL.xml is found in the server's directory. Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 Try this: -- make new line (21) in s_main.lua local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL and ( not isGuestAccount( plrAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) ) then outputChatBox( "You are not member of this team/gang. Please, choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; end In this one where do I put this lua? what file name? Link to comment
iPrestege Posted March 8, 2013 Share Posted March 8, 2013 -- make new line (21) in s_main.lua Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 g_root = getRootElement( ); classGroups = { }; addEvent( "spawn_clientRequestSpawn", true ); addEventHandler( "spawn_clientRequestSpawn", g_root, function( categoryIndex, classIndex, skinIndex, password ) if skinIndex then local class = classGroups[ categoryIndex ].classes[ classIndex ]; if class.password then if not password or password == "" then triggerClientEvent( client, "spawn_requestPassword", root, class.name ); return; elseif password ~= class.password then outputChatBox( "The password you typed in is incorrect! Try again or cancel to choose different class.", client, 200, 50, 50 ); triggerClientEvent( client, "spawn_requestPassword", root, class.name ); return; end end -- make new line (21) in s_main.lua local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL and ( not isGuestAccount( plrAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) ) then outputChatBox( "You are not member of this team/gang. Please, choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; end local skin = class.skinMngr.skins[ skinIndex ]; local spawn = true; local spawned; --[[if not classGroups[ cetegoryIndex ].owner then -- if there is NO owner of the clan/gang spawn player spawn = true; else -- if there IS owner of the clan/gang then check if he's member of the clan/gang end]] if spawn then if not class.team then class.team = createTeam( class.name, class.color.red, class.color.green, class.color.blue ); end local plrTeam = getPlayerTeam( client ); if ( ( plrTeam ) and ( plrTeam ~= class.team ) and ( countPlayersInTeam( plrTeam ) == 1 ) ) then destroyElement( plrTeam ); end spawned = spawnPlayer( client, skin.spawnLoc.x, skin.spawnLoc.y, skin.spawnLoc.z, skin.spawnLoc.rot, skin.modelId, 0, 0, class.team ); end if spawned then setElementData( client, "team", class.name ) setElementData( client, "skin", skin.name ) fadeCamera( client, true ); setCameraTarget( client, client ); setTimer( setCameraTarget, 200, 1, client, client ); triggerClientEvent( client, "spawn_SpawnedSuccessfully", client ); --setPlayerMoney( client, 500 ); for _, weapon in ipairs( class.weaponMngr.weapons ) do giveWeapon( client, weapon.id, weapon.ammo, false ); end createBlipAttachedTo( client, 0, 2, class.color.red, class.color.green, class.color.blue ) else triggerClientEvent( client, "spawn_FailedToSpawn", client ); if countPlayersInTeam( class.team ) == 0 then destroyElement( class.team ); class.team = nil; end end end end ); addEvent( "spawn_receivePassword", true ); addEventHandler( "spawn_receivePassword", g_root, function( ) end ); addEventHandler( "onPlayerSpawn", g_root, function ( ) end ); addEventHandler( "onPlayerWasted", g_root, function( ) fadeCamera( source, false, 4 ); setTimer( requestMenu, 5000, 1, source ); deleteAllPlayerBlips( source ) end ); function requestMenu( player ) callClientFunc( player, "showSpawnMenu", true, true ); callClientFunc( player, "classSelected" ); end addCommandHandler( "kill", function( plr ) killPed( plr ); end ) function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end addEventHandler( "onResourceStart", getResourceRootElement(), preloadClassesInfo ) function deleteAllPlayerBlips(player) local elements = getAttachedElements(player) if (elements) then for i, element in ipairs(elements) do if (getElementType(element) == "blip") then destroyElement(element) end end end print( "number of players in team: " .. tostring( countPlayersInTeam( getPlayerTeam( player ) ) ) ); end addEventHandler( "onPlayerQuit", g_root, function() deleteAllPlayerBlips(source) end ); ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ function callClientFunc( player, funcName, ... ) if #{ ... } ~= 0 then triggerClientEvent( player, "_clientCallFunction", root, funcName, ... ) else triggerClientEvent( player, "_clientCallFunction", root, funcName ) end end addEvent( "_serverCallFunction", true ) addEventHandler( "_serverCallFunction", root, function( funcName, ... ) _G[ funcName ](...) end ) Like this? Link to comment
illestiraqi Posted March 9, 2013 Author Share Posted March 9, 2013 Is it correct yes or no? Link to comment
50p Posted March 9, 2013 Share Posted March 9, 2013 It seems like it but why do you ask? Why don't you test and see for yourself? Link to comment
illestiraqi Posted March 10, 2013 Author Share Posted March 10, 2013 While Im adding the script in this script -- make new line (21) in s_main.lua local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL and ( not isGuestAccount( plrAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) ) then outputChatBox( "You are not member of this team/gang. Please, choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; end I will have to ONLY change the | To the one I want acl permission? ( class.name ) and... isObjectInACLGroup( "user." Only user part correct? Link to comment
50p Posted March 10, 2013 Share Posted March 10, 2013 class.name is read from the spawn_locations.map file. That's the group name you need to add to acl.xml. Why don't you read my previous posts? ...Also, make a new ACL group for each team (eg. team "Police") you want to restrict and add for each player inside that group: <group name="Police" > <object name="user.USERNAME" /> </group> Not tested but should work. This was just an example. If you don't have class with name "Police" don't add that group to acl.xml. Just add the groups that you want to restrict. If you haven't modified spawn_locations.map then you can try "Las Venturas Police" instead. Link to comment
illestiraqi Posted March 11, 2013 Author Share Posted March 11, 2013 When I try it in-game in the console this is given: [01:46:31] ERROR: Client triggered serverside event spawn_clientRequestSpawn, but event is not added serverside Any idea why? Also when I try spawning as something else still give me same problem Link to comment
Castillo Posted March 11, 2013 Share Posted March 11, 2013 Check the debugscript for errors on the server side script. Link to comment
illestiraqi Posted March 23, 2013 Author Share Posted March 23, 2013 While Im adding the script in this script -- make new line (21) in s_main.lua local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL and ( not isGuestAccount( plrAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) ) then outputChatBox( "You are not member of this team/gang. Please, choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; end I will have to ONLY change the | To the one I want acl permission? ( class.name ) and... isObjectInACLGroup( "user." Only user part correct? In this post here... I'm trying to say where it shows class.name is that where i put the name of the team I want ACL connect? EDIT: Here is my s_main.lua g_root = getRootElement( ); classGroups = { }; addEvent( "spawn_clientRequestSpawn", true ); addEventHandler( "spawn_clientRequestSpawn", g_root, function( categoryIndex, classIndex, skinIndex, password ) if skinIndex then local class = classGroups[ categoryIndex ].classes[ classIndex ]; if class.password then if not password or password == "" then triggerClientEvent( client, "spawn_requestPassword", root, class.name ); return; elseif password ~= class.password then outputChatBox( "The password you typed in is incorrect! Try again or cancel to choose different class.", client, 200, 50, 50 ); triggerClientEvent( client, "spawn_requestPassword", root, class.name ); return; end end -- make new line (21) in s_main.lua local classACL = aclGetGroup( Police ); local plrAccount = getPlayerAccount( client ); if ( classACL and ( not isGuestAccount( plrAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) ) then outputChatBox( "You are not member of this team/gang. Please, choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; end local skin = class.skinMngr.skins[ skinIndex ]; local spawn = true; local spawned; --[[if not classGroups[ cetegoryIndex ].owner then -- if there is NO owner of the clan/gang spawn player spawn = true; else -- if there IS owner of the clan/gang then check if he's member of the clan/gang end]] if spawn then if not class.team then class.team = createTeam( class.name, class.color.red, class.color.green, class.color.blue ); end local plrTeam = getPlayerTeam( client ); if ( ( plrTeam ) and ( plrTeam ~= class.team ) and ( countPlayersInTeam( plrTeam ) == 1 ) ) then destroyElement( plrTeam ); end spawned = spawnPlayer( client, skin.spawnLoc.x, skin.spawnLoc.y, skin.spawnLoc.z, skin.spawnLoc.rot, skin.modelId, 0, 0, class.team ); end if spawned then setElementData( client, "team", class.name ) setElementData( client, "skin", skin.name ) fadeCamera( client, true ); setCameraTarget( client, client ); setTimer( setCameraTarget, 200, 1, client, client ); triggerClientEvent( client, "spawn_SpawnedSuccessfully", client ); --setPlayerMoney( client, 500 ); for _, weapon in ipairs( class.weaponMngr.weapons ) do giveWeapon( client, weapon.id, weapon.ammo, false ); end createBlipAttachedTo( client, 0, 2, class.color.red, class.color.green, class.color.blue ) else triggerClientEvent( client, "spawn_FailedToSpawn", client ); if countPlayersInTeam( class.team ) == 0 then destroyElement( class.team ); class.team = nil; end end end end ); addEvent( "spawn_receivePassword", true ); addEventHandler( "spawn_receivePassword", g_root, function( ) end ); addEventHandler( "onPlayerSpawn", g_root, function ( ) end ); addEventHandler( "onPlayerWasted", g_root, function( ) fadeCamera( source, false, 4 ); setTimer( requestMenu, 5000, 1, source ); deleteAllPlayerBlips( source ) end ); function requestMenu( player ) callClientFunc( player, "showSpawnMenu", true, true ); callClientFunc( player, "classSelected" ); end addCommandHandler( "kill", function( plr ) killPed( plr ); end ) function preloadClassesInfo( ) local groups = getElementsByType( "category" ); for _, group in ipairs( groups ) do table.insert( classGroups, Group:New( group ) ); end end addEventHandler( "onResourceStart", getResourceRootElement(), preloadClassesInfo ) function deleteAllPlayerBlips(player) local elements = getAttachedElements(player) if (elements) then for i, element in ipairs(elements) do if (getElementType(element) == "blip") then destroyElement(element) end end end print( "number of players in team: " .. tostring( countPlayersInTeam( getPlayerTeam( player ) ) ) ); end addEventHandler( "onPlayerQuit", g_root, function() deleteAllPlayerBlips(source) end ); ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ function callClientFunc( player, funcName, ... ) if #{ ... } ~= 0 then triggerClientEvent( player, "_clientCallFunction", root, funcName, ... ) else triggerClientEvent( player, "_clientCallFunction", root, funcName ) end end addEvent( "_serverCallFunction", true ) addEventHandler( "_serverCallFunction", root, function( funcName, ... ) _G[ funcName ](...) end ) Now when I try joining Police team it says "You are not member of this team/gang. Please, choose different team!" and I am in the Police ACL team... also when I try joining different teams it still says "You are not member of this team/gang. Please, choose different team!" even if its not ACL... Link to comment
50p Posted March 25, 2013 Share Posted March 25, 2013 Simply copy and replace the old code at line 21: -- line 21: local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL ) then if ( not isGuestAccount( plrAccount ) ) and ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) then outputChatBox( "You are not member of this team/gang. Choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; elseif isGuestAccount( plrAccount ) then outputChatBox( "If you are member of \"" .. class.name .. "\" then please log in before you proceed.", client, 200, 50, 50 ); requestMenu( client ); return; end end Tested it and it works. Link to comment
illestiraqi Posted March 25, 2013 Author Share Posted March 25, 2013 hmm weird I put my friend in the Police ACL team and I tried it and let me access... Link to comment
50p Posted March 25, 2013 Share Posted March 25, 2013 Show your ACL group. Tested it with and worked fine: <group name="Robber"> <object name="user.50p"></object> </group> Link to comment
illestiraqi Posted March 25, 2013 Author Share Posted March 25, 2013 Simply copy and replace the old code at line 21: -- line 21: local classACL = aclGetGroup( class.name ); local plrAccount = getPlayerAccount( client ); if ( classACL ) then if ( not isGuestAccount( plrAccount ) ) and ( not isObjectInACLGroup( "user." .. getAccountName( plrAccount ), classACL ) ) then outputChatBox( "You are not member of this team/gang. Choose different team!", client, 200, 50, 50 ); requestMenu( client ); return; elseif isGuestAccount( plrAccount ) then outputChatBox( "If you are member of \"" .. class.name .. "\" then please log in before you proceed.", client, 200, 50, 50 ); requestMenu( client ); return; end end Tested it and it works. Wait... on line 2 do i have to change class.name? EDIT: Guess not I changed it back to class.name and works Thank you Link to comment
RangeR.. Posted June 22, 2013 Share Posted June 22, 2013 Confused , where is line 21 in s_main.lua i added it at last and i can enter no team also public Teams 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