Jump to content

[Solved] Trying to modify enter ship distance


MRT

Recommended Posts

It seems this is hard coded, but at least there is a way to change this.

 

This will return the error message "You are too far away" when executed on client:

Player().craftIndex = Entity().index

 

 

But when executed on the server, the distance check will be skipped. So you could change function "onEnter" like this:

function EnterCraft.onEnter()
    invokeServerFunction("enter")
end

function EnterCraft.enter()
    -- Do distance check here
    if checkEntityInteractionPermissions(Entity(), AlliancePrivilege.FlyCrafts) then
        Player().craftIndex = Entity().index
    end
end

 

This will allow you to change your ship without any distance check (only works if you do this via interaction menu, not by pressing T). You can do a custom distance check where I commented in function "enter".

Link to comment
Share on other sites

Oh I see... try this.

 

 

function EnterCraft.onEnter()
    invokeServerFunction("enter", Player().index)
end

function EnterCraft.enter(playerIndex)
    player = Player(playerIndex)
    if checkEntityInteractionPermissions(Entity(), AlliancePrivilege.FlyCrafts) then
        player.craftIndex = Entity().index)
    end
end

 

Btw: only did very short tests for this code as you already figured out, no warrenty  :P

 

Edit: Im not sure how exactly checkEntityInteractionPermissions() works... maybe it should be executed when Player() context is available. If this is true you should execute it in function onEnter().

 

Link to comment
Share on other sites

  • 2 weeks later...

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
×
×
  • Create New...