homar Posted May 6, 2011 Posted May 6, 2011 (edited) 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 May 9, 2011 by Guest
Castillo Posted May 6, 2011 Posted May 6, 2011 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 )
homar Posted May 6, 2011 Author Posted May 6, 2011 i want to admins not fot team , admins who can ban , kick etc .... i don't know the function to get player from his group , and i want it auto if he is near to door it's will be open !
Castillo Posted May 6, 2011 Posted May 6, 2011 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
homar Posted May 6, 2011 Author Posted May 6, 2011 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 )
Castillo Posted May 6, 2011 Posted May 6, 2011 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 )
homar Posted May 6, 2011 Author Posted May 6, 2011 can you see me what i forgot it's work , but i don't see the bug in mine , show me the line please
Castillo Posted May 6, 2011 Posted May 6, 2011 myMarker = createMarker ( -696.35626220703, 966.18280029297, 12.28093624115 'corona', 2.0, 0, 120, 225, 150 )
homar Posted May 8, 2011 Author Posted May 8, 2011 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 )
Alex10 Posted May 8, 2011 Posted May 8, 2011 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
homar Posted May 9, 2011 Author Posted May 9, 2011 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 )
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