Jump to content

[HELP] BASE


1LoL1

Recommended Posts

As I have to be careful that you enter the Serial IP and only one can open and close BASE? who does what it can not open it you do not have to write it on the right.

function createTheGate () 
         
         myGate1 = createObject ( "ID", "x", "y", "z", "0", "0", "0" ) 
         myGate2 = createObject ( "ID", "x", "y", "z", "0", "0", "0" ) 
         
  
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
 function openMyGate ( )     
 moveObject ( myGate1, 4000, "x", "y", "z" ) 
 end 
 addCommandHandler("open",openMyGate) 
  
 function movingMyGateBack () 
 moveObject ( myGate1, 4000, "x", "y", "z" ) 
 end 
 addCommandHandler("close",movingMyGateBack) 
  

Link to comment

delete strings :lol:

function createTheGate () 
        
         myGate1 = createObject ( ID, x, y, z, 0, 0, 0 ) 
         myGate2 = createObject ( ID, x, y, z, 0, 0, 0 ) 
         
  
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
 function openMyGate ( )    
 moveObject ( myGate1, 4000, x, y, z ) 
 end 
 addCommandHandler("open",openMyGate) 
  
 function movingMyGateBack () 
 moveObject ( myGate1, 4000, x, y, z ) 
 end 
 addCommandHandler("close",movingMyGateBack) 

Link to comment
I don't have any idea of what you're blabbering about here and the script you posted has so many errors in it... :roll:

I do not care how many errors there ..:D especially that works :D and I thought that I enter the serial player and only the player can open and close BASE .. other people to write it that you do not have the right to open and close this base.

Link to comment
I would use ACL Groups instead of Serials/IP's of players... If groups then just check or the player is in that specific group which can open and close the gate.
aclGetGroup 

So that?

function createTheGate () 
        
         myGate1 = createObject ( ID, x, y, z, 0, 0, 0 ) 
         myGate2 = createObject ( ID, x, y, z, 0, 0, 0 ) 
        
  
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
 function openMyGate ( )   
      accountname = getAccountName (getPlayerAccount(v)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 4000, x, y, z ) 
   else  
       outputChatBox ("You do not have sufficient rights !", playerSource) 
 end 
 addCommandHandler("open",openMyGate) 
  
 function movingMyGateBack () 
      accountname = getAccountName (getPlayerAccount(v)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 4000, x, y, z ) 
       else  
           outputChatBox ("You do not have sufficient rights !", playerSource) 
 end 
 addCommandHandler("close",movingMyGateBack) 

Link to comment
function createTheGate () 
        
         myGate1 = createObject ( ID, x, y, z, 0, 0, 0 ) 
         myGate2 = createObject ( ID, x, y, z, 0, 0, 0 ) 
        
  
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
 function openMyGate (tPlayer)   
      accountname = getAccountName (getPlayerAccount(tPlayer)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 4000, x, y, z ) 
   else 
       outputChatBox ("You do not have sufficient rights !", tPlayer) 
 end 
 addCommandHandler("open",openMyGate) 
  
 function movingMyGateBack (tPlayer) 
      accountname = getAccountName (getPlayerAccount(tPlayer)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 4000, x, y, z ) 
       else 
           outputChatBox ("You do not have sufficient rights !", tPlayer) 
 end 
 addCommandHandler("close",movingMyGateBack) 

Note that this is a serverside script now.

EDIT: Note that your moveObject is using the same positions as createObject has. Also as far as I can see they are not defined in the script.

Link to comment
function createTheGate () 
        
         myGate1 = createObject ( ID, x, y, z, 0, 0, 0 ) 
         myGate2 = createObject ( ID, x, y, z, 0, 0, 0 ) 
        
  
      end 
  
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) 
  
 function openMyGate (tPlayer)   
      accountname = getAccountName (getPlayerAccount(tPlayer)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 4000, x, y, z ) 
   else 
       outputChatBox ("You do not have sufficient rights !", tPlayer) 
 end 
 addCommandHandler("open",openMyGate) 
  
 function movingMyGateBack (tPlayer) 
      accountname = getAccountName (getPlayerAccount(tPlayer)) 
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
 moveObject ( myGate1, 4000, x, y, z ) 
       else 
           outputChatBox ("You do not have sufficient rights !", tPlayer) 
 end 
 addCommandHandler("close",movingMyGateBack) 

Note that this is a serverside script now.

EDIT: Note that your moveObject is using the same positions as createObject has. Also as far as I can see they are not defined in the script.

Script is turned on but the gate does not show up :(

Link to comment

Replace:

accountname = getAccountName (getPlayerAccount(tPlayer)) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) 

With:

local isAllowed = false 
for placeNumber, stringData in ipairs(acceptedGroups) do 
    accountname = getAccountName (getPlayerAccount(tPlayer)) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( stringData ) ) 
        isAllowed = true 
    end 
end 
if (isAllowed == true) then 
    --Code... 
  

Add:

acceptedGroups = { 
"Group", 
"Another Group", 
"More", 
"Mooooore", 
} 

You can add more in the acceptedGroups Table.

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