Fella Posted July 11, 2013 Share Posted July 11, 2013 so, here's the deal: basically what i want to do is to give access to the "spectate" command to some certain usergroup, so they can spectate ppl via the admin panel or just by pressing "B" in game. that's all fine, but in the same time just adding "command.spectate" in the ACL does nothing at all and i mean it. to make it work i must give this specific usergroup the admin rights in the "Race" settings. which means that this usergroup can not only spectate, but redo maps, set maps, and set gamemode. and this is a complete bullshit. and this completely doesn't suit me. so my question is: how to properly give access to the "spectate" command without letting this usergroup to redo and set maps? thanks in advance. Link to comment
itoko Posted July 11, 2013 Share Posted July 11, 2013 You can edit the race gamemode itself, in the race_server.lua file, replace the manual spectate request function, that should be enough, i haven't tested but give it a try: -- Handle client request for manual spectate addEvent('onClientRequestSpectate', true) addEventHandler('onClientRequestSpectate', g_Root, function(enable) if checkClient( false, source, 'onClientRequestSpectate' ) then return end -- Checks if switching on local player = source if enable then if not stateAllowsManualSpectate() then return end if not _TESTING then -- if isPlayerInACLGroup(player, g_GameOptions.admingroup) then if not RaceMode.isMapRespawn() and g_GameOptions.norsadminspectate then return false end -- else -- if not RaceMode.isMapRespawn() or not g_GameOptions.anyonecanspec then -- return false -- end -- end end end if isPlayerSpectating(player) ~= enable then if enable then clientCall(player, "Spectate.start", 'manual' ) if not g_GameOptions.stealthspectate or not isPlayerInACLGroup(player, g_GameOptions.admingroup) then setPlayerStatus( player, nil, "spectating") end Override.setCollideOthers( "ForSpectating", RaceMode.getPlayerVehicle( player ), 0 ) g_SavedVelocity[player] = {} g_SavedVelocity[player].velocity = {getElementVelocity(g_Vehicles[player])} g_SavedVelocity[player].turnvelocity = {getVehicleTurnVelocity(g_Vehicles[player])} else clientCall(player, "Spectate.stop", 'manual' ) setPlayerStatus( player, nil, "") Override.setCollideOthers( "ForSpectating", RaceMode.getPlayerVehicle( player ), nil ) if g_GameOptions.racerespawn and RaceMode.getNumberOfCheckpoints() > 0 then -- Do respawn style restore restorePlayer( g_CurrentRaceMode.id, player, true, true ) else -- Do 'freeze/collision off' stuff when stopping spectate RaceMode.playerFreeze(player, true, true) TimerManager.createTimerFor("map",player):setTimer(afterSpectatePlayerUnfreeze, 2000, 1, player, true) end end end end ) The commented lines are the conditions for to use the function, you easily edit it for a certain usergroup too, look on the wiki for the isPlayerInACLGroup function. Link to comment
Fella Posted July 17, 2013 Author Share Posted July 17, 2013 firstly, thanks for your reply, secondly, now as far as i can see, anyone can use the spectate command, even a regular players, which is not exactly the result i was hoping for. and thirdly, i wasn't able to find anything about isPlayerInACLGroup in the wiki. could you provide me with a link? i assume, it's the line #25 where i need to replace "player" with my acl grpup(s), right? Link to comment
Jaysds1 Posted July 19, 2013 Share Posted July 19, 2013 2. Use these functions: isObjectInACLGroup -- checks if the object is in the acl group getAccountName -- Get's the player's account name aclGetGroup --Get's the group by name ------------------Example---------------------- isObjectInACLGroup("user."..getAccountName(source),aclGetGroup("admin")) --checks if the player is in the admin group 3. There's no function named "isPlayerInACLGroup". I think he meant "isObjectInACLGroup" 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