Xeno Posted January 22, 2010 Posted January 22, 2010 how would i create a gate that opens only for admins? i have tryed but i have only got a commands... please help me function createGate () gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate(playerSource, commandName) moveObject ( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.207420349121) end addCommandHandler("open", openGate)
Xeno Posted January 22, 2010 Author Posted January 22, 2010 how would i create a gate that opens only for admins? i have tryed but i have only got a commands... please help me function createGate () gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate(playerSource, commandName) moveObject ( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.207420349121) end addCommandHandler("open", openGate)
dzek (varez) Posted January 22, 2010 Posted January 22, 2010 in openGate just check if playerSource is an admin. look at wiki for accounts functions and when pasting your code, use [lua] --your code [/lua] tags
dzek (varez) Posted January 22, 2010 Posted January 22, 2010 in openGate just check if playerSource is an admin. look at wiki for accounts functions and when pasting your code, use [lua] --your code [/lua] tags
Robert333 Posted January 22, 2010 Posted January 22, 2010 This should works, it's from Wiki: function createGate() gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate( playerSource, commandName ) -- FROM WIKI (not mine, so it might be right) -- Open Gate if he has access local playerName = getPlayerName ( playerSource) -- Does he have access to Admin functions? if isObjectInACLGroup( "user." .. playerName, aclGetGroup ( "Admin" ) ) then -- He's an admin. Open the Gate. moveObject( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.207420349121 ) end end addCommandHandler( "open", openGate )
Robert333 Posted January 22, 2010 Posted January 22, 2010 This should works, it's from Wiki: function createGate() gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate( playerSource, commandName ) -- FROM WIKI (not mine, so it might be right) -- Open Gate if he has access local playerName = getPlayerName ( playerSource) -- Does he have access to Admin functions? if isObjectInACLGroup( "user." .. playerName, aclGetGroup ( "Admin" ) ) then -- He's an admin. Open the Gate. moveObject( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.207420349121 ) end end addCommandHandler( "open", openGate )
Xeno Posted January 23, 2010 Author Posted January 23, 2010 nope.... the gate is there but it doesent move .... function createGate() gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate( playerSource, commandName ) local playerName = getPlayerName ( playerSource) ObjectInACLGroup( "User." .. playerName, aclGetGroup ( "Admin." ) ) then moveObject( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.20742034912 ) end end addCommandHandler( "open", openGate ) is what i got so far.... any1?
Xeno Posted January 23, 2010 Author Posted January 23, 2010 nope.... the gate is there but it doesent move .... function createGate() gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate( playerSource, commandName ) local playerName = getPlayerName ( playerSource) ObjectInACLGroup( "User." .. playerName, aclGetGroup ( "Admin." ) ) then moveObject( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.20742034912 ) end end addCommandHandler( "open", openGate ) is what i got so far.... any1?
dzek (varez) Posted January 23, 2010 Posted January 23, 2010 replace getPlayerName with getPlayerAccount and ... read? i`ve told you to put lua code in [lua] [/lua] tags..
dzek (varez) Posted January 23, 2010 Posted January 23, 2010 replace getPlayerName with getPlayerAccount and ... read? i`ve told you to put lua code in [lua] [/lua] tags..
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