Jump to content

Gate maker


joedajoester

Recommended Posts

Hi, im new here and i wanted a gate maker and found one on the community and when i try to make a gate with the command /addgate object id so i type addgate 0006 and nothing happens. I check the server window and it says bad argument so this is exactly what it says,

Warning: gate_maker\server.lua:19 Bad argument @ 'getTeamName'

Warning: gate _maker\server .lua:35: Bad model id passed to createObject

Warning: gate_maker\server.lua:37: Bad argument @ 'setElementInterior'

Any ideas? i tried upgrade gate_maker and nothing happened it just said upgrading or watever. If i need any additional details like the script lua and meta files posted or download page i will be happy to post it and make it easier for u. Thanks!

-Joe

Link to comment

You can use this script to create gates. All you need to edit is the cords, gate (object id if you wanna change it) which would be 969 in this case. You can change the direction it moves to which would be the offset = part

Let me know if it doesn't work for you because I edited it a bit just to post it here, since it had some coding which you don't need.

If your new to LUA this is a decent script to learn off of imo. I'm new to LUA and I learned a bit from studying it and whatnot.

local gates = 
{ 
    { gate = createObject( 969, 331.2138671875, -1290.6259765625, 53.285789489746, 0, 0, 27.5    ), offset = { 8, 4, 0, 0, 0, 0 } }  
} 
  
  
local function resetBusy( shortestID ) 
    gates[ shortestID ].busy = nil 
end 
  
local function closeDoor( shortestID ) 
    gate = gates[ shortestID ] 
    local nx, ny, nz = getElementPosition( gate.gate ) 
    moveObject( gate.gate, 1000, nx - gate.offset[1], ny - gate.offset[2], nz - gate.offset[3], -gate.offset[4], -gate.offset[5], -gate.offset[6] ) 
    gate.busy = true 
    gate.timer = nil 
    setTimer( resetBusy, 1000, 1, shortestID ) 
end 
  
local function openDoor(thePlayer, commandName, pass) 
        local shortest, shortestID, dist = nil, nil, 10 
        local px, py, pz = getElementPosition(thePlayer) 
         
        for id, gate in pairs(gates) do 
            local d = getDistanceBetweenPoints3D(px,py,pz,getElementPosition(gate.gate)) 
            if d < dist then 
                shortest = gate 
                shortestID = id 
                dist = d 
            end 
        end 
         
        if shortest then 
            if shortest.busy then 
                return 
            elseif shortest.timer then 
                killTimer( shortest.timer ) 
                shortest.timer = nil 
                outputChatBox( "The gate is already open!", thePlayer, 0, 255, 0 ) 
            else 
                local nx, ny, nz = getElementPosition( shortest.gate ) 
                moveObject( shortest.gate, 1000, nx + shortest.offset[1], ny + shortest.offset[2], nz + shortest.offset[3], shortest.offset[4], shortest.offset[5], shortest.offset[6] ) 
                outputChatBox( "You opened the gate!", thePlayer, 0, 255, 0 )    
            end 
            shortest.timer = setTimer( closeDoor, 5000, 1, shortestID ) 
        end 
    end 
end 
addCommandHandler( "gate", openDoor) 

Link to comment

Okay i tried it with ur script and the problem was i was typing in a invalid object id. sooooo i tried the normal script and make no diference so now it works finee but sometimes theres a glitch when i press enter to move the object where it should move to it gives me a past object that i deleted xD one problem though. Its a team gate so i have it opening to the team Admins. when the server restarts because my server is a home one and not 24/7 and when it restarts the teams get deleted and then the gate opens to anyone not on a team therefore when i make a new team and out me on it it wont open to me. so i stop gate_maker and make the teams and and put my online admins on it and start gate_maker and opens to me and everyone else who joins and is not on a team and i put them on a new team called Everyone and then the gate will not open to them. What should i do is there a way i can add specific names for the gate to open to? and i have comcast internet also with like 20 to 15 mbps download and 4 upload lol

Link to comment

Warning: gate_maker\server.lua:19 Bad argument @ 'getTeamName'

Simple, the person opening the door, don't have a team setted so its going to open to everyone that don't have a team, you better get a better code by yourself or just make a script that moves players on register to a default team.

Link to comment

Okay thank you all! I got a auto team from community but didn't get time to configure it, so i will report back as soon as I have time. Today I noticed when I got back from school that there was a round blip on the map in the water but I don't see anything else but a radar blip. I swim to it and nothing. I tried restating server and it is still there. I tried map editor but the blip wasn't there. I'm wondering of someone messed around while I was at school. I asked my admins and they don't know.

Thanks!

Link to comment

Okay so today I got kwksnd he has a police script and when you walk into a marker it creates a team and puts you on it. It has a gate that opens to that team only. So I decided to look in his script and found where the part of the script makes a team and puts you on it and put it into the gate maker script I forget the name of it but my first try was in the wrong lua file and I got it after correcting sone errors I made a team by default and that's it lol. But I feel proud of myself, my first interation with scripting lol. So I was thinking what if I edit or someone else does and makes I open to a certaint acl group. That I'll do everything I needed! But I do not know how to script, maybe I can take parts from other scripts. Can anyone help me learn scripting or give me a website to help and not the wiki page lol.

Edited by Guest
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...