Jump to content

staff


joedajoester

Recommended Posts

Posted

This doesnt work, i need it to open to moderator super mod and admin, solidsnake14 helped and made this but my moderators cannot use this.

function getPlayerFromPartOfName(playerPart) 
  local pl = getPlayerFromName(playerPart) 
  if isElement(pl) then 
    return pl 
  else 
    for i,v in ipairs (getElementsByType ("player")) do 
      if (string.find(getPlayerName(v),playerPart)) then 
        return v 
      end 
    end 
  end 
end 
  
function Jail (player, command, name) 
    if isStaff(player) then 
    local thePlayer = getPlayerFromPartOfName(name) 
    if not thePlayer then return end 
    if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end 
    setElementData(thePlayer, "jailSkin", getElementModel ( thePlayer )) 
    setElementModel ( thePlayer, 22 ) 
    setElementPosition ( thePlayer, 52, 2483, 21 ) 
    takeAllWeapons ( getRootElement() ) 
    setElementData ( thePlayer, "isJailed", true ) 
    outputChatBox (getPlayerName(thePlayer).." has been jailed", getRootElement(), 255, 0, 0, true ) 
    else 
    outputChatBox ("You cannot use this command!", player, 255, 0, 0, true ) 
    end 
end 
addCommandHandler("jail",Jail) 
  
function Unjail (player, command, name) 
    if isStaff(player) then 
    local thePlayer = getPlayerFromPartOfName(name) 
    if not thePlayer then return end 
    if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end 
    setElementPosition ( thePlayer, 72, 2484, 16.3 ) 
    setElementModel ( thePlayer, tonumber(getElementData(thePlayer,"jailSkin"))) 
    setElementData ( thePlayer, "isJailed", false ) 
    outputChatBox (getPlayerName(thePlayer).." has been unjailed. Be good now, "..getPlayerName(thePlayer), getRootElement(), 0, 255, 0, true ) 
    else 
    outputChatBox ("You cannot unjail yourself!", player, 255, 0, 0, true ) 
    end 
end 
addCommandHandler("unjail",Unjail) 
  
ped1inside = createPed ( 71, 69, 2503, 17) 
setPedRotation (ped1inside, 180) 
  
function respawn() 
   local x,y,z = getElementPosition(source) 
   local rx,ry,rz = getElementRotation(source) 
   setTimer(createPed, 60000, 1, 71, x,y,z,rz) 
   if isElement(ped1inside) then destroyElement(ped1inside) end 
end 
addEventHandler("onPedWasted",ped1inside,respawn) 
  
function visit (player) 
setElementPosition (player, 71, 2499, 17 ) 
end 
addCommandHandler("visitjail", visit) 
  
function isStaff(player) 
    for index, group in ipairs({"Admin", "SuperModerator", "Moderator"}) do 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( group ) ) then 
            return true 
        end 
        break 
    end 
    return false 
end 

Posted
function getPlayerFromNamePart(Name) 
if not (Name) then return end 
          for i,player in ipairs (getElementsByType ("player")) do 
          if (string.find(getPlayerName(player):lower(),Name:lower())) then 
          return player end 
     end 
end 
  
function Jail (player, command, name) 
    if isStaff(player) then 
    local thePlayer = getPlayerFromNamePart(name) 
    if not thePlayer then outputChatBox("This Player Name is not exist!",player,255,0,0) return end 
    if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end 
    setElementData(thePlayer, "jailSkin", getElementModel ( thePlayer )) 
    setElementModel ( thePlayer, 22 ) 
    setElementPosition ( thePlayer, 52, 2483, 21 ) 
    takeAllWeapons ( getRootElement() ) 
    setElementData ( thePlayer, "isJailed", true ) 
    outputChatBox (getPlayerName(thePlayer).." has been jailed", getRootElement(), 255, 0, 0, true ) 
    else 
    outputChatBox ("You cannot use this command!", player, 255, 0, 0, true ) 
    end 
end 
addCommandHandler("jail",Jail) 
  
function Unjail (player, command, name) 
    if isStaff(player) then 
    local thePlayer = getPlayerFromNamePart(name) 
    if not thePlayer then outputChatBox("This Player Name is not exist!",player,255,0,0) return end 
    if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end 
    setElementPosition ( thePlayer, 72, 2484, 16.3 ) 
    setElementModel ( thePlayer, tonumber(getElementData(thePlayer,"jailSkin"))) 
    setElementData ( thePlayer, "isJailed", false ) 
    outputChatBox (getPlayerName(thePlayer).." has been unjailed. Be good now, "..getPlayerName(thePlayer), getRootElement(), 0, 255, 0, true ) 
    else 
    outputChatBox ("You cannot use this command!", player, 255, 0, 0, true ) 
    end 
end 
addCommandHandler("unjail",Unjail) 
  
ped1inside = createPed ( 71, 69, 2503, 17) 
setPedRotation (ped1inside, 180) 
  
function respawn() 
   local x,y,z = getElementPosition(source) 
   local rx,ry,rz = getElementRotation(source) 
   setTimer(createPed, 60000, 1, 71, x,y,z,rz) 
   if isElement(ped1inside) then destroyElement(ped1inside) end 
end 
addEventHandler("onPedWasted",ped1inside,respawn) 
  
function visit (player) 
setElementPosition (player, 71, 2499, 17 ) 
end 
addCommandHandler("visitjail", visit) 
  
function isStaff(player) 
    for index, group in ipairs({"Admin", "SuperModerator", "Moderator"}) do 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( group ) ) then 
            return true 
        end 
    end 
end 

Posted (edited)

how about this one?

col  = createColTube (-1683.0999755859, -2881.1000976563, 50.400001525879, 10, 3) -- enter your cooderates here for your colshape please note 10 and 3 is to do with the size of the shape. 
root = getRootElement () 
  
cone1 = createObject ( 1237, -1679.099609375, -2884.099609375, 51.099998474121, 0, 0, 311.99523925781) -- enter the ID of the object followed by the coordinates 
cone2 = createObject ( 1237, -1681.5, -2881.7998046875, 51.099998474121, 0, 0, 311.99523925781) 
cone3 = createObject ( 1237, -1684.19921875, -2879.3994140625, 51.099998474121, 0, 0, 311.99523925781) 
cone4 = createObject ( 1237, -1686.7998046875, -2877, 51.099998474121, 0, 0, 311.99523925781)   
gate1 = createObject ( 980, -1683, -2881.19921875, 54, 0, 0, 317.99926757813)                                           -- note the rotx y and z may not be required so you just remove these. x y and z is where you would put your cordinates. 
  
  
function Open ( pla ) 
    if getElementType ( pla ) == "player" then 
        if isStaff(pla) then 
            moveObject (cone1, 300, -1679.0999755859, -2884.1000976563, 50) 
            moveObject (cone2, 300, -1681.5, -2881.8000488281, 50) 
            moveObject (cone3, 300, -1684.1999511719, -2879.3999023438, 50) 
            moveObject (cone4, 300, -1686.8000488281, -2877, 50) 
            moveObject (gate1, 2500, -1674.4000244141, -2888.8999023438, 54)    -- here is where you enter the coordinatess of the new location of the object, 2200 = the speed of the movent. 
        end 
    end 
end   
addEventHandler ( "onColShapeHit", col, Open) 
  
function Close ( pla ) 
    if getElementType ( pla ) == "player" then 
        if isStaff(pla) then 
            moveObject (cone1, 300, -1679.099609375, -2884.099609375, 51.099998474121) 
            moveObject (cone2, 300, -1681.5, -2881.7998046875, 51.099998474121) 
            moveObject (cone3, 300, -1684.19921875, -2879.3994140625, 51.099998474121) 
            moveObject (cone4, 300, -1686.7998046875, -2877, 51.099998474121) 
            moveObject (gate1, 2500, -1683, -2881.19921875, 54) -- here is where you copy the coordinates of the orginal location of the object, 2951 = the timer of movent. 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", col, Close ) 
  
function isStaff(player) -- I meant here to replace "pla" with "player". 
    for index, group in ipairs({"Admin", "SuperModerator", "Moderator"}) do 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( group ) ) then 
            return true 
        end 
    end 
end 

Edited by Guest
Posted

I tried this, and it still doesnt open for moderators and smods.

col  = createColTube (-1683.0999755859, -2881.1000976563, 50.400001525879, 10, 3) -- enter your cooderates here for your colshape please note 10 and 3 is to do with the size of the shape. 
root = getRootElement () 
  
cone1 = createObject ( 1237, -1679.099609375, -2884.099609375, 51.099998474121, 0, 0, 311.99523925781) -- enter the ID of the object followed by the coordinates 
cone2 = createObject ( 1237, -1681.5, -2881.7998046875, 51.099998474121, 0, 0, 311.99523925781) 
cone3 = createObject ( 1237, -1684.19921875, -2879.3994140625, 51.099998474121, 0, 0, 311.99523925781) 
cone4 = createObject ( 1237, -1686.7998046875, -2877, 51.099998474121, 0, 0, 311.99523925781)   
gate1 = createObject ( 980, -1683, -2881.19921875, 54, 0, 0, 317.99926757813)                                           -- note the rotx y and z may not be required so you just remove these. x y and z is where you would put your cordinates. 
  
  
function Open ( player ) 
    if getElementType ( player ) == "player" then 
        if isStaff(player) then 
            moveObject (cone1, 300, -1679.0999755859, -2884.1000976563, 50) 
            moveObject (cone2, 300, -1681.5, -2881.8000488281, 50) 
            moveObject (cone3, 300, -1684.1999511719, -2879.3999023438, 50) 
            moveObject (cone4, 300, -1686.8000488281, -2877, 50) 
            moveObject (gate1, 2500, -1674.4000244141, -2888.8999023438, 54)    -- here is where you enter the coordinatess of the new location of the object, 2200 = the speed of the movent. 
    else 
    return end   
    end 
end   
addEventHandler ( "onColShapeHit", col, Open) 
  
function Close ( player ) 
    if getElementType ( player ) == "player" then 
        if isStaff(player) then 
            moveObject (cone1, 300, -1679.099609375, -2884.099609375, 51.099998474121) 
            moveObject (cone2, 300, -1681.5, -2881.7998046875, 51.099998474121) 
            moveObject (cone3, 300, -1684.19921875, -2879.3994140625, 51.099998474121) 
            moveObject (cone4, 300, -1686.7998046875, -2877, 51.099998474121) 
            moveObject (gate1, 2500, -1683, -2881.19921875, 54) -- here is where you copy the coordinates of the orginal location of the object, 2951 = the timer of movent. 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", col, Close ) 
  
function isStaff(player) -- I meant here to replace "pla" with "player". 
    for index, group in ipairs({"Admin", "SuperModerator", "Moderator"}) do 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( group ) ) then 
            return true 
        end 
    end 
end 

I dont understand what you mean

Posted

This, i get no error, it has the same ifstaff like in the jail script.

col  = createColTube (-1683.0999755859, -2881.1000976563, 50.400001525879, 10, 3) -- enter your cooderates here for your colshape please note 10 and 3 is to do with the size of the shape. 
root = getRootElement () 
  
cone1 = createObject ( 1237, -1679.099609375, -2884.099609375, 51.099998474121, 0, 0, 311.99523925781) -- enter the ID of the object followed by the coordinates 
cone2 = createObject ( 1237, -1681.5, -2881.7998046875, 51.099998474121, 0, 0, 311.99523925781) 
cone3 = createObject ( 1237, -1684.19921875, -2879.3994140625, 51.099998474121, 0, 0, 311.99523925781) 
cone4 = createObject ( 1237, -1686.7998046875, -2877, 51.099998474121, 0, 0, 311.99523925781)   
gate1 = createObject ( 980, -1683, -2881.19921875, 54, 0, 0, 317.99926757813)                                           -- note the rotx y and z may not be required so you just remove these. x y and z is where you would put your cordinates. 
  
  
function Open ( player ) 
    if getElementType ( player ) == "player" then 
        if isStaff(player) then 
            moveObject (cone1, 300, -1679.0999755859, -2884.1000976563, 50) 
            moveObject (cone2, 300, -1681.5, -2881.8000488281, 50) 
            moveObject (cone3, 300, -1684.1999511719, -2879.3999023438, 50) 
            moveObject (cone4, 300, -1686.8000488281, -2877, 50) 
            moveObject (gate1, 2500, -1674.4000244141, -2888.8999023438, 54)    -- here is where you enter the coordinatess of the new location of the object, 2200 = the speed of the movent. 
    else 
    return end  
    end 
end   
addEventHandler ( "onColShapeHit", col, Open) 
  
function Close ( player ) 
    if getElementType ( player ) == "player" then 
        if isStaff(player) then 
            moveObject (cone1, 300, -1679.099609375, -2884.099609375, 51.099998474121) 
            moveObject (cone2, 300, -1681.5, -2881.7998046875, 51.099998474121) 
            moveObject (cone3, 300, -1684.19921875, -2879.3994140625, 51.099998474121) 
            moveObject (cone4, 300, -1686.7998046875, -2877, 51.099998474121) 
            moveObject (gate1, 2500, -1683, -2881.19921875, 54) -- here is where you copy the coordinates of the orginal location of the object, 2951 = the timer of movent. 
        else 
    return end 
    end 
end 
addEventHandler ( "onColShapeLeave", col, Close ) 
  
function isStaff(player) 
    for index, group in ipairs({"Admin", "SuperModerator", "Moderator"}) do 
        if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( group ) ) then 
            return true 
        end 
    end 
end 

Posted

None of my Smods can open it. Only the admins can. Is there another way? I am very frustrated right now because i have tried changing the script so much to only get errors or not doing what i need.

Posted

Im using that exact code, my acl groups are named Admin SuperModerator and Moderator. Would it be possible to make a new acl group and put only the staff members in it and make the script so it opens to only that group?

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