Jump to content

moving gates when admin comes near them


Xeno

Recommended Posts

Posted

how would i create a gate that opens only for admins? i have tryed but i have only got a commands... please help me :D

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)

Posted

how would i create a gate that opens only for admins? i have tryed but i have only got a commands... please help me :D

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)

Posted

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 :)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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 :)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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 )

Posted

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 )

Posted

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?

Posted

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?

Posted

replace getPlayerName with getPlayerAccount

and ... read? i`ve told you to put lua code in [lua] [/lua] tags..

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

replace getPlayerName with getPlayerAccount

and ... read? i`ve told you to put lua code in [lua] [/lua] tags..

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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...