Jump to content

Help please [FIXED] THX ALL


homar

Recommended Posts

gate for Admins ( help please )

this one i made with commande /open and /close .

but i tried to make for admins if i was near to gate it's will be open auto

this one i made it :

door = createObject (969, -693.33526611328, 961.4765625, 11.519198417664, 0, 0, 90) 
  
function opendoor ( ) 
    x,z,y = getElementPosition(door) 
    moveObject ( door, 1500, -693.3701171875, 970.4765625, 11.519198417664 ) 
     
end 
addCommandHandler ( "open", opendoor ) 
  
function closedoor ( ) 
    x,z,y = getElementPosition(door) 
    moveObject ( door, 1500, -693.33526611328, 961.4765625, 11.519198417664 ) 
     
end 
addCommandHandler ( "close", closedoor ) 
  

this one i made it but not work :( :

    door = createObject ( 969, x + 5, y, z ) 
  
Player = getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam ( "Admins" ) 
if ( Player ) then 
    x, y, z = getElementPosition ( Player ) 
    moveObject ( bed, 3000, x, y, z ) 
  
  

Edited by Guest
Link to comment

You want to check if the player who types the command is on "Admins" team, right?

door = createObject (969, -693.33526611328, 961.4765625, 11.519198417664, 0, 0, 90) 
  
function opendoor (player) 
local team = getPlayerTeam(player) 
if team then 
if  getTeamName(team) == "Admins" then 
    x,z,y = getElementPosition(door) 
    moveObject ( door, 1500, -693.3701171875, 970.4765625, 11.519198417664 ) 
        end 
    end 
end 
addCommandHandler ( "open", opendoor ) 
  
function closedoor (player) 
local team = getPlayerTeam(player) 
if team then 
if  getTeamName(team) == "Admins" then 
    x,z,y = getElementPosition(door) 
    moveObject ( door, 1500, -693.33526611328, 961.4765625, 11.519198417664 ) 
         end 
    end 
end 
addCommandHandler ( "close", closedoor ) 
  

Link to comment
door = createObject (969, -693.33526611328, 961.4765625, 11.519198417664, 0, 0, 90) 
  
function opendoor (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    moveObject ( door, 1500, -693.3701171875, 970.4765625, 11.519198417664 ) 
        end 
    end 
end 
addCommandHandler ( "open", opendoor ) 
  
function closedoor (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    moveObject ( door, 1500, -693.33526611328, 961.4765625, 11.519198417664 ) 
         end 
    end 
end 
addCommandHandler ( "close", closedoor ) 
  

If you want to make it "auto" you need a marker or a collision shape.

https://wiki.multitheftauto.com/wiki/Ser ... _functions

https://wiki.multitheftauto.com/wiki/Ser ... _functions

Link to comment

i made it but still not work :(

door = createObject (969, -693.33526611328, 961.4765625, 11.519198417664, 0, 0, 90) 
myMarker = createMarker ( -696.35626220703, 966.18280029297, 12.28093624115 'corona', 2.0, 0, 120, 225, 150 ) 
  
function markerHit (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    moveObject ( door, 1500, -693.3701171875, 970.4765625, 11.519198417664 ) 
        end 
    end 
end 
addEventHandler ( "onMarkerHit", myMarker, markerHit ) 
  
function markerLeave (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    moveObject ( door, 1500, -693.33526611328, 961.4765625, 11.519198417664 ) 
         end 
    end 
end 
addEventHandler ( "onMarkerLeave", myMarker, markerLeave ) 
  

Link to comment

You forgot a comma in createMarker function ;)

door = createObject (969, -693.33526611328, 961.4765625, 11.519198417664, 0, 0, 90) 
myMarker = createMarker ( -696.35626220703, 966.18280029297, 12.28093624115, 'corona', 2.0, 0, 120, 225, 150 ) 
  
function markerHit (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    moveObject ( door, 1500, -693.3701171875, 970.4765625, 11.519198417664 ) 
        end 
    end 
end 
addEventHandler ( "onMarkerHit", myMarker, markerHit ) 
  
function markerLeave (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
    moveObject ( door, 1500, -693.33526611328, 961.4765625, 11.519198417664 ) 
         end 
    end 
end 
addEventHandler ( "onMarkerLeave", myMarker, markerLeave ) 

Link to comment

i want make this gate for Admins and Mods , but aren't work :( what the function please !

door = createObject (969, -693.33526611328, 961.4765625, 11.519198417664, 0, 0, 90) 
myMarker = createMarker ( -692.35626220703, 966.18280029297, 12.28093624115, 'cylinder', 6.0, 0, 0, 0, 0 ) 
  
function markerHit (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin, Moderator" ) ) then 
    moveObject ( door, 1500, -693.3701171875, 970.4765625, 11.519198417664 ) 
       end 
    end 
end 
addEventHandler ( "onMarkerHit", myMarker, markerHit ) 
  
function markerLeave (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin, Moderator" ) ) then 
    moveObject ( door, 1500, -693.33526611328, 961.4765625, 11.519198417664 ) 
        end 
    end 
end 
addEventHandler ( "onMarkerLeave", myMarker, markerLeave ) 
  

Link to comment
  
if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin, Moderator" ) 
  

"Admin, Moderator" will be taken as 1 group

so

split them out

  
if isObjectInACLGroup ( "user." .. accountName, aclGetGroup( "Admin") or isObjectInACLGroup ( "user." .. accountName, aclGetGroup( "Moderator") 
  

hope this helps

Link to comment

isn't work for Moderators

door = createObject (969, -693.33526611328, 961.4765625, 11.519198417664, 0, 0, 90) 
myMarker = createMarker ( -692.35626220703, 966.18280029297, 12.28093624115, 'cylinder', 6.0, 0, 0, 0, 0 ) 
  
function markerHit (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) or  
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ("Moderator") ) then 
    moveObject ( door, 1500, -693.3701171875, 970.4765625, 11.519198417664 ) 
       end 
    end 
end 
addEventHandler ( "onMarkerHit", myMarker, markerHit ) 
  
function markerLeave (player) 
local theAccount = getPlayerAccount(player) 
if theAccount then 
local accountName = getAccountName(theAccount) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin, Moderator" ) ) then 
    moveObject ( door, 1500, -693.33526611328, 961.4765625, 11.519198417664 ) 
        end 
    end 
end 
addEventHandler ( "onMarkerLeave", myMarker, markerLeave ) 
  

Link to comment

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