So this is the code using player,price ,how ever i cant figure out where to rewrite what you have giving me in possible to making it work
Edit: put the full gate.lua into this
if onServer() then
package.path = package.path .. ";data/scripts/lib/cmd/?.lua"
package.path = package.path .. ";data/scripts/lib/?.lua"
require "common"
SectorGenerator = require ("SectorGenerator")
Placer = require ("placer")
function initialize(help, action, ...)
local flag, msg = false, ""
player = Player()
if action == "create" then
local ship = Entity(Player().craftIndex)
flag, msg = popWormhole(ship, ...)
else
player:sendChatMessage("Gate", 0, "Unknown action: "..action)
end
terminate()
end
local station
function popWormhole(ship, x1, y1)
--local player,price = Player(),0
if onClient() then
invokeServerFunction("popWormhole")
return
end
local player,price = Player(),0
if not player:canPayMoney(price) then
player:sendChatMessage("Station Founder"%_t, 1, "You Need 1000000 credits!")
return
end
if player:canPayMoney(price) then
player:payMoney(price)
local generator = SectorGenerator(Sector():getCoordinates())
local faction = Faction()
station = ShipGenerator.createShipGate(faction)
center = center or vec3()
station.position = MatrixLookUpPosition(vec3(0, 1, 0), vec3(1, 0, 0), center + random():getDirection() * random():getFloat(500, 750))
Placer.resolveIntersections()
local plan = PlanGenerator.makeGatePlan()
station:setPlan(plan)
station.invincible = true
station.title = "Hacked Warp Gate"%_t
local sector = Sector()
local wormhole = createWormhole(station.translationf,x1,y1)
end
end
function createWormhole(center, x1, y1)
center = center or vec3()
local wormholeLifetime = 55
-- spawn a wormhole
local desc = WormholeDescriptor()
desc.position = station.position
desc.cpwormhole.color = ColorRGB(0, 0, 1)
--desc:addScript("data/scripts/entity/gate.lua")
local size = random():getFloat(75, 150)
local x, y = Sector():getCoordinates()
local own = vec2(x, y)
local d = length(own)
local distanceInside = 355;
local specs = SectorSpecifics()
local x, y = Sector():getCoordinates()
local coords = specs.getShuffledCoordinates(random(), x, y, 1, 25)
local serverSeed = Server().seed
--local x1, y1 = Sector():getCoordinates()
local wormhole = desc.cpwormhole
--local faction1 = Galaxy():getNearestFaction(x, y)
wormhole:setTargetCoordinates(x1, y1)
wormhole.visible = false
wormhole.visualSize = 50
wormhole.passageSize = 50
wormhole.oneWay = false
wormhole.simplifiedVisuals = true
--wormhole.title = getGateName()
local wormhole = Sector():createEntity(desc)
--local timer = DeletionTimer(wormhole.index)
--timer.timeLeft = wormholeLifetime
wormhole.translation = station.translation
return wormhole
end
end